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 2996

Summary: Grabbed input does not create SDL_MOUSEMOTION events on X11 (issue introduced post-2.0.3)
Product: SDL Reporter: Zack Middleton (zturtleman) <zack>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: HG 2.0Keywords: target-2.0.4
Hardware: x86_64   
OS: Linux   
Attachments: Make testrelative use SDL_SetWindowGrab

Description Zack Middleton (zturtleman) 2015-05-28 20:26:50 UTC
Created attachment 2165 [details]
Make testrelative use SDL_SetWindowGrab

SDL_MOUSEMOTION events are not sent for grabbed windows when relative mouse mode is enabled on Linux X11. It was introduced by commit https://hg.libsdl.org/SDL/rev/c9c61d66cfa0

If the owner_events (the third argument for X11_XGrabPointer) is changed back to True then SDL_MOUSEMOTION events are sent as expected.

Attached is a patch that modifies the "testrelative" program to use grabbed input to demonstrate the issue (the red block representing the cursor does not move).

My thought would be to change X11_XGrabPointer to use True in X11_CaptureMouse and X11_SetWindowGrab, though I don't really understand what the argument does[1] and haven't tested CaptureMouse at all.

[1] http://tronche.com/gui/x/xlib/input/XGrabPointer.html
Comment 1 Ryan C. Gordon 2015-05-28 21:26:11 UTC
Gonna look at this for 2.0.4.

--ryan.
Comment 2 Ryan C. Gordon 2015-06-07 22:02:14 UTC
I backed out the problem changeset with https://hg.libsdl.org/SDL/rev/42877ed9b1c5, please verify this solves the problem on your end, please!

--ryan.
Comment 3 Zack Middleton (zturtleman) 2015-06-07 22:09:59 UTC
Yes, that solved the issue.
Comment 4 Ryan C. Gordon 2015-06-07 22:30:54 UTC
(In reply to Zack Middleton from comment #3)
> Yes, that solved the issue.

Thank you!

--ryan.