author Ryan C. Gordon
Mon, 21 Aug 2017 00:42:06 -0400
changeset 11334 749cb40916f2
parent 6886 55fc95e5817b
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 .TH sdl2-config 1 "2012-02-20" "SDL 2.0"
     2 .SH NAME
     3 sdl2-config \- script to get information about the installed version of SDL
     5 .B sdl2-config
     6 [ --prefix=
     7 .IR DIR ]
     8 [ --exec-prefix=
     9 .IR DIR ]
    10 [ --version ] [ --libs | --library-libs | --plugin-libs ] [ --cflags ]
    12 .B sdl2-config
    13 is a tool that is used to configure and determine the compiler and linker
    14 flags that should be used to compile and link programs, libraries, and
    15 plugins that use SDL.  It is also used internally by the m4 macros that are
    16 included with SDL.
    17 .SH OPTIONS
    18 .TP
    19 .B --cflags
    20 Print the compiler flags that are necessary to compile a program or library
    21 that uses SDL.
    22 .TP
    23 .BI --exec-prefix= DIR
    24 If specified, use
    25 .I DIR
    26 instead of the installation exec prefix that SDL was build with when
    27 computing the output for the --cflags, --libs, --library-libs, and
    28 --plugin-libs options.  This option must be specified before any of the
    29 --cflags, --libs, --library-libs, and --plugin-libs options.
    30 .TP
    31 .B --libs
    32 Print the linker flags that are necessary to link a program that uses SDL.
    33 .TP
    34 .B --static-libs
    35 Print the linker flags that are necessary to statically link a program that uses SDL.
    36 .TP
    37 .B --library-libs
    38 Print the linker flags that are necessary to link a library that uses SDL.
    39 (This excludes any static objects required for linking, since these must be
    40 linked only by executable programs.)
    41 .TP
    42 .B --plugin-libs
    43 Print the linker flags that are necessary to link an SDL-using object that
    44 is to be accessed via
    45 .IR dlopen (3).
    46 This may include static objects with PIC symbol information.  This option
    47 should
    48 .B not
    49 be used for ordinary shared libraries or standalone applications.
    50 .TP
    51 .BI --prefix= DIR
    52 If specified, use PREFIX instead of the installation prefix that SDL was
    53 built with when computing the output for the --cflags, --libs,
    54 --library-libs, and --plugin-libs options.  This option is also used for
    55 the exec prefix if --exec-prefix was not specified.  This option must be
    56 specified before any of the --cflags, --libs, --library-libs, and
    57 --plugin-libs options.
    58 .TP
    59 .B --version
    60 Prints the currently installed version of SDL on standard output.
    62 .TP
    63 gcc -o main.o $(sdl2-config --cflags) main.c
    64 is how you might use
    65 .B sdl2-config
    66 to compile a C source file for an executable program.
    67 .TP
    68 gcc -o my_app $(sdl2-config --libs) main.o util.o
    69 is how you might use
    70 .B sdl2-config
    71 to link compiled objects into an executable program.
    72 .TP
    73 gcc -o $(sdl --library-libs) read.o write.o munge.o
    74 is how you might use
    75 .B sdl2-config
    76 to link compiled objects into a shared library.
    77 .TP
    78 gcc -o $(sdl --plugin-libs) stream.o blit.o deinterlace.o
    79 is how you might use
    80 .B sdl2-config
    81 to link compiled objects into a plugin for use by another program.
    82 .SH AUTHOR
    83 The Simple DirectMedia Layer (SDL) library was written by Sam Lantinga.
    84 .PP
    85 This manual page was written by Branden Robinson, originally for Progeny
    86 Linux Systems, Inc., and the Debian Project.