[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add a hidden option to disable opening URI on middle mouse click

noreply at xfce.org noreply at xfce.org
Wed Jul 27 11:06:15 CEST 2016


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

f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.

commit a3d06ff421f5ca555daf688b442d9dab8d094f23
Author: Tatu Kilappa <trilkk at iki.fi>
Date:   Wed Jul 27 12:03:04 2016 +0300

    Add a hidden option to disable opening URI on middle mouse click
    
    If middle click is disabled, Ctrl + left click will open URI.
    Fixes https://bugzilla.xfce.org/show_bug.cgi?id=10621
---
 terminal/terminal-preferences.c | 11 +++++++++++
 terminal/terminal-widget.c      | 10 ++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index c807267..bc65a99 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -90,6 +90,7 @@ enum
   PROP_MISC_TAB_CLOSE_MIDDLE_CLICK,
   PROP_MISC_TAB_POSITION,
   PROP_MISC_HIGHLIGHT_URLS,
+  PROP_MISC_MIDDLE_CLICK_OPENS_URI,
   PROP_SCROLLING_BAR,
   PROP_SCROLLING_LINES,
   PROP_SCROLLING_ON_OUTPUT,
@@ -796,6 +797,16 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
                             G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
   /**
+   * TerminalPreferences:misc-middle-click-open-uri:
+   **/
+  preferences_props[PROP_MISC_MIDDLE_CLICK_OPENS_URI] =
+      g_param_spec_boolean ("misc-middle-click-opens-uri",
+                            NULL,
+                            "MiscMiddleClickOpensUri",
+                            TRUE,
+                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
    * TerminalPreferences:scrolling-bar:
    **/
   preferences_props[PROP_SCROLLING_BAR] =
diff --git a/terminal/terminal-widget.c b/terminal/terminal-widget.c
index 46f7662..e225739 100644
--- a/terminal/terminal-widget.c
+++ b/terminal/terminal-widget.c
@@ -398,13 +398,19 @@ terminal_widget_button_press_event (GtkWidget       *widget,
                                     GdkEventButton  *event)
 {
   gboolean committed = FALSE;
+  gboolean middle_click_opens_uri;
   gchar   *match;
   guint    signal_id = 0;
   gint     tag;
 
-  if (event->button == 2 && event->type == GDK_BUTTON_PRESS)
+  /* check whether to use ctrl-click or middle click to open URI */
+  g_object_get (G_OBJECT (TERMINAL_WIDGET (widget)->preferences),
+      "misc-middle-click-opens-uri", &middle_click_opens_uri, NULL);
+
+  if ((middle_click_opens_uri ? (event->button == 2) : (event->button == 1 && (event->state & GDK_CONTROL_MASK))) &&
+        event->type == GDK_BUTTON_PRESS)
     {
-      /* middle-clicking on an URI fires the responsible application */
+      /* clicking on an URI fires the responsible application */
       match = vte_terminal_match_check_event (VTE_TERMINAL (widget), (GdkEvent *) event, &tag);
       if (G_UNLIKELY (match != NULL))
         {

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


More information about the Xfce4-commits mailing list