[gtk+/client-side-windows: 211/284] Move implicit grab tracking totally to common code
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/client-side-windows: 211/284] Move implicit grab tracking totally to common code
- Date: Thu, 2 Apr 2009 14:17:39 -0400 (EDT)
commit 5be3f38535d9ad02ff61e111de3c8e2478d23b57
Author: Alexander Larsson <alexl redhat com>
Date: Mon Feb 2 14:57:08 2009 +0100
Move implicit grab tracking totally to common code
---
gdk/gdkdisplay.c | 1 -
gdk/gdkinternals.h | 1 -
gdk/gdkwindow.c | 41 +++++++++++++++++++------------------
gdk/x11/gdkevents-x11.c | 11 ----------
gdk/x11/gdkmain-x11.c | 49 ----------------------------------------------
gdk/x11/gdkprivate-x11.h | 2 -
6 files changed, 21 insertions(+), 84 deletions(-)
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 8b518ad..74f08fc 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -808,7 +808,6 @@ _gdk_display_add_pointer_grab (GdkDisplay *display,
info->event_mask = event_mask;
info->time = time;
info->implicit = implicit;
- info->converted_implicit = FALSE;
/* Find the first grab that has a larger start time (if any) and insert
* before that. I.E we insert after already existing grabs with same
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 3382236..73c15d2 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -180,7 +180,6 @@ typedef struct
gboolean owner_events;
guint event_mask;
gboolean implicit;
- gboolean converted_implicit;
guint32 time;
gboolean activated;
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 604feba..e3500bc 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -8305,6 +8305,12 @@ proxy_pointer_event (GdkDisplay *display,
return TRUE;
}
+#define GDK_ANY_BUTTON_MASK (GDK_BUTTON1_MASK | \
+ GDK_BUTTON2_MASK | \
+ GDK_BUTTON3_MASK | \
+ GDK_BUTTON4_MASK | \
+ GDK_BUTTON5_MASK)
+
static gboolean
proxy_button_event (GdkEvent *source_event,
gulong serial)
@@ -8319,7 +8325,6 @@ proxy_button_event (GdkEvent *source_event,
gdouble toplevel_x, toplevel_y;
GdkDisplay *display;
GdkWindowObject *w;
- GdkPointerGrabInfo *grab;
type = source_event->any.type;
toplevel_window = source_event->any.window;
@@ -8328,18 +8333,15 @@ proxy_button_event (GdkEvent *source_event,
time_ = gdk_event_get_time (source_event);
display = gdk_drawable_get_display (source_event->any.window);
- grab = _gdk_display_get_active_pointer_grab (display);
-
- if ((type == GDK_BUTTON_PRESS || type == GDK_SCROLL) &&
- grab && grab->window == toplevel_window &&
- grab->implicit && !grab->converted_implicit)
+ if (type == GDK_BUTTON_PRESS &&
+ _gdk_display_has_pointer_grab (display, serial) == NULL)
{
pointer_window =
_gdk_window_find_descendant_at (toplevel_window,
toplevel_x, toplevel_y,
NULL, NULL);
- /* Find the actual event window, its what gets the grab */
+ /* Find the event window, that gets the grab */
w = (GdkWindowObject *)pointer_window;
while (w != NULL && w->parent->window_type != GDK_WINDOW_ROOT)
{
@@ -8348,17 +8350,16 @@ proxy_button_event (GdkEvent *source_event,
w = w->parent;
}
pointer_window = (GdkWindow *)w;
-
- if (pointer_window != NULL &&
- pointer_window != toplevel_window)
- {
- g_object_ref (pointer_window);
- g_object_unref (grab->window);
- grab->window = pointer_window;
- grab->event_mask = gdk_window_get_events (pointer_window);
- }
-
- grab->converted_implicit = TRUE;
+
+ _gdk_display_add_pointer_grab (display,
+ pointer_window,
+ toplevel_window,
+ FALSE,
+ gdk_window_get_events (pointer_window),
+ serial,
+ time_,
+ TRUE);
+ _gdk_display_pointer_grab_update (display, serial);
}
pointer_window = get_pointer_window (display, toplevel_window,
@@ -8577,9 +8578,9 @@ _gdk_windowing_got_event (GdkDisplay *display,
button_release_grab =
_gdk_display_has_pointer_grab (display, serial);
if (button_release_grab &&
- button_release_grab->grab_one_pointer_release_event)
+ button_release_grab->implicit &&
+ (event->button.state & GDK_ANY_BUTTON_MASK & ~(GDK_BUTTON1_MASK << (event->button.button - 1))) == 0)
{
- button_release_grab->grab_one_pointer_release_event = FALSE;
button_release_grab->serial_end = serial;
button_release_grab->implicit_ungrab = TRUE;
_gdk_display_pointer_grab_update (display, serial);
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index 01ed9b6..d6268e9 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -1192,15 +1192,6 @@ gdk_event_translate (GdkDisplay *display,
set_user_time (window, event);
- /* 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:
@@ -1241,8 +1232,6 @@ gdk_event_translate (GdkDisplay *display,
if (!set_screen_from_root (display, event, xevent->xbutton.root))
return_val = FALSE;
- _gdk_xgrab_check_button_event (window, xevent);
-
break;
case MotionNotify:
diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c
index b06b15e..b5d8c74 100644
--- a/gdk/x11/gdkmain-x11.c
+++ b/gdk/x11/gdkmain-x11.c
@@ -436,55 +436,6 @@ _gdk_xgrab_check_destroy (GdkWindow *window)
_gdk_display_unset_has_keyboard_grab (display, TRUE);
}
-#define GDK_ANY_BUTTON_MASK (GDK_BUTTON1_MASK | \
- GDK_BUTTON2_MASK | \
- GDK_BUTTON3_MASK | \
- GDK_BUTTON4_MASK | \
- GDK_BUTTON5_MASK)
-
-/**
- * _gdk_xgrab_check_button_event:
- * @window: a #GdkWindow
- * @event: an XEvent of type ButtonPress or ButtonRelease
- *
- * Checks to see if a button event starts or ends an implicit grab.
- **/
-void
-_gdk_xgrab_check_button_event (GdkWindow *window,
- XEvent *xevent)
-{
- GdkDisplay *display = gdk_drawable_get_display (window);
- gulong serial = xevent->xany.serial;
- GdkPointerGrabInfo *grab;
-
- /* track implicit grabs for button presses */
- switch (xevent->type)
- {
- case ButtonPress:
- if (!_gdk_display_has_pointer_grab (display, serial))
- {
- _gdk_display_add_pointer_grab (display,
- window,
- window,
- FALSE,
- gdk_window_get_events (window),
- serial,
- xevent->xbutton.time,
- TRUE);
- }
- break;
- case ButtonRelease:
- serial = serial;
- grab = _gdk_display_has_pointer_grab (display, serial);
- if (grab && grab->implicit &&
- (xevent->xbutton.state & GDK_ANY_BUTTON_MASK & ~(GDK_BUTTON1_MASK << (xevent->xbutton.button - 1))) == 0)
- grab->grab_one_pointer_release_event = TRUE;
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
void
_gdk_windowing_display_set_sm_client_id (GdkDisplay *display,
const gchar *sm_client_id)
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index e1c4666..871fa74 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -164,8 +164,6 @@ void _gdk_x11_initialize_locale (void);
void _gdk_xgrab_check_unmap (GdkWindow *window,
gulong serial);
void _gdk_xgrab_check_destroy (GdkWindow *window);
-void _gdk_xgrab_check_button_event (GdkWindow *window,
- XEvent *xevent);
gboolean _gdk_x11_display_is_root_window (GdkDisplay *display,
Window xroot_window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]