mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 23:10:22 +00:00
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
This commit is contained in:
parent
1c4a7bd552
commit
0dae974b96
@ -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 *
|
||||
|
Loading…
Reference in New Issue
Block a user