Window: Avoid some redundant assignments

This commit is contained in:
Timm Bäder 2020-01-02 13:52:14 +01:00
parent 04899e3707
commit 726909d735

View File

@ -1570,21 +1570,22 @@ device_removed_cb (GdkSeat *seat,
{ {
GtkWindow *window = user_data; GtkWindow *window = user_data;
GtkWindowPrivate *priv = gtk_window_get_instance_private (window); GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GList *l = priv->foci, *cur; GList *l = priv->foci;
while (l) while (l)
{ {
GList *next;
GtkPointerFocus *focus = l->data; GtkPointerFocus *focus = l->data;
cur = l; next = l->next;
focus = cur->data;
l = cur->next;
if (focus->device == device) if (focus->device == device)
{ {
priv->foci = g_list_delete_link (priv->foci, cur); priv->foci = g_list_delete_link (priv->foci, l);
gtk_pointer_focus_unref (focus); gtk_pointer_focus_unref (focus);
} }
l = next;
} }
} }
@ -9294,15 +9295,15 @@ gtk_window_update_pointer_focus_on_state_change (GtkWindow *window,
GtkWidget *widget) GtkWidget *widget)
{ {
GtkWindowPrivate *priv = gtk_window_get_instance_private (window); GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GList *l = priv->foci, *cur; GList *l = priv->foci;
while (l) while (l)
{ {
GList *next;
GtkPointerFocus *focus = l->data; GtkPointerFocus *focus = l->data;
cur = l; next = l->next;
focus = cur->data;
l = cur->next;
gtk_pointer_focus_ref (focus); gtk_pointer_focus_ref (focus);
@ -9314,9 +9315,9 @@ gtk_window_update_pointer_focus_on_state_change (GtkWindow *window,
if (GTK_WIDGET (focus->toplevel) == widget) if (GTK_WIDGET (focus->toplevel) == widget)
{ {
/* Unmapping the toplevel, remove pointer focus */ /* Unmapping the toplevel, remove pointer focus */
priv->foci = g_list_remove_link (priv->foci, cur); priv->foci = g_list_remove_link (priv->foci, l);
gtk_pointer_focus_unref (focus); gtk_pointer_focus_unref (focus);
g_list_free (cur); g_list_free (l);
} }
else if (focus->target == widget || else if (focus->target == widget ||
gtk_widget_is_ancestor (focus->target, widget)) gtk_widget_is_ancestor (focus->target, widget))
@ -9325,6 +9326,8 @@ gtk_window_update_pointer_focus_on_state_change (GtkWindow *window,
} }
gtk_pointer_focus_unref (focus); gtk_pointer_focus_unref (focus);
l = next;
} }
} }
@ -9334,15 +9337,13 @@ gtk_window_maybe_revoke_implicit_grab (GtkWindow *window,
GtkWidget *grab_widget) GtkWidget *grab_widget)
{ {
GtkWindowPrivate *priv = gtk_window_get_instance_private (window); GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GList *l = priv->foci, *cur; GList *l = priv->foci;
while (l) while (l)
{ {
GtkPointerFocus *focus = l->data; GtkPointerFocus *focus = l->data;
cur = l; l = l->next;
focus = cur->data;
l = cur->next;
if (focus->toplevel != window) if (focus->toplevel != window)
continue; continue;