[Xfce4-commits] [apps/xfce4-terminal] 01/01: Refine "Check (Ctrl+)+Shift+Ins for unsafe paste"

noreply at xfce.org noreply at xfce.org
Sat Mar 16 18:00:54 CET 2019


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-terminal.

commit 0bac69d22824fce7a0786344761f27ac59fa96cf
Author: Igor <f2404 at yandex.ru>
Date:   Sat Mar 16 13:00:23 2019 -0400

    Refine "Check (Ctrl+)+Shift+Ins for unsafe paste"
---
 terminal/terminal-window.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index 99d0dba..a9556aa 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -446,8 +446,6 @@ terminal_window_init (TerminalWindow *window)
   GtkStyleContext *context;
 
   GClosure *toggle_menubar_closure = g_cclosure_new (G_CALLBACK (terminal_window_toggle_menubar), window, NULL);
-  GClosure *paste_closure = g_cclosure_new (G_CALLBACK (terminal_window_action_paste), window, NULL);
-  GClosure *paste_selection_closure = g_cclosure_new (G_CALLBACK (terminal_window_action_paste_selection), window, NULL);
 
   window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, TERMINAL_TYPE_WINDOW, TerminalWindowPrivate);
 
@@ -506,10 +504,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 
   gtk_accel_group_connect_by_path (accel_group, "<Actions>/terminal-window/toggle-menubar", toggle_menubar_closure);
 
-  /* handle Ctrl+Shift+Ins (paste clipboard) and Shift+Ins (paste selection) as if the menu items were used */
-  gtk_accel_group_connect (accel_group, GDK_KEY_Insert, GDK_CONTROL_MASK | GDK_SHIFT_MASK, 0, paste_closure);
-  gtk_accel_group_connect (accel_group, GDK_KEY_Insert, GDK_SHIFT_MASK, 0, paste_selection_closure);
-
   window->priv->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
   gtk_container_add (GTK_CONTAINER (window), window->priv->vbox);
 
@@ -803,6 +797,21 @@ terminal_window_key_press_event (GtkWidget   *widget,
         }
     }
 
+  /* handle Ctrl+Shift+Ins (paste clipboard) and Shift+Ins (paste selection) */
+  if (event->keyval == GDK_KEY_Insert || event->keyval == GDK_KEY_KP_Insert)
+    {
+      if (modifiers == (GDK_CONTROL_MASK | GDK_SHIFT_MASK))
+        {
+          terminal_window_action_paste (NULL, window);
+          return TRUE;
+        }
+      else if (modifiers == GDK_SHIFT_MASK)
+        {
+          terminal_window_action_paste_selection (NULL, window);
+          return TRUE;
+        }
+    }
+
   return (*GTK_WIDGET_CLASS (terminal_window_parent_class)->key_press_event) (widget, event);
 }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list