[gtk+] gtkwidget: refactor code into separate function
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtkwidget: refactor code into separate function
- Date: Mon, 14 Sep 2015 15:38:39 +0000 (UTC)
commit 0dae974b962be0d0928a919cd6fa5407f1ba38dd
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Sep 10 14:16:20 2015 +0200
gtkwidget: refactor code into separate function
This "cancel sequence across widget hierarchy" code will be useful
in other places, so take it out to a separate function.
https://bugzilla.gnome.org/show_bug.cgi?id=754098
gtk/gtkwidget.c | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 7a05785..0eda0e2 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7335,6 +7335,28 @@ _gtk_widget_run_controllers (GtkWidget *widget,
return handled;
}
+static void
+cancel_event_sequence_on_hierarchy (GtkWidget *widget,
+ GtkWidget *event_widget,
+ GdkEventSequence *sequence)
+{
+ gboolean cancel = TRUE;
+
+ while (event_widget)
+ {
+ if (event_widget == widget)
+ cancel = FALSE;
+ else if (cancel)
+ _gtk_widget_cancel_sequence (event_widget, sequence);
+ else
+ _gtk_widget_set_sequence_state_internal (event_widget, sequence,
+ GTK_EVENT_SEQUENCE_DENIED,
+ NULL);
+
+ event_widget = _gtk_widget_get_parent (event_widget);
+ }
+}
+
gboolean
_gtk_widget_captured_event (GtkWidget *widget,
GdkEvent *event)
@@ -17077,7 +17099,6 @@ event_controller_sequence_state_changed (GtkGesture *gesture,
{
gboolean handled = FALSE;
GtkWidget *event_widget;
- gboolean cancel = TRUE;
const GdkEvent *event;
handled = _gtk_widget_set_sequence_state_internal (widget, sequence,
@@ -17092,20 +17113,7 @@ event_controller_sequence_state_changed (GtkGesture *gesture,
return;
event_widget = gtk_get_event_widget ((GdkEvent *) event);
-
- while (event_widget)
- {
- if (event_widget == widget)
- cancel = FALSE;
- else if (cancel)
- _gtk_widget_cancel_sequence (event_widget, sequence);
- else
- _gtk_widget_set_sequence_state_internal (event_widget, sequence,
- GTK_EVENT_SEQUENCE_DENIED,
- NULL);
-
- event_widget = _gtk_widget_get_parent (event_widget);
- }
+ cancel_event_sequence_on_hierarchy (widget, event_widget, sequence);
}
static EventControllerData *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]