| Summary: | Relative motion events don't work as expected | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Tomek Bury <tomek.bury> |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | rhamph+libsdl |
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Bug Depends on: | 1174 | ||
| Bug Blocks: | |||
|
Description
Tomek Bury
2010-09-15 07:37:45 UTC
I'm not sure when I'll have time to implement XInput 2, but you're welcome to submit a patch! Just tripped over this using SDL1.3 trunk of May 25th on Linux (KDE desktop). Fullscreen gave correct events but windowed gives absolute from the window edge once you leave the window. Grabbing the mouse stops motion entirely at the edge, but for some applications (including mine) it makes more sense to never grab the mouse. Absolute coordinates actually give the same effect there, without grabbing the mouse, so I think I'll use them when not fullscreen. I should say: when you leave the window it's *like* you're using absolute, but they're measuring the distance from that window edge instead. In contrast, my workaround is to use *actual* absolute coordinates. Ah, my mistake. I don't get events when in fullscreen. Also setting depends-on. I think there are significant differences between cursor motion and mouse motion. Mouse doesn't have absolute (x,y) coordinates, cursor does. The only thing mouse knows is the relative motion (dx, dy). Mouse motion is (partially) limited by the length of mouse cable or range of Bluetooth. Cursor motion is constrained by window size. Mouse is not affected by cursor acceleration settings, cursor is. SDL is trying to recover mouse motion from cursor motion hence the problems. Some are obvious (focus, clamping), some are more subtle (cursor acceleration applied to mouse motion). My initial suggestion was to read the actual mouse events rather than reverse-engineer them from cursor position changes. Unfortunately I haven't got enough time on my hands to come up with the patch. XInput2 relative motion is implemented in the latest snapshot: http://www.libsdl.org/tmp/SDL-2.0.zip |