[BUG] Duplicate Xi2 raw motion events when relative mouse input is enabled

Hello,

may I ask the SDL devs to pay attention to this bug?
https://bugzilla.libsdl.org/show_bug.cgi?id=2963

We’re recently bumped into it when porting our game engine from X11 to
SDL2. Any chance it might get fixed in time for 2.0.4?

Thanks.–
Best regards,
Victor Luchitz

The corresponding X.org bugreport
(https://bugs.freedesktop.org/show_bug.cgi?id=71609) says "Registering
for XI_RawMotion events on the root window makes XInput 2.1 or 2.2
client receive duplicate raw motion events when XGrabPointer is active
on the client window.“
I don’t really know how things work with X11/xinput, but why does SDL2
"register for XI_RawMotion events on the root window” and not on the
client window (which is the window handled by SDL, I guess)?

Cheers,
DanielOn 04/28/2015 11:31 AM, Victor Luchitz wrote:

Hello,

may I ask the SDL devs to pay attention to this bug?
https://bugzilla.libsdl.org/show_bug.cgi?id=2963

We’re recently bumped into it when porting our game engine from X11 to
SDL2. Any chance it might get fixed in time for 2.0.4?

Thanks.

Along with enabling Relative Mouse Motion the window is also grabbed.The
problem is that in X11_SetWindowGrab we grab the pointer by passing True to
owner_events and 0 for event_mask.

From Xlib documentation:

If owner_events is False, all generated pointer events are reported with
respect to grab_window and are reported only if selected by event_mask. If
owner_events is True and if a generated pointer event would normally be
reported to this client, it is reported as usual. Otherwise, the event is
reported with respect to the grab_window and is reported only if selected
by event_mask. For either value of owner_events, unreported events are
discarded.

So since we passed True to owner_events,we get duplicate events.By changing
True to False the problem is gone.

My Question is why X11_XGrabPointer inside X11_SetWindowGrab function
and X11_XGrabPointer inside X11_CaptureMouse act different?I think that
X11_GrabPointer inside X11_SetWIndowGrab should act the same as in
X11_CaptureMouse

X11_SetWindowGrab-------------------------------
X11_XGrabPointer(display, data->xwindow, True, 0, GrabModeAsync,
GrabModeAsync, data->xwindow, None, CurrentTime);

X11_CaptureMouse

const unsigned int mask = ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | FocusChangeMask;
X11_XGrabPointer(display, data->xwindow, False, mask, GrabModeAsync,
GrabModeAsync,None, None, CurrentTime);

Dimitris Zenios

On Tue, Apr 28, 2015 at 4:28 PM, Daniel Gibson wrote:

The corresponding X.org bugreport (
https://bugs.freedesktop.org/show_bug.cgi?id=71609) says "Registering for
XI_RawMotion events on the root window makes XInput 2.1 or 2.2 client
receive duplicate raw motion events when XGrabPointer is active on the
client window.“
I don’t really know how things work with X11/xinput, but why does SDL2
"register for XI_RawMotion events on the root window” and not on the client
window (which is the window handled by SDL, I guess)?

Cheers,
Daniel

On 04/28/2015 11:31 AM, Victor Luchitz wrote:

Hello,

may I ask the SDL devs to pay attention to this bug?
https://bugzilla.libsdl.org/show_bug.cgi?id=2963

We’re recently bumped into it when porting our game engine from X11 to
SDL2. Any chance it might get fixed in time for 2.0.4?

Thanks.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org