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 2984 - WarpMouseInWindow doesn't always generate mouse motion event
Summary: WarpMouseInWindow doesn't always generate mouse motion event
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: HG 2.0
Hardware: x86_64 Mac OS X (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-15 07:49 UTC by Joshua Bodine
Modified: 2015-06-01 01:45 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Bodine 2015-05-15 07:49:10 UTC
When a non-fullscreen window is created, and the cursor lies outside the window, calling WarpMouseInWindow() to warp the cursor into the window does not generate a mouse motion event, even if CaptureMouse() was called prior to warping the cursor. However, if the cursor already lies within the window, the mouse motion event is generated as expected. The mouse motion event is also generated upon warping the cursor if the cursor lies outside the window, CaptureMouse() is called, and the cursor is moved at least once (remaining outside the window) prior to warping the cursor into the window.

I created a workaround by pushing a fake mouse motion event with PushEvent() after warping the cursor if a PeepEvents() shows that no motion event was generated after the warp, but I feel it would be better if the behavior was consistent across all these cases. I assume the warp is supposed to always generate a mouse motion event because the wiki states "this function generates a mouse motion event."

My operating system is Mac OS X 10.10.3. I was unable to reproduce this bug on Linux. This bug was seen a build of pre-release 2.0.4 code from mercurial as of 05/13/15.
Comment 1 Ryan C. Gordon 2015-05-31 17:59:40 UTC
This is fixed in https://hg.libsdl.org/SDL/rev/c0ca56ba6749, thanks!

--ryan.
Comment 2 Ryan C. Gordon 2015-06-01 01:45:48 UTC
Actually, better fix for this is now in https://hg.libsdl.org/SDL/rev/1982dc994254

--ryan.