Nuklear icon indicating copy to clipboard operation
Nuklear copied to clipboard

Fix missed grab state changes in SDL demos

Open paccerdk opened this issue 1 year ago • 3 comments

Moved grab handling out of nk_sdl_handle_event to nk_sdl_handle_grab, which is now called outside of the event loop.

This change makes the logic similar to the GLFW demos and fixes issues with missed grab state changes and mouse cursor disappearing.

Discussed in https://github.com/Immediate-Mode-UI/Nuklear/issues/608

paccerdk avatar Feb 10 '24 02:02 paccerdk

Reverted the order of SDL_SetRelativeMouseMode and SDL_WarpMouseInWindow since it was causing the cursor to warp to center of screen on older SDL versions (tested with SDL 2.0.22)

paccerdk avatar Feb 10 '24 16:02 paccerdk

I like the PR, thanks @paccerdk for spending the time with all the investigations across backends!

Reverted the order of SDL_SetRelativeMouseMode and SDL_WarpMouseInWindow since it was causing the cursor to warp to center of screen on older SDL versions (tested with SDL 2.0.22)

Could you please add a comment to the code about this finding? I find it important to have it documented. Thanks!

dumblob avatar Feb 17 '24 16:02 dumblob

I tested sdl_opengl3 and mouse drag is still looking good :+1:

RobLoach avatar Feb 17 '24 20:02 RobLoach