mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-15 05:00:09 +00:00
Move maintaining the focus chain
Put this code in the same place where we generate the crossing events.
This commit is contained in:
parent
7d354b5084
commit
888b92674f
@ -1458,6 +1458,21 @@ synth_crossing (GtkWidget *widget,
|
||||
|
||||
if (gdk_event_get_event_type (source) == GDK_FOCUS_CHANGE)
|
||||
{
|
||||
/* maintain focus chain */
|
||||
if (enter || notify_type == GDK_NOTIFY_INFERIOR)
|
||||
{
|
||||
GtkWidget *parent = gtk_widget_get_parent (widget);
|
||||
if (parent)
|
||||
gtk_widget_set_focus_child (parent, widget);
|
||||
}
|
||||
else if (!enter && notify_type != GDK_NOTIFY_INFERIOR)
|
||||
{
|
||||
GtkWidget *parent = gtk_widget_get_parent (widget);
|
||||
if (parent)
|
||||
gtk_widget_set_focus_child (parent, NULL);
|
||||
}
|
||||
|
||||
/* maintain widget state */
|
||||
if (notify_type == GDK_NOTIFY_ANCESTOR ||
|
||||
notify_type == GDK_NOTIFY_INFERIOR ||
|
||||
notify_type == GDK_NOTIFY_NONLINEAR)
|
||||
|
@ -7168,7 +7168,6 @@ gtk_window_set_focus (GtkWindow *window,
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
GtkWidget *old_focus = NULL;
|
||||
GtkWidget *f;
|
||||
GdkSeat *seat;
|
||||
GdkDevice *device;
|
||||
GdkEvent *event;
|
||||
@ -7200,13 +7199,6 @@ gtk_window_set_focus (GtkWindow *window,
|
||||
|
||||
g_clear_object (&old_focus);
|
||||
|
||||
for (f = focus; f; f = gtk_widget_get_parent (f))
|
||||
{
|
||||
GtkWidget *parent = gtk_widget_get_parent (f);
|
||||
if (parent)
|
||||
gtk_widget_set_focus_child (parent, f);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (window), "focus-widget");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user