-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
SDL 3 Cursor misbehavior switching from Fullscreen to Windowed in Wayland when cursor is hidden #9827
Comments
This sounds like a bug in KDE/KWin, as it should be either sending a pointer leave event when the cursor is outside of the window (as Weston does), or warping the cursor back into the grab region (as GNOME does). If the pointer winds up outside of the window and the window still reports mouse focus, that means SDL never got a pointer leave event, which is a compositor bug. |
Yes, because it's hitting the warp emulation path in SDL and switching to relative mode, which doesn't send coordinates, just relative motion events.
I just tested it on KDE and this is correct behavior. The mouse left the window, so MOUSE_FOCUS is lost, but the window still has the grab flag set since the pointer will be confined as soon as it re-enters the window. |
With your commit b1e01b9 I can report that
Would you like the following patch to SDL testing that adds a ShowCursor / HideCursor toggle on Ctrl-h in |
Glad it's working for you now. While working on this, I did find a bug in KDE, where pointer confinement is lost after leaving fullscreen until the pointer leaves and re-enters the window. If you happen to run into it, there is already an upstream bug report opened: https://bugs.kde.org/show_bug.cgi?id=487189
Sure, anything that helps reproduce bugs without having to manually hack up the tests is always helpful. Feel free to make a pull. |
My first PR towards SDL. This is #9848. |
Any other cursor related problems, or can this issue be closed? |
You may close the issue. Just a question : Exult switches correctly from Windowed to Fullscreen and back, whether or not the |
In general, leaving the hints unset is the good thing to do unless you need specific behavior. Thanks! |
Followup of #9799 which fixed the switch from Windowed to Fullscreen, but incompletely the switch from Fullscreen to Windowed.
When switching Exult from Fullscreen to Windowed, no cursor is ever visible on the whole screen
SDL_HideCursor
to prevent the the display of the system cursor and displays its own cursor to track the position of the mouse when inside its window, but the mouse it outside the window,This misbehavior appears to be related with the Mouse Warp emulation in Wayland. Thanks to Kontrabant to identify this.
In that case, is simply the Mouse Warp emulation missing a check to ensure that the mouse position is within the bounds of the window ?
From the discussion that went in exult/exult#379.
Yes, that solves the problem.
Meanwhile, I built a new reproducible case with
testwm
.With a patch to
testwm
to toggleSDL_ShowCursor
andSDL_HideCursor
on the right click of the mouse - borrowed fromtestcursor
in testwm.zip. You might consider adding that permanently, as using a hidden cursor is not uncommon.testwm --grab
( without--grab
this works ) in Linux Fedora 40 Plasma over Wayland,testwm
window,SDL_GetState
for that,With the
SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP
set to 0, the last step changes toNB My previous explanation about the cursor being confined to the game window was that, a MouseGrab. Thus the
--grab
option.Exult only performs MouseGrabs between MOUSE_BUTTON_DOWN and MOUSE_BUTTON_UP. But Exult performs the switch to Fullscreen and back to Windowed in the callback of a MOUSE_BUTTON_UP ( button click ). I have removed the MouseGrabs of Exult and retried, but the problem still shows.
The text was updated successfully, but these errors were encountered: