| Summary: | Cursor position not correct until cursor moves | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Sik <sik.the.hedgehog> |
| Component: | *don't know* | Assignee: | (disabled) Jørgen Tjernø <jorgen> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | icculus, jorgen, sylvain.becker |
| Version: | HG 2.0 | Keywords: | target-2.0.12 |
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: | test case not working | ||
|
Description
Sik
2012-09-28 04:01:43 UTC
Should be fixed in http://hg.libsdl.org/SDL/rev/84bbd421d62f - please update if it hasn't been. Re-opening to double check, because: It sends a SDL_MouseMotion event when the app starts (gain focus in EnterNotify and also in LeaveNotify) and when the mouse is not used. I have seen that while trying to remove synthetics events in bug 4690. On wayland, it's not sending it. wayland: https://hg.libsdl.org/SDL/file/fe7caa031d3e/src/video/wayland/SDL_waylandevents.c#l192 x11: SendMouseMotion in EnterNotify and LeaveNotify https://hg.libsdl.org/SDL/annotate/84bbd421d62f/src/video/x11/SDL_x11events.c#l315 https://hg.libsdl.org/SDL/rev/257fc4e541e1 https://hg.libsdl.org/SDL/rev/84bbd421d62f Created attachment 3876 [details]
test case not working
Trying to get a test-case working.
But the SDL_GetMouseState always give (0, 0) as a position on x11. Whatever SDL version I use. So I wonder if this is really fixed ?
(or probably, I have a wrong test case)
If not fixed, maybe we don't need to send MouseMotion event in x11/{Enter,Leave}Notify.
(or we should add it for others like wayland, and other).
(Sorry if you get several emails like this, we're marking a bunch of bugs.) We're hoping to ship SDL 2.0.11 on a much shorter timeframe than we have historically done releases, so I'm starting to tag bugs we hope to have closed in this release cycle. Note that this tag means we just intend to scrutinize this bug for the 2.0.11 release: we may fix it, reject it, or even push it back to a later release for now, but this helps give us both a goal and a wishlist for the next release. If this bug has been quiet for a few months and you have new information (such as, "this is definitely still broken" or "this got fixed at some point"), please feel free to retest and/or add more notes to the bug. --ryan. We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan. We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan. So this isn't _perfect_, but this fixes most of the issue: https://hg.libsdl.org/SDL/rev/11be7c38d220 The test case in Attachment #3876 [details] now will report a 0,0 position in the first call to SDL_GetMouseState(), but once the event loop runs and X11 sends an EnterNotify ("the cursor is inside the window") event, the state is corrected. In short, the first call still reports 0,0, but it no longer stays at 0,0 until you move a mouse. I think this is Good Enough, as SDL is correctly reporting the mouse is outside the window until X11 tells it otherwise, which is does once the event queue catches up. Reopen if this is still not okay, please. --ryan. Hello Ryan, Thanks for fixing ! I think I re-opened this issue because I noticed there was a curious Mouse Motion event sent when the app gained focus. This event is sent to fix SDL_GetMouseState, but we don't really want the event otherwise, there might be no mouse interaction, but only a touch screen or maybe the focus is gained with Ctrl+Tab switching. Maybe we should just add an internal call to a function to set the mouse state and remove this Send_MouseMotionEvent. |