From 7f33706c1282dde431c9b01c020f4315c730ad1c Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 2 Jun 2014 17:53:53 +0200 Subject: [PATCH] window: Refactor _gtk_window_check_handle_wm_event() Separate the event widget check from event handling --- gtk/gtkwindow.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 6bfe5b465d..bd0d0c26ce 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -7877,26 +7877,37 @@ get_active_region_type (GtkWindow *window, GdkEventAny *event, gint x, gint y) return GTK_WINDOW_REGION_CONTENT; } -gboolean -_gtk_window_check_handle_wm_event (GdkEvent *event) +static gboolean +gtk_window_handle_wm_event (GtkWindow *window, + GdkEvent *event) { GtkWindowPrivate *priv; - GtkWidget *widget; - widget = gtk_get_event_widget (event); - - if (GTK_IS_WINDOW (widget) && - (event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE || - event->type == GDK_TOUCH_BEGIN || event->type == GDK_TOUCH_UPDATE || - event->type == GDK_MOTION_NOTIFY || event->type == GDK_TOUCH_END)) + if (event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE || + event->type == GDK_TOUCH_BEGIN || event->type == GDK_TOUCH_UPDATE || + event->type == GDK_MOTION_NOTIFY || event->type == GDK_TOUCH_END) { - priv = GTK_WINDOW (widget)->priv; + priv = window->priv; + if (priv->multipress_gesture) return gtk_event_controller_handle_event (GTK_EVENT_CONTROLLER (priv->multipress_gesture), (const GdkEvent*) event); } - return FALSE; + return GDK_EVENT_PROPAGATE; +} + +gboolean +_gtk_window_check_handle_wm_event (GdkEvent *event) +{ + GtkWidget *widget; + + widget = gtk_get_event_widget (event); + + if (!GTK_IS_WINDOW (widget)) + return GDK_EVENT_PROPAGATE; + + return gtk_window_handle_wm_event (GTK_WINDOW (widget), event); } static void