[gtk+/client-side-windows: 107/284] Don't expose a temporary grab during a scrollwheel button press/release cycle.
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/client-side-windows: 107/284] Don't expose a temporary grab during a scrollwheel button press/release cycle.
- Date: Thu, 2 Apr 2009 14:08:43 -0400 (EDT)
commit 8a0ef57ba31b16a07ae2bfea99985a3ae9dc1800
Author: Alexander Larsson <alexl redhat com>
Date: Wed Jan 21 14:42:46 2009 +0100
Don't expose a temporary grab during a scrollwheel button press/release cycle.
If we do this there is a short window where we think there is a grab, and
if we generate a client side pointer motion event in this time (e.g. from
a window move) we could be delivering that according to the grab. But in
the Xserver that grab is infinitely short as it sends Press and then
Release immediately.
To see a problem from this, try using the scrollwheel to quickly scroll
in the testgtk list of buttons.
---
gdk/x11/gdkevents-x11.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index 4f02dc2..5167212 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -1213,7 +1213,15 @@ gdk_event_translate (GdkDisplay *display,
set_user_time (window, event);
- _gdk_xgrab_check_button_event (window, xevent);
+ /* We treat button presses as scroll wheel events, so don't expose
+ * this grab to gtk, as it will be immediately released. If we do
+ * expose it there is a short time before we receive the Release
+ * where a client-side generated pointer motion event could be handled
+ * as if the grab was effect.
+ */
+ if (!(xevent->xbutton.button == 4 || xevent->xbutton.button == 5 ||
+ xevent->xbutton.button == 6 || xevent->xbutton.button == 7))
+ _gdk_xgrab_check_button_event (window, xevent);
break;
case ButtonRelease:
@@ -1236,7 +1244,7 @@ gdk_event_translate (GdkDisplay *display,
xevent->xbutton.button == 6 || xevent->xbutton.button ==7)
{
return_val = FALSE;
- goto release_out;
+ break;
}
event->button.type = GDK_BUTTON_RELEASE;
@@ -1252,13 +1260,10 @@ gdk_event_translate (GdkDisplay *display,
event->button.device = display->core_pointer;
if (!set_screen_from_root (display, event, xevent->xbutton.root))
- {
- return_val = FALSE;
- goto release_out;
- }
+ return_val = FALSE;
- release_out:
_gdk_xgrab_check_button_event (window, xevent);
+
break;
case MotionNotify:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]