[console/wip/exalm/gtk4: 9/10] terminal: Restore Ctrl+Shift+C/V shortcuts




commit e83bf93016b0a3c9b6a55fb67d4ad558e9925c48
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Jul 27 23:42:47 2022 +0400

    terminal: Restore Ctrl+Shift+C/V shortcuts

 src/kgx-terminal.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/src/kgx-terminal.c b/src/kgx-terminal.c
index eaadf98..848f2ae 100644
--- a/src/kgx-terminal.c
+++ b/src/kgx-terminal.c
@@ -713,6 +713,8 @@ static void
 kgx_terminal_init (KgxTerminal *self)
 {
   GtkGesture *gesture;
+  GtkEventController *controller;
+  GtkShortcut *shortcut;
 
   gesture = gtk_gesture_click_new ();
   gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
@@ -724,6 +726,18 @@ kgx_terminal_init (KgxTerminal *self)
   g_signal_connect (gesture, "pressed", G_CALLBACK (long_pressed), self);
   gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
 
+  controller = gtk_shortcut_controller_new ();
+  gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
+  gtk_widget_add_controller (GTK_WIDGET (self), controller);
+
+  shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_C, GDK_CONTROL_MASK | GDK_SHIFT_MASK),
+                               gtk_named_action_new ("term.copy"));
+  gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller), shortcut);
+
+  shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_V, GDK_CONTROL_MASK | GDK_SHIFT_MASK),
+                               gtk_named_action_new ("term.paste"));
+  gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller), shortcut);
+
   gtk_widget_action_set_enabled (GTK_WIDGET (self), "term.open-link", FALSE);
   gtk_widget_action_set_enabled (GTK_WIDGET (self), "term.copy-link", FALSE);
   gtk_widget_action_set_enabled (GTK_WIDGET (self), "term.copy", FALSE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]