I love rxvt-unicode, but the threshold time that determines a double
or triple click is a little longer than I am used to. It is
hard-coded, currently, but since Xterm has an option (-mc) and X
resource (multiClickTime) to control it, I added the same to
rxvt-unicode, and I've attached the patch here. I hope people find
this useful, and it would be great to see it added to the official
code.

-Joe
diff -Nurp a/doc/rxvt.1.man.in b/doc/rxvt.1.man.in
--- a/doc/rxvt.1.man.in	2014-04-26 08:29:58.000000000 -0600
+++ b/doc/rxvt.1.man.in	2014-08-14 23:31:26.231671600 -0600
@@ -330,6 +330,9 @@ rather than the default executable file
 .IP "\fB\-ls\fR|\fB+ls\fR" 4
 .IX Item "-ls|+ls"
 Start as a login\-shell/sub\-shell; resource \fBloginShell\fR.
+.IP "\fB\-mc\fR \fImilliseconds\fR" 4
+.IX Item "-mc milliseconds"
+Specify the maximum time between multi-click selections.
 .IP "\fB\-ut\fR|\fB+ut\fR" 4
 .IX Item "-ut|+ut"
 Compile \fIutmp\fR: Inhibit/enable writing a utmp entry; resource
@@ -829,6 +832,9 @@ de-iconify (map) on receipt of a bell ch
 \&\fBTrue\fR: start as a login shell by prepending a `\-' to \fBargv[0]\fR of
 the shell; option \fB\-ls\fR. \fBFalse\fR: start as a normal sub-shell
 [default]; option \fB+ls\fR.
+.IP "\fBmultiClickTime:\fR \fInumber\fR" 4
+.IX Item "multiClickTime: number"
+Specify the maximum time in milliseconds between multi-click select events. The default is 500 milliseconds; option \fB\-mc\fR.
 .IP "\fButmpInhibit:\fR \fIboolean\fR" 4
 .IX Item "utmpInhibit: boolean"
 \&\fBTrue\fR: inhibit writing record into the system log file \fButmp\fR;
diff -Nurp a/src/command.C b/src/command.C
--- a/src/command.C	2014-04-26 08:10:12.000000000 -0600
+++ b/src/command.C	2014-08-14 17:34:03.296401163 -0600
@@ -1925,7 +1925,7 @@ rxvt_term::button_press (XButtonEvent &e
         }
 #endif
 
-      clickintime = ev.time - MEvent.time < MULTICLICK_TIME;
+      clickintime = ev.time - MEvent.time < multiClickTime;
 
       if (reportmode)
         {
@@ -2185,7 +2185,7 @@ rxvt_term::button_release (XButtonEvent
           if (MEvent.button != AnyButton
               && (ev.button != MEvent.button
                   || (ev.time - MEvent.time
-                      > MULTICLICK_TIME / 2)))
+                      > multiClickTime / 2)))
             {
               MEvent.clicks = 0;
               MEvent.button = AnyButton;
diff -Nurp a/src/command.h b/src/command.h
--- a/src/command.h	2014-02-20 09:51:16.000000000 -0700
+++ b/src/command.h	2014-08-14 17:29:23.857579265 -0600
@@ -7,9 +7,6 @@
 
 #define ESC_ARGS	32	/* max # of args for esc sequences */
 
-#ifndef MULTICLICK_TIME
-# define MULTICLICK_TIME	500
-#endif
 #ifndef SCROLLBAR_INITIAL_DELAY
 # define SCROLLBAR_INITIAL_DELAY	0.33
 #endif
diff -Nurp a/src/init.C b/src/init.C
--- a/src/init.C	2013-12-10 12:46:53.000000000 -0700
+++ b/src/init.C	2014-08-14 17:48:47.569420540 -0600
@@ -730,6 +730,15 @@ rxvt_term::init_resources (int argc, con
   if (!rs[Rs_color + Color_border])
     rs[Rs_color + Color_border] = rs[Rs_color + Color_bg];
 
+  if (rs[Rs_multiClickTime])
+    {
+      multiClickTime = atoi(rs[Rs_multiClickTime]);
+    }
+  else
+    {
+      multiClickTime = MULTICLICK_TIME;
+    }
+
   return cmd_argv;
 }
 
diff -Nurp a/src/init.h b/src/init.h
--- a/src/init.h	2013-03-27 10:59:20.000000000 -0600
+++ b/src/init.h	2014-08-14 17:29:45.327731295 -0600
@@ -17,6 +17,10 @@
 # define BAUDRATE	B9600
 #endif
 
+#ifndef MULTICLICK_TIME
+# define MULTICLICK_TIME	500
+#endif
+
 /* Disable special character functions */
 #ifdef _POSIX_VDISABLE
 # define VDISABLE	_POSIX_VDISABLE
diff -Nurp a/src/optinc.h b/src/optinc.h
--- a/src/optinc.h	2013-03-27 10:59:20.000000000 -0600
+++ b/src/optinc.h	2014-08-13 15:19:52.809001700 -0600
@@ -1,6 +1,7 @@
 // all resource indices, used by rxvt.h and rxvtperl.xs
 
  def(loginShell)
+ def(multiClickTime)
  def(iconic)
  def(visualBell)
  def(mapAlert)
diff -Nurp a/src/rsinc.h b/src/rsinc.h
--- a/src/rsinc.h	2013-03-27 10:59:20.000000000 -0600
+++ b/src/rsinc.h	2014-08-13 15:19:32.928555374 -0600
@@ -22,6 +22,7 @@
   def (backgroundPixmap)
 #endif
   def (loginShell)
+  def (multiClickTime)
   def (jumpScroll)
   def (skipScroll)
   def (scrollBar)
diff -Nurp a/src/rxvt.h b/src/rxvt.h
--- a/src/rxvt.h	2014-02-21 11:04:37.000000000 -0700
+++ b/src/rxvt.h	2014-08-14 17:22:43.271132004 -0600
@@ -1090,6 +1090,7 @@ struct rxvt_vars : TermWin_t
 #ifdef OFF_FOCUS_FADING
   rxvt_color      pix_colors_unfocused[TOTAL_COLORS];
 #endif
+  int             multiClickTime;
 };
 
 struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
diff -Nurp a/src/xdefaults.C b/src/xdefaults.C
--- a/src/xdefaults.C	2013-03-27 10:59:20.000000000 -0600
+++ b/src/xdefaults.C	2014-08-13 15:19:20.368273210 -0600
@@ -100,6 +100,7 @@ optList[] = {
               STRG (Rs_chdir, "chdir", "cd", "string", "start shell in this directory"),
               BOOL (Rs_reverseVideo, "reverseVideo", "rv", Opt_reverseVideo, 0, "reverse video"),
               BOOL (Rs_loginShell, "loginShell", "ls", Opt_loginShell, 0, "login shell"),
+              STRG (Rs_multiClickTime, "multiClickTime", "mc", "number", "Maximum time between multi-click selections (ms)"),
               BOOL (Rs_jumpScroll, "jumpScroll", "j", Opt_jumpScroll, 0, "jump scrolling"),
               BOOL (Rs_skipScroll, "skipScroll", "ss", Opt_skipScroll, 0, "skip scrolling"),
               BOOL (Rs_pastableTabs, "pastableTabs", "ptab", Opt_pastableTabs, 0, "tab characters are pastable"),
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to