sokol icon indicating copy to clipboard operation
sokol copied to clipboard

[Feature Request] - Support for custom mouse cursors in sokol_app

Open jeffkdev opened this issue 3 years ago • 3 comments

Sokol is close to supporting custom cursors icons with the addition of https://github.com/floooh/sokol/issues/78. I made a minimal implementation for Windows here https://github.com/jeffkdev/sokol/commit/54a44d9aeaf6e640aa6587dfc1bf4d50788c802a. I was thinking it would probably need to be changed to use pooled identifiers like the sokol_gfx resources. Currently sokol_app doesn't have any pooled resources, but if that was the eventual plan I could update the example do that as well.

I wasn't sure if this was worth tracking separately from the request of integrating cursors from sokol_imgui (https://github.com/floooh/sokol/issues/459). It looks like the author of that ticket is using cursor features from imgui internals, but ideally would be available in sokol_app directly. But feel free to close this if it feels like a duplicate.

jeffkdev avatar Jan 17 '22 16:01 jeffkdev

Looks like a good start. Yes, the cursor images should use a pool. The WIP multiwindow-branch has a sokol-gfx style pool integrated (for window objects), I can simply rip that out:

https://github.com/floooh/sokol/blob/57688eb0c5d09f6149ae6a612c5b53a56e94c328/sokol_app.h#L2641-L2720

floooh avatar Jan 18 '22 11:01 floooh

Just linking this for cross-reference:

https://github.com/floooh/sokol/pull/678

...it's not "custom cursor images" just yet, instead hardwired/builtin cursor types as needed by Dear ImGui, but its another step in the general direction of user-provided mouse cursors.

floooh avatar Jul 06 '22 18:07 floooh

If anyone stumbles on this in the future, this is how you can do it on the current sokol version on Windows: https://github.com/jeffkdev/sokol/commit/5dbc11b1fc2cafe88b21f3f12684196bd2fc4971

sapp handles the sapp_win32_update_cursor call now so the application doesn't have to do anything with the event anymore.

Edit: icon bool was flipped in initial commit. Updated in this: https://github.com/jeffkdev/sokol/commit/094e04f596d528a118a93592d52258f0c44a488e

jeffkdev avatar Jul 19 '23 23:07 jeffkdev