Re: Gdk motion event changed behavior in 2.18
- From: Alexander Larsson <alexl redhat com>
- To: Nicola Fontana <ntd entidi it>
- Cc: gtk-devel-list gnome org
- Subject: Re: Gdk motion event changed behavior in 2.18
- Date: Mon, 19 Oct 2009 21:24:45 +0200
On Thu, 2009-10-15 at 13:29 +0200, Nicola Fontana wrote:
> Hi all,
> after upgrading GTK+ from 2.16.4 to 2.18.2, an application I was
> working on stopped to react to GDK_BUTTON2_MOTION_MASK events. I
> resolved by adding GDK_BUTTON_PRESS_MASK but this issue will likely
> affect other applications too. A simple test case attached.
This is actually kinda complex, related to implicit grabs. When you
press the mouse button the xserver looks, starting in the innermost
window with the pointer and looking for a window with the button press
mask set. This window gets an automatic "implicit" pointer grab for the
duration of the mouse-down, causing events to only get sent to that
window. However, if no window with the button press mask is found then
there is no implicit grabs and events continue being reported as before.
Your example did not work for me without the added GDK_BUTTON_PRESS_MASK
when using metacity as the window manager, I think because metacity is a
reparenting wm and has button press event mask on the frame window, but
it did work with twm (and probably other non-reparenting wms like
compiz) which doesn't do this.
The reason it works with twm is that no other window has a button press
mask so there is no implicit grab, meaning events continue to go to the
window with the pointer. As soon as there is a parent window in the
hierarchy with the button press mask set it will stop working. This
could happen before if e.g. the widget was put in some other widget that
had the mask set.
This is exactly what happens in 2.18. With the client side windows work
we always request button events on the toplevel window, and thus that
gets the implicit grab and the child window gets no motion events.
I'm not sure how we can fix this in 2.18, or even if we should. I mean,
by necessity we do request button press events from X on the toplevel
(so we can emulate button presses on virtual child windows), so we
*will* get an implicit grab and can't pretend its not there (as we get
different X events now).
However, for you I recommend putting in the GDK_BUTTON_PRESS_MASK even
for 2.16, to make sure it works with all WMs.
] [Thread Prev