[gtk/wip/matthiasc/context-menu] widget: Try child focus first
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/context-menu] widget: Try child focus first
- Date: Tue, 11 Jun 2019 03:08:59 +0000 (UTC)
commit db695e3b857eafd32177f34019a8a155e05ec9a9
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jun 11 03:06:33 2019 +0000
widget: Try child focus first
When propagating focus change, try focusing
a child first, before grabbing focus to ourselves.
This fixes problems with popovers that are attached
to focusable widgets like entries, where moving the
focus would not work, since the entry was grabbing
the focus.
gtk/gtkwidget.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index e3b4214e56..4a79be8aa6 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5633,6 +5633,12 @@ static gboolean
gtk_widget_real_focus (GtkWidget *widget,
GtkDirectionType direction)
{
+ /* Try focusing any of the child widgets,
+ * depending on the given direction
+ */
+ if (gtk_widget_focus_move (widget, direction))
+ return TRUE;
+
if (gtk_widget_get_can_focus (widget))
{
if (!gtk_widget_is_focus (widget))
@@ -5641,17 +5647,6 @@ gtk_widget_real_focus (GtkWidget *widget,
return TRUE;
}
}
- else if (_gtk_widget_get_first_child (widget) == NULL)
- {
- /* No children, no possibility to focus anything */
- return FALSE;
- }
- else
- {
- /* Try focusing any of the child widgets, depending on the given direction */
- if (gtk_widget_focus_move (widget, direction))
- return TRUE;
- }
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]