[gtk/wip/matthiasc/can-focus] Move focus to the parent if a popover is dismissed
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/can-focus] Move focus to the parent if a popover is dismissed
- Date: Thu, 9 Apr 2020 16:04:58 +0000 (UTC)
commit afcdaaf4c977eeed8a282b74a1077aaca678edcc
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Apr 9 12:03:23 2020 -0400
Move focus to the parent if a popover is dismissed
This is better than just dropping focus altogether,
and is expected behavior in most cases.
gtk/gtkwindow.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 7e211aaa0f1..707bd84b98d 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5740,7 +5740,16 @@ _gtk_window_unset_focus_and_default (GtkWindow *window,
child = _gtk_widget_get_parent (child);
if (child == widget)
- gtk_window_set_focus (GTK_WINDOW (window), NULL);
+ {
+ GtkWidget *new_focus;
+
+ 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);
+ }
}
child = priv->default_widget;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]