forked from AuroraMiddleware/gtk
Merge branch 'wip/carlosg/reset-after-grab' into 'master'
Fixes to GTK grab notification Closes #3942 See merge request GNOME/gtk!3561
This commit is contained in:
commit
ab6e4bfc8d
@ -748,34 +748,6 @@ gtk_widget_real_contains (GtkWidget *widget,
|
||||
&GRAPHENE_POINT_INIT (x, y));
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_widget_grab_notify:
|
||||
* @widget: a `GtkWidget`
|
||||
* @was_grabbed: whether a grab is now in effect
|
||||
*
|
||||
* Emits the `GtkWidget`::grab-notify signal on @widget.
|
||||
*/
|
||||
void
|
||||
_gtk_widget_grab_notify (GtkWidget *widget,
|
||||
gboolean was_grabbed)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
GList *l;
|
||||
|
||||
if (was_grabbed)
|
||||
return;
|
||||
|
||||
for (l = g_list_last (priv->event_controllers); l; l = l->prev)
|
||||
{
|
||||
GtkEventController *controller = l->data;
|
||||
|
||||
gtk_event_controller_reset (controller);
|
||||
}
|
||||
|
||||
if (GTK_IS_NATIVE (widget))
|
||||
gtk_widget_hide (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_real_root (GtkWidget *widget)
|
||||
{
|
||||
|
@ -247,8 +247,6 @@ void _gtk_widget_set_has_grab (GtkWidget *widget,
|
||||
gboolean has_grab);
|
||||
|
||||
gboolean gtk_widget_has_grab (GtkWidget *widget);
|
||||
void _gtk_widget_grab_notify (GtkWidget *widget,
|
||||
gboolean was_grabbed);
|
||||
|
||||
void _gtk_widget_propagate_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display);
|
||||
|
@ -6703,7 +6703,7 @@ gtk_window_get_foci_on_widget (GtkWindow *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_grab_notify_foreach (GtkWidget *child,
|
||||
gtk_synthesize_grab_crossing (GtkWidget *child,
|
||||
GdkDevice *device,
|
||||
GtkWidget *new_grab_widget,
|
||||
GtkWidget *old_grab_widget,
|
||||
@ -6732,8 +6732,6 @@ gtk_grab_notify_foreach (GtkWidget *child,
|
||||
GDK_CROSSING_GTK_UNGRAB);
|
||||
}
|
||||
|
||||
_gtk_widget_grab_notify (child, was_shadowed);
|
||||
|
||||
g_object_unref (child);
|
||||
}
|
||||
|
||||
@ -6750,6 +6748,10 @@ gtk_window_propagate_grab_notify (GtkWindow *window,
|
||||
|
||||
while (target)
|
||||
{
|
||||
if (target == old_grab_widget)
|
||||
was_grabbed = TRUE;
|
||||
if (target == new_grab_widget)
|
||||
is_grabbed = TRUE;
|
||||
widgets = g_list_prepend (widgets, g_object_ref (target));
|
||||
target = gtk_widget_get_parent (target);
|
||||
}
|
||||
@ -6760,22 +6762,26 @@ gtk_window_propagate_grab_notify (GtkWindow *window,
|
||||
{
|
||||
gboolean was_shadowed, is_shadowed;
|
||||
|
||||
was_grabbed |= (l->data == old_grab_widget);
|
||||
is_grabbed |= (l->data == new_grab_widget);
|
||||
|
||||
was_shadowed = old_grab_widget && !was_grabbed;
|
||||
is_shadowed = new_grab_widget && is_grabbed;
|
||||
is_shadowed = new_grab_widget && !is_grabbed;
|
||||
|
||||
if (l->data == old_grab_widget)
|
||||
was_grabbed = FALSE;
|
||||
if (l->data == new_grab_widget)
|
||||
is_grabbed = FALSE;
|
||||
|
||||
if (was_shadowed == is_shadowed)
|
||||
break;
|
||||
|
||||
gtk_grab_notify_foreach (l->data,
|
||||
gtk_synthesize_grab_crossing (l->data,
|
||||
device,
|
||||
old_grab_widget,
|
||||
new_grab_widget,
|
||||
from_grab,
|
||||
was_shadowed,
|
||||
is_shadowed);
|
||||
|
||||
gtk_widget_reset_controllers (l->data);
|
||||
}
|
||||
|
||||
g_list_free_full (widgets, g_object_unref);
|
||||
|
Loading…
Reference in New Issue
Block a user