| Summary: | [PATCH] Fix SDL_WarpMouseInWindow on both KMSDRM and RaspberryPi drivers | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Manuel Alfayate Corchete <redwindwanderer> |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.7 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Attachments: |
Small patch that fixes SDL_WarpMouseInWindow() on KMSDRM and Raspberry Pi graphic backends
Patch that fixes sticky cursor on programs were mouse coords are tracked but cursor area is smaller than total screen area |
||
|
Description
Manuel Alfayate Corchete
2017-11-20 11:50:36 UTC
Typically drivers call SDL_SendMouseMotion() instead of setting the mouse variables directly. This is standard behavior and apps should be waiting for a mouse motion event with the coordinates that they just called warp with. Can you make that change for both drivers and test it there? Thanks! (In reply to Sam Lantinga from comment #1) > Typically drivers call SDL_SendMouseMotion() instead of setting the mouse > variables directly. This is standard behavior and apps should be waiting for > a mouse motion event with the coordinates that they just called warp with. > > Can you make that change for both drivers and test it there? > > Thanks! That's not such a good idea as things are: tried to use SDL_SendMouseMotion() instead, and that causes a segfault when the cursor is hidden. Something must be done in SDL_SendMouseMotion() sub-functions to correct that, but I don't have the time. If you get it to operate safely when the cursor is hidden (yes, that makes sense and is used in Scummvm) we could use SDL_SendMouseMotion() instead if you want. But as things are now, manually updating the position is the only working way. I don't have a KMSDRM or Raspberry Pi testing environment, can you investigate why it's crashing when the mouse is hidden? That sounds like a bug - it should be safe to call it anytime. Created attachment 3101 [details]
Patch that fixes sticky cursor on programs were mouse coords are tracked but cursor area is smaller than total screen area
(In reply to Sam Lantinga from comment #3) > I don't have a KMSDRM or Raspberry Pi testing environment, can you > investigate why it's crashing when the mouse is hidden? That sounds like a > bug - it should be safe to call it anytime. In the end, it was a recursion bug: KMSDRM_MoveCursor() was calling KMSDRM_WarpMouse() was calling SDL_SendMouseMotion() was calling SDL_PrivateSendMouseMotion() was calling KMSDRM_MoveCursor().... Boom!!! :D So calling SDL_WarpMouse in KMSDRM_MoveCursor was plain wrong. Cursor HAS to be moved, but not calling KMSDRM_WarpMouse()... bad, bad idea. Anyway, here's what I hope to be the final patch on this. It works by callin SendMouseMotion as intended, and works perfectly well on both the Raspberry Pi and KMSDRM. Please merge: I really want this fixed. (The patch is in the previous message) Fixed, thanks! https://hg.libsdl.org/SDL/rev/73826bd39748 |