-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SetCursor event + window handle #78
Comments
Both are good suggestions. I didn't want to add complete custom-cursor-image support (at least not yet), so exposing an WM_SETCURSOR as event looks like a good first step in that direction. I need to figure out how that would work on OSX and Linux (...basically what GLFW does). For exposing the window handles (and maybe a few other things) I think it makes sense to add platform-specific functions (similar to the sapp_d3d11_* and sapp_metal_* functions that already exist). For instance I'll try to look into this over the next days. |
Ok, a first Windows version is in: I had to add a member ".user_cursor" to the sapp_desc struct, and in order to receive SAPP_EVENTTYPE_UPDATE_CURSOR events you'll need to set this to true. The reason for this is that Windows won't update the "system mouse cursor" image anymore if WM_SETCURSOR returns with 1 (or TRUE), so I only do this when the user requests to manage the cursor image/visibility himself. I also found a difference between MacOS and Windows: on Windows, WM_SETCURSOR is sent each frame when the mouse is moved inside the window client area. On Mac, a similar message is only sent once when the mouse enters the window. In your use case, do you require the Windows behaviour (sent each frame when mouse moves in window), or would you be ok with only receiving a single message when the mouse enters the window? PS: there's now also a function |
awesome, works in windows |
Closing this, although "proper" cursor image handling would be nice. Should be a separate issue though. |
Hi,
I was wondering if sokol could implement SetCursor event for desktop apps
I don't know about linux/mac platforms, but in windows I'd like to use WM_SETCURSOR to change the cursor in gui (like imgui). I could add the support to windows easily by adding these lines to _sapp_win32_wndproc's switch:
Also, is there any way to fetch the window handle in order to implement some extra functions like SetCapture, ReleaseCapture (for drag&drop)
The text was updated successfully, but these errors were encountered: