forked from AuroraMiddleware/gtk
Merge branch 'wip/carlosg/for-master' into 'master'
gtkpopover: Revert focus to parent on hide() Closes #3214 See merge request GNOME/gtk!2653
This commit is contained in:
commit
b6d4067717
@ -5206,14 +5206,14 @@ gtk_window_css_changed (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* _gtk_window_unset_focus_and_default:
|
||||
* @window: a #GtkWindow
|
||||
* @widget: a widget inside of @window
|
||||
*
|
||||
* Checks whether the focus and default widgets of @window are
|
||||
* @widget or a descendent of @widget, and if so, unset them.
|
||||
**/
|
||||
*/
|
||||
void
|
||||
_gtk_window_unset_focus_and_default (GtkWindow *window,
|
||||
GtkWidget *widget)
|
||||
@ -5222,28 +5222,25 @@ _gtk_window_unset_focus_and_default (GtkWindow *window,
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
GtkWidget *child;
|
||||
GtkWidget *parent;
|
||||
GtkWidget *focus;
|
||||
|
||||
g_object_ref (window);
|
||||
g_object_ref (widget);
|
||||
|
||||
focus = priv->focus_widget;
|
||||
if (focus && (focus == widget || gtk_widget_is_ancestor (focus, widget)))
|
||||
{
|
||||
parent = _gtk_widget_get_parent (widget);
|
||||
if (gtk_widget_get_focus_child (parent) == widget)
|
||||
|
||||
while (parent)
|
||||
{
|
||||
child = priv->focus_widget;
|
||||
|
||||
while (child && child != widget)
|
||||
child = _gtk_widget_get_parent (child);
|
||||
|
||||
if (child == widget)
|
||||
if (_gtk_widget_get_visible (parent))
|
||||
{
|
||||
GtkWidget *new_focus;
|
||||
gtk_window_set_focus (window, parent);
|
||||
break;
|
||||
}
|
||||
|
||||
if (GTK_IS_NATIVE (widget))
|
||||
new_focus = gtk_widget_get_parent (widget);
|
||||
else
|
||||
new_focus = NULL;
|
||||
|
||||
gtk_window_set_focus (GTK_WINDOW (window), new_focus);
|
||||
parent = gtk_widget_get_parent (parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user