[gtk/combobox-keynav: 2/2] combobox: Let focus enter the popup
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/combobox-keynav: 2/2] combobox: Let focus enter the popup
- Date: Tue, 3 Aug 2021 03:51:07 +0000 (UTC)
commit ea3dad1fb0e0621a8c2b77fe322f18f7768fd29a
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Aug 2 23:49:55 2021 -0400
combobox: Let focus enter the popup
This is necessary for restoring keyboard navigation
for comboboxes.
gtk/gtkcombobox.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 70d0f637a3..984705f5bd 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -215,6 +215,8 @@ static void gtk_combo_box_get_property (GObject *object,
GValue *value,
GParamSpec *spec);
+static gboolean gtk_combo_box_focus (GtkWidget *widget,
+ GtkDirectionType direction);
static gboolean gtk_combo_box_grab_focus (GtkWidget *widget);
static void gtk_combo_box_button_toggled (GtkWidget *widget,
gpointer data);
@@ -407,7 +409,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
widget_class = (GtkWidgetClass *)klass;
widget_class->mnemonic_activate = gtk_combo_box_mnemonic_activate;
widget_class->grab_focus = gtk_combo_box_grab_focus;
- widget_class->focus = gtk_widget_focus_child;
+ widget_class->focus = gtk_combo_box_focus;
widget_class->measure = gtk_combo_box_measure;
widget_class->size_allocate = gtk_combo_box_size_allocate;
widget_class->unmap = gtk_combo_box_unmap;
@@ -2294,6 +2296,19 @@ gtk_combo_box_grab_focus (GtkWidget *widget)
return gtk_widget_grab_focus (priv->button);
}
+static gboolean
+gtk_combo_box_focus (GtkWidget *widget,
+ GtkDirectionType direction)
+{
+ GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
+ GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
+
+ if (priv->popup_widget && gtk_widget_get_visible (priv->popup_widget))
+ return gtk_widget_child_focus (priv->popup_widget, direction);
+ else
+ return gtk_widget_child_focus (priv->button, direction);
+}
+
static void
gtk_combo_box_unmap (GtkWidget *widget)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]