| Summary: | Incorrect mouse position on first SDL_WarpMouseInWindow() call in fullscreen | ||
|---|---|---|---|
| Product: | SDL | Reporter: | bonsairobo |
| Component: | *don't know* | Assignee: | Sam Lantinga <slouken> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | jonlst |
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
| Attachments: | A short SDL program that demonstrates the bug | ||
I just found out that this doesn't happen if I wait until a SDL_WINDOWEVENT_FOCUS_GAINED event to warp the mouse. Bonsairobo, can you try reproducing with the latest HG version of SDL2? (I.e. one including this change: http://hg.libsdl.org/SDL/rev/b8d4be87970a) Hopefully that fixes your issue. (In reply to Jørgen Tjernø from comment #2) > Bonsairobo, can you try reproducing with the latest HG version of SDL2? > (I.e. one including this change: http://hg.libsdl.org/SDL/rev/b8d4be87970a) > > Hopefully that fixes your issue. I didn't notice a change. The bug persists for me. Used "hg clone http://hg.libsdl.org/SDL". This seems to be due to the SDL_WarpMouseInWindow being called, and afterwards then we get an EnterNotify from the X server, telling us that the cursor is somewhere else. This is possibly related to how we fullscreen? This is not code I'm familiar with, so assigning back to Sam. I'm stuck with porting to SDL2 on this same issue. It seems that the mouse position is incorrect after SDL_WarpMouseInWindow() both in (desktop) fullscreen mode and windowed mode whenever scaling is applied. If the logical screen is the same size as the window everything works as expected. SDL version 2.0.1. |
Created attachment 1241 [details] A short SDL program that demonstrates the bug Upon calling SDL_WarpMouseInWindow(window, WINDOW_SIZE_X / 2, WINDOW_SIZE_Y / 2) (immediately after creating the window) in a fullscreen SDL window, the cursor is not placed in the center, but slightly to the lower right. If the mouse is not moved (by the user) before exiting the program, the cursor will be moved (by SDL) to the center of the screen on exit. If SDL_Delay(x) is called before SDL_WarpMouseInWindow (where x > ~10), this fixes the bug.