| Summary: | Relative mouse motion malfunction on first button press | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Matthew Turner <msturner> |
| Component: | events | Assignee: | (disabled) Jørgen Tjernø <jorgen> |
| Status: | RESOLVED DUPLICATE | QA Contact: | Sam Lantinga <slouken> |
| Severity: | blocker | ||
| Priority: | P1 | ||
| Version: | 2.0.0 | ||
| Hardware: | x86 | ||
| OS: | Windows 7 | ||
Bug identified in SDL-2.0.0-7209 snapshot, as well as HG snapshot downloaded on May 25th. This error does not exist in the previous snap shot I was using (March 14th). Currently testing on Windows 7, and building with Visual C++ 2008 (Windows 7 SDK). Relative mouse motion appears to report an incorrect delta at the time of the first mouse button press (any mouse button). The reported delta appears to be the negated sum of all mouse deltas up to that point, effectively resetting the camera view to the initial position. Example execution trace: /* Moving the mouse around on x axis */ Delta: -1 Delta: -2 Delta: -1 Delta: 0 Delta: +1 /* Press mouse button, then the next delta is the negative of the sum of all previous deltas */ Delta: 3 /* Back to normal again */ Delta: -1 This only happens after the first mouse button press, but not for subsequent presses. Curiously, it also does not occur if I rotate the mouse wheel before pressing a mouse button. This suggests to me that some internal/global variable is not being initialized correctly, causing a malfunction when the first mouse button event is processed. I noticed the bug because my game currently starts up in relative mouse motion mode. I expect other games that start with a menu will not reveal this bug because the mouse buttons will have already been pressed before relative mouse motion is enabled. I also found that if I turn off relative mouse motion (e.g. go to menu screen) then turn it back on again (back to game) before pressing a mouse button, the problem does not occur.