author Ryan C. Gordon
Mon, 21 Aug 2017 00:42:06 -0400
changeset 11334 749cb40916f2
parent 10807 3d7cae208a0c
child 11365 a9bd2625fa01
permissions -rw-r--r--
x11: specify event mask for buttons when grabbing pointer (thanks, Stas!).

This fixes a strange corner case (notes appended below), and should be
safe to do anyhow.

Fixes Bugzilla #3674.

"I did more tests.
It appears the bug only happens if there is
another window on the screen that has "always
on top" property. For me it is xawtv - it is
always opened in a screen corner. Closing
xawtv or removing "always on top" property
from it makes the problem to go away.
Plus, it doesn't appear like the buttons are
not delivered at all. It appears that instead
the button presses are delivered on some mouse
positions, but not delivered when you move the
mouse to other part of the window... So this is
really weird and is likely somewhere deep in the
Maybe somehow it happens that the cursor is
actually above the xawtv window, but, because
my app uses grab, it is not visible there, and
in that case the events are not delivered to
my app?
But with my patch the button events are
always delivered flawlessly, it seems.

Hmm, and that indeed seems to explain my problem:
if the mask is set properly and my app uses
grab, then, even if the mouse is above some
other window, the events would still be delivered
to the grabbing app, which is what actually wanted
because my app uses relative mouse mode, so it
doesn't know the pointer can cross some other window
(my app draws the pointer itself).
So my current theory is that my patch only enforces
the mouse grab, which otherwise can be tricked by
some other window preventing the button events
delivery (but motion events are still delivered
via xinput2, which makes it all look very obscure)."
     1 Source: libsdl2
     2 Priority: optional
     3 Section: libs
     4 Maintainer: Debian SDL packages maintainers <>
     5 Uploaders: Barry deFreese <>,
     6            Sam Hocevar <>,
     7            Manuel A. Fernandez Montecelo <>,
     8            Felix Geyer <>,
     9            Sam Lantinga <>
    10 Standards-Version: 3.9.3
    11 Build-Depends: debhelper (>= 9),
    12                dh-autoreconf,
    13                dpkg-dev (>= 1.16.1~),
    14                fcitx-libs-dev [linux-any],
    15                libasound2-dev [linux-any],
    16                libgl1-mesa-dev,
    17                libpulse-dev,
    18                libudev-dev [linux-any],
    19                libdbus-1-dev [linux-any],
    20                libibus-1.0-dev[linux-any],
    21                libusb2-dev [kfreebsd-any],
    22                libusbhid-dev [kfreebsd-any],
    23                libx11-dev,
    24                libxcursor-dev,
    25                libxext-dev,
    26                libxi-dev,
    27                libxinerama-dev,
    28                libxrandr-dev,
    29                libxss-dev,
    30                libxxf86vm-dev
    31 Homepage:
    33 Package: libsdl2
    34 Architecture: any
    35 Multi-Arch: same
    36 Pre-Depends: ${misc:Pre-Depends}
    37 Depends: ${misc:Depends},
    38          ${shlibs:Depends},
    39          libudev0 [linux-any],
    40          libdbus-1-3 [linux-any]
    41 Conflicts: libsdl-1.3-0
    42 Replaces: libsdl-1.3-0
    43 Description: Simple DirectMedia Layer
    44  SDL is a library that allows programs portable low level access to
    45  a video framebuffer, audio output, mouse, and keyboard.
    46  .
    47  This package contains the shared library, compiled with X11 graphics drivers and OSS, ALSA and PulseAudio sound drivers.
    49 Package: libsdl2-dev
    50 Section: libdevel
    51 Architecture: any
    52 Multi-Arch: same
    53 Depends: ${misc:Depends},
    54          libsdl2 (= ${binary:Version}),
    55          libc6-dev,
    56          libgl1-mesa-dev
    57 Conflicts: libsdl-1.3-dev
    58 Replaces: libsdl-1.3-dev
    59 Description: Simple DirectMedia Layer development files
    60  SDL is a library that allows programs portable low level access to a video
    61  framebuffer, audio output, mouse, and keyboard.
    62  .
    63  This package contains files needed if you wish to use the SDL library in your own programs.
    65 Package: libsdl2-dbg
    66 Priority: extra
    67 Section: debug
    68 Architecture: any
    69 Multi-Arch: same
    70 Depends: ${misc:Depends},
    71          libsdl2 (= ${binary:Version}),
    72 Description: Simple DirectMedia Layer debug files
    73  SDL is a library that allows programs portable low level access to a video
    74  framebuffer, audio output, mouse, and keyboard.
    75  .
    76  This package contains the debug symbols for the SDL library.