[gtk/wip/ebassi/shortcut: 10/85] window: Port bindings to use shortcuts
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/ebassi/shortcut: 10/85] window: Port bindings to use shortcuts
- Date: Fri, 31 Jan 2020 16:00:40 +0000 (UTC)
commit 6a9b8ac7d31c9f2656ddb4246a46ce3d1a6c8845
Author: Benjamin Otte <otte redhat com>
Date: Sat Aug 4 12:30:53 2018 +0200
window: Port bindings to use shortcuts
gtk/gtkwindow.c | 102 +++++++++++++++++++++++++++++---------------------------
1 file changed, 53 insertions(+), 49 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index a396f9e991..825a2ce876 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -28,7 +28,6 @@
#include "gtkaccelgroupprivate.h"
#include "gtkapplicationprivate.h"
-#include "gtkbindings.h"
#include "gtkbox.h"
#include "gtkbuildable.h"
#include "gtkbuilderprivate.h"
@@ -576,37 +575,45 @@ G_DEFINE_TYPE_WITH_CODE (GtkWindow, gtk_window, GTK_TYPE_BIN,
gtk_window_root_interface_init))
static void
-add_tab_bindings (GtkBindingSet *binding_set,
+add_tab_bindings (GtkWidgetClass *widget_class,
GdkModifierType modifiers,
GtkDirectionType direction)
{
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_Tab, modifiers,
- "move-focus", 1,
- GTK_TYPE_DIRECTION_TYPE, direction);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Tab, modifiers,
- "move-focus", 1,
- GTK_TYPE_DIRECTION_TYPE, direction);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_Tab, modifiers,
+ "move-focus",
+ "(i)",
+ direction);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_KP_Tab, modifiers,
+ "move-focus",
+ "(i)",
+ direction);
}
static void
-add_arrow_bindings (GtkBindingSet *binding_set,
+add_arrow_bindings (GtkWidgetClass *widget_class,
guint keysym,
GtkDirectionType direction)
{
guint keypad_keysym = keysym - GDK_KEY_Left + GDK_KEY_KP_Left;
- gtk_binding_entry_add_signal (binding_set, keysym, 0,
- "move-focus", 1,
- GTK_TYPE_DIRECTION_TYPE, direction);
- gtk_binding_entry_add_signal (binding_set, keysym, GDK_CONTROL_MASK,
- "move-focus", 1,
- GTK_TYPE_DIRECTION_TYPE, direction);
- gtk_binding_entry_add_signal (binding_set, keypad_keysym, 0,
- "move-focus", 1,
- GTK_TYPE_DIRECTION_TYPE, direction);
- gtk_binding_entry_add_signal (binding_set, keypad_keysym, GDK_CONTROL_MASK,
- "move-focus", 1,
- GTK_TYPE_DIRECTION_TYPE, direction);
+ gtk_widget_class_add_binding_signal (widget_class, keysym, 0,
+ "move-focus",
+ "(i)",
+ direction);
+ gtk_widget_class_add_binding_signal (widget_class, keysym, GDK_CONTROL_MASK,
+ "move-focus",
+ "(i)",
+ direction);
+ gtk_widget_class_add_binding_signal (widget_class, keypad_keysym, 0,
+ "move-focus",
+ "(i)",
+ direction);
+ gtk_widget_class_add_binding_signal (widget_class, keypad_keysym, GDK_CONTROL_MASK,
+ "move-focus",
+ "(i)",
+ direction);
}
static guint32
@@ -769,7 +776,6 @@ gtk_window_class_init (GtkWindowClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
- GtkBindingSet *binding_set;
widget_class = (GtkWidgetClass*) klass;
container_class = (GtkContainerClass*) klass;
@@ -1175,34 +1181,32 @@ gtk_window_class_init (GtkWindowClass *klass)
binding_set = gtk_binding_set_by_class (klass);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_space, 0,
- "activate-focus", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Space, 0,
- "activate-focus", 0);
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_space, 0,
+ "activate-focus", NULL);
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_KP_Space, 0,
+ "activate-focus", NULL);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_Return, 0,
- "activate-default", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_ISO_Enter, 0,
- "activate-default", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Enter, 0,
- "activate-default", 0);
-
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_I, GDK_CONTROL_MASK|GDK_SHIFT_MASK,
- "enable-debugging", 1,
- G_TYPE_BOOLEAN, FALSE);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_D, GDK_CONTROL_MASK|GDK_SHIFT_MASK,
- "enable-debugging", 1,
- G_TYPE_BOOLEAN, TRUE);
-
- add_arrow_bindings (binding_set, GDK_KEY_Up, GTK_DIR_UP);
- add_arrow_bindings (binding_set, GDK_KEY_Down, GTK_DIR_DOWN);
- add_arrow_bindings (binding_set, GDK_KEY_Left, GTK_DIR_LEFT);
- add_arrow_bindings (binding_set, GDK_KEY_Right, GTK_DIR_RIGHT);
-
- add_tab_bindings (binding_set, 0, GTK_DIR_TAB_FORWARD);
- add_tab_bindings (binding_set, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD);
- add_tab_bindings (binding_set, GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
- add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_Return, 0,
+ "activate-default", NULL);
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_ISO_Enter, 0,
+ "activate-default", NULL);
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_KP_Enter, 0,
+ "activate-default", NULL);
+
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_I, GDK_CONTROL_MASK|GDK_SHIFT_MASK,
+ "enable-debugging", "(b)", FALSE);
+ gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_D, GDK_CONTROL_MASK|GDK_SHIFT_MASK,
+ "enable-debugging", "(b)", TRUE);
+
+ add_arrow_bindings (widget_class, GDK_KEY_Up, GTK_DIR_UP);
+ add_arrow_bindings (widget_class, GDK_KEY_Down, GTK_DIR_DOWN);
+ add_arrow_bindings (widget_class, GDK_KEY_Left, GTK_DIR_LEFT);
+ add_arrow_bindings (widget_class, GDK_KEY_Right, GTK_DIR_RIGHT);
+
+ add_tab_bindings (widget_class, 0, GTK_DIR_TAB_FORWARD);
+ add_tab_bindings (widget_class, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD);
+ add_tab_bindings (widget_class, GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
+ add_tab_bindings (widget_class, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_WINDOW_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, I_("window"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]