We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1865

Summary: Relative mouse motion malfunction on first button press
Product: SDL Reporter: Matthew Turner <msturner>
Component: eventsAssignee: (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   

Description Matthew Turner 2013-05-25 04:10:48 UTC
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.
Comment 1 (disabled) Jørgen Tjernø 2013-06-04 18:39:02 UTC
Tracking this in 1861, sounds like a dupe.

*** This bug has been marked as a duplicate of bug 1861 ***