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 4175

Summary: Pressing or releasing mouse button can generate SDL_MOUSEMOTION events
Product: SDL Reporter: Geoff Pritchard <g.pritchard>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: kyonides, sezeroz
Version: 2.0.8   
Hardware: x86   
OS: Windows 10   
Attachments: Program to demonstrate the bug

Description Geoff Pritchard 2018-05-26 01:18:43 UTC
Created attachment 3249 [details]
Program to demonstrate the bug

This is best demonstrated on a laptop where the mouse pad and mouse buttons are physically separate hardware, so you can press and release the buttons with no possibility that your finger is inadvertently moving the mouse at the same time.

Even with my fingers nowhere near the mouse pad, I get SDL_MOUSEMOTION events when the left mouse button is pressed or released.

Of course I don't know for sure that this is a bug in SDL - it could be a bug in Windows 10. Probably not a hardware fault though: I've tried it with two different mice.

The attached program (which just reports mouse events) can be used to demonstrate the effect.
Typical output follows. The mouse motion events at times 11602 and 29333 are generated despite there being no actual movement of the mouse:

SDL version 2.0.8

[ ... ]

At time 11066 : event type 1024 : mouse motion to (230,134), button state is 0
At time 11066 : event queue empty, mouse is at (230,134) button state 0

At time 11085 : event type 1024 : mouse motion to (228,136), button state is 0
At time 11085 : event queue empty, mouse is at (228,136) button state 0

[ user removes finger from mouse pad ]

[ user presses and releases left mouse button ]

At time 11602 : event type 1024 : mouse motion to (229,135), button state is 0
At time 11602 : event type 1025 : mouse button down at (229,135), button state is 1
At time 11602 : event queue empty, mouse is at (229,135) button state 1

At time 11796 : event type 1026 : mouse button up at (229,135), button state is 0
At time 11796 : event queue empty, mouse is at (229,135) button state 0

[ ... ]

At time 28816 : event type 1024 : mouse motion to (83,190), button state is 1
At time 28816 : event queue empty, mouse is at (83,190) button state 1

At time 28826 : event type 1024 : mouse motion to (83,189), button state is 1
At time 28826 : event queue empty, mouse is at (83,189) button state 1

[ user removes finger from mouse pad ]

[ user releases left mouse button ]

At time 29333 : event type 1024 : mouse motion to (83,190), button state is 1
At time 29333 : event type 1026 : mouse button up at (83,190), button state is 0
At time 29333 : event queue empty, mouse is at (83,190) button state 0
Comment 1 kyonides 2018-11-27 22:27:13 UTC
Sadly, I got to admit it is happening on Kubuntu 18.04, 64 bit, with SDL 2.0.8 as well. By the way, I am using an Intel desktop PC.