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 2963 - Duplicate Xi2 raw motion events when relative mouse input is enabled
Summary: Duplicate Xi2 raw motion events when relative mouse input is enabled
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.3
Hardware: All Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.4
Depends on:
Blocks:
 
Reported: 2015-04-26 15:00 UTC by Victor Luchits
Modified: 2015-06-08 07:34 UTC (History)
2 users (show)

See Also:


Attachments
Proposed patch (1.30 KB, patch)
2015-05-14 11:44 UTC, Victor Luchits
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Luchits 2015-04-26 15:00:31 UTC
Basically, all raw pointer events are duplicated in SDL and/or XInput2.

I'm not sure whether it is by design or not but this is clearly an undesired behaviour since it results in doubled sensitivity in games or other applications when relative mouse input is requested.

A sister bug was filed for XInput2 but never received any attention from X.org devs: https://bugs.freedesktop.org/show_bug.cgi?id=71609
Comment 1 Victor Luchits 2015-05-12 08:37:11 UTC
Proposed solution can be found here:
http://lists.libsdl.org/pipermail/sdl-libsdl.org/2015-April/000288.html
Comment 2 Andrei Stepanov 2015-05-12 13:04:28 UTC
tried it by my self http://lists.libsdl.org/pipermail/sdl-libsdl.org/2015-April/000288.html

changing True to False in X11_SetWindowGrab's X11_XGrabPointer will fix the duplicated events, but it will break mouse buttons.

though applying the second part of his solution by using tip "X11_GrabPointer inside X11_SetWIndowGrab should act the same as in X11_CaptureMouse" actually makes the proper fix for the duplicated events w/o breaking mouse buttons.
Comment 3 Victor Luchits 2015-05-14 11:44:20 UTC
Created attachment 2154 [details]
Proposed patch

As per http://lists.libsdl.org/pipermail/sdl-libsdl.org/2015-April/000288.html

Verified to work.
Comment 4 Sam Lantinga 2015-05-23 16:37:14 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/c9c61d66cfa0
Comment 5 Ryan C. Gordon 2015-06-07 21:59:56 UTC
This patch caused Bug #2996, so I've backed it out with https://hg.libsdl.org/SDL/rev/42877ed9b1c5

--ryan.
Comment 6 Ryan C. Gordon 2015-06-08 04:49:38 UTC
I don't know, I've read the passage in the XGrabPointer() documentation about owner_events about a million times now, and while I don't _really_ know what it means, I think the initial reading of it was definitely wrong.

This definitely seems like an bug in the X server to me, but I confess that I don't really understand the problem fully.

I think we need to punt on this for 2.0.4 at this point (I thought we were simply processing core and Xinput motion events, but it turns out the server is literally sending us duplicates, which we probably can't work around).

--ryan.
Comment 7 Ryan C. Gordon 2015-06-08 07:00:42 UTC
In case this is either an x.org bug or I just can't figure out how this is meant to work, I hedged my bets with https://hg.libsdl.org/SDL/rev/957a6ed39ad0 ... now we don't change those XGrabInput() calls, but we also ignore duplicate motion events, which should hopefully make everyone happy for 2.0.4, and then we'll figure out something more proper after that.

--ryan.
Comment 8 Victor Luchits 2015-06-08 07:34:59 UTC
In Warsow we only called XIGrabDevice on slave devices. This approach didn't cause duplication of raw events but I'm not really sure it was the right kind of black magic one has to use when dealing with X11.

https://github.com/Warsow/qfusion/blob/master/source/unix/unix_input.c#L224