summaryrefslogtreecommitdiff
path: root/gtk/gtkcombobox.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-03-19 18:03:16 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-03-19 18:03:16 -0400
commit31db61588543a1ba0935ac8ecb2ecac574c0a836 (patch)
treea2e2092e086a9c7d618e2c9ae1fc7b5a659e8a7a /gtk/gtkcombobox.c
parent3ac4c76b18cc89a841ce09f0943539f16988fd21 (diff)
downloadgtk+-31db61588543a1ba0935ac8ecb2ecac574c0a836.tar.gz
Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18cc89a841ce09f0943539f16988fd21, reversing changes made to 6ec96d2e989d029a303b8b20ec72b86f974c0e87.
Diffstat (limited to 'gtk/gtkcombobox.c')
-rw-r--r--gtk/gtkcombobox.c155
1 files changed, 66 insertions, 89 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index cdf69804e9..5e5bdd1c39 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -19,12 +19,12 @@
#include "gtkcomboboxprivate.h"
+#include "gtkbindings.h"
#include "gtkbox.h"
#include "gtkcellareabox.h"
#include "gtkcelllayout.h"
#include "gtkcellrenderertext.h"
#include "gtkcellview.h"
-#include "gtkeventcontrollerkey.h"
#include "gtkeventcontrollerscroll.h"
#include "gtkframe.h"
#include "gtkbuiltiniconprivate.h"
@@ -33,11 +33,10 @@
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
-#include "gtkshortcutcontroller.h"
#include "gtktogglebutton.h"
#include "gtktreepopoverprivate.h"
#include "gtktypebuiltins.h"
-#include "gtkwidgetprivate.h"
+#include "gtkeventcontrollerkey.h"
#include "a11y/gtkcomboboxaccessible.h"
@@ -410,6 +409,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
GObjectClass *object_class;
GtkContainerClass *container_class;
GtkWidgetClass *widget_class;
+ GtkBindingSet *binding_set;
container_class = (GtkContainerClass *)klass;
container_class->forall = gtk_combo_box_forall;
@@ -560,77 +560,57 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
G_TYPE_STRING, 1, G_TYPE_STRING);
/* key bindings */
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_Down, GDK_MOD1_MASK,
- "popup",
- NULL);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_KP_Down, GDK_MOD1_MASK,
- "popup",
- NULL);
-
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_Up, GDK_MOD1_MASK,
- "popdown",
- NULL);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_KP_Up, GDK_MOD1_MASK,
- "popdown",
- NULL);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_Escape, 0,
- "popdown",
- NULL);
-
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_Up, 0,
- "move-active",
- "(i)", GTK_SCROLL_STEP_UP);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_KP_Up, 0,
- "move-active",
- "(i)", GTK_SCROLL_STEP_UP);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_Page_Up, 0,
- "move-active",
- "(i)", GTK_SCROLL_PAGE_UP);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_KP_Page_Up, 0,
- "move-active",
- "(i)", GTK_SCROLL_PAGE_UP);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_Home, 0,
- "move-active",
- "(i)", GTK_SCROLL_START);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_KP_Home, 0,
- "move-active",
- "(i)", GTK_SCROLL_START);
-
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_Down, 0,
- "move-active",
- "(i)", GTK_SCROLL_STEP_DOWN);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_KP_Down, 0,
- "move-active",
- "(i)", GTK_SCROLL_STEP_DOWN);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_Page_Down, 0,
- "move-active",
- "(i)", GTK_SCROLL_PAGE_DOWN);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_KP_Page_Down, 0,
- "move-active",
- "(i)", GTK_SCROLL_PAGE_DOWN);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_End, 0,
- "move-active",
- "(i)", GTK_SCROLL_END);
- gtk_widget_class_add_binding_signal (widget_class,
- GDK_KEY_KP_End, 0,
- "move-active",
- "(i)", GTK_SCROLL_END);
+ binding_set = gtk_binding_set_by_class (widget_class);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, GDK_MOD1_MASK,
+ "popup", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, GDK_MOD1_MASK,
+ "popup", 0);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, GDK_MOD1_MASK,
+ "popdown", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, GDK_MOD1_MASK,
+ "popdown", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0,
+ "popdown", 0);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_UP);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_UP);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Up, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_UP);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Page_Up, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_UP);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Home, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_START);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Home, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_START);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_DOWN);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_DOWN);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Down, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_DOWN);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Page_Down, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_DOWN);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_End, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_END);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_End, 0,
+ "move-active", 1,
+ GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_END);
/* properties */
g_object_class_override_property (object_class,
@@ -846,7 +826,6 @@ gtk_combo_box_init (GtkComboBox *combo_box)
{
GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
GtkEventController *controller;
- GList *controllers, *list;
priv->active = -1;
priv->active_row = NULL;
@@ -881,19 +860,6 @@ gtk_combo_box_init (GtkComboBox *combo_box)
G_CALLBACK (gtk_combo_box_scroll_controller_scroll),
combo_box);
gtk_widget_add_controller (GTK_WIDGET (combo_box), controller);
-
- controllers = gtk_widget_list_controllers (priv->popup_widget, GTK_PHASE_BUBBLE);
- for (list = controllers; list; list = list->next)
- {
- if (GTK_IS_SHORTCUT_CONTROLLER (list->data))
- {
- g_object_ref (list->data);
- gtk_widget_remove_controller (priv->popup_widget, list->data);
- gtk_widget_add_controller (priv->popup_widget, list->data);
- break;
- }
- }
- g_list_free (controllers);
}
static void
@@ -1823,7 +1789,18 @@ gtk_combo_box_menu_key (GtkEventControllerKey *key,
GdkModifierType modifiers,
GtkComboBox *combo_box)
{
- gtk_event_controller_key_forward (key, GTK_WIDGET (combo_box));
+ GtkWidget *widget;
+ GdkEvent *event;
+
+ widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (key));
+ event = gtk_get_current_event ();
+
+ if (!gtk_bindings_activate_event (G_OBJECT (widget), event))
+ {
+ gtk_event_controller_key_forward (key, GTK_WIDGET (combo_box));
+ }
+
+ gdk_event_unref (event);
return TRUE;
}