forked from AuroraMiddleware/gtk
widget: Parent widgets may also consume motions
This is important when the target widget of an event is not the one that would otherwise receive the gesture. For example, the GtkSwitch implementation currently attaches a pan gesture to the switch itself, but the target widget below the pointer might be the switch slider or label. See #1465
This commit is contained in:
parent
eeeefb40c7
commit
b7963a06ab
@ -12925,23 +12925,28 @@ _gtk_widget_consumes_motion (GtkWidget *widget,
|
||||
GdkEventSequence *sequence)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
GList *l;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
|
||||
|
||||
for (l = priv->event_controllers; l; l = l->next)
|
||||
while (widget != NULL && !GTK_IS_WINDOW (widget))
|
||||
{
|
||||
GtkEventController *controller = l->data;
|
||||
GList *l;
|
||||
|
||||
if (controller == NULL ||
|
||||
!GTK_IS_GESTURE (controller))
|
||||
continue;
|
||||
for (l = priv->event_controllers; l; l = l->next)
|
||||
{
|
||||
GtkEventController *controller = l->data;
|
||||
|
||||
if ((!GTK_IS_GESTURE_SINGLE (controller) ||
|
||||
GTK_IS_GESTURE_DRAG (controller) ||
|
||||
GTK_IS_GESTURE_SWIPE (controller)) &&
|
||||
gtk_gesture_handles_sequence (GTK_GESTURE (controller), sequence))
|
||||
return TRUE;
|
||||
if (controller == NULL ||
|
||||
!GTK_IS_GESTURE (controller))
|
||||
continue;
|
||||
|
||||
if ((!GTK_IS_GESTURE_SINGLE (controller) ||
|
||||
GTK_IS_GESTURE_DRAG (controller) ||
|
||||
GTK_IS_GESTURE_SWIPE (controller)) &&
|
||||
gtk_gesture_handles_sequence (GTK_GESTURE (controller), sequence))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
widget = priv->parent;
|
||||
priv = gtk_widget_get_instance_private (widget);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user