Fwd: [PATCH] make old escmode key timeout configurable



Forwarding to mc-devel per suggestion of
Leonard den Ottolander <leonard den ottolander nl>

----------  Forwarded Message  ----------
Subject: [PATCH] make old escmode key timeout configurable
Date: Saturday 23 October 2004 21:21
From: Denis Vlasenko <vda port imtp ilyichevsk odessa ua>

Hi,

My memories are vague but I think that mc was the very first
Linux app I built from source, so this is a bit nostalgic now :)

I used old_escmode. I did not like 1 second delay and hacked ESCMODE_TIMEOUT
to 10000 usecs. I knew zilch about patches and the process of submitting,
so that change was sitting there in my mc-4.5.51 for years.

Now time has come to compile new mc (for uclibc), and here is the patch
against 4.6.0.

Usage:

$ mc                                - as usual
$ KEYBOARD_KEY_TIMEOUT_US=25000 mc  - ESC acts way faster than before,
                                      annoying 1-second pause is gone
                                      (pause is there but 25 msec only)

Tested. Please apply.
--
vda
diff -urp mc-4.6.0.orig/src/key.c mc-4.6.0/src/key.c
--- mc-4.6.0.orig/src/key.c	Tue Jan 28 00:37:56 2003
+++ mc-4.6.0/src/key.c	Sat Oct 23 21:04:33 2004
@@ -58,7 +58,7 @@
 			 (t2.tv_usec-t1.tv_usec)/1000)
 			 
 /* timeout for old_esc_mode in usec */
-#define ESCMODE_TIMEOUT 1000000
+#define ESCMODE_TIMEOUT keyboard_key_timeout
 
 /* Linux console keyboard modifiers */
 #define SHIFT_PRESSED 1
@@ -70,6 +70,7 @@
 int mou_auto_repeat = 100;
 int double_click_speed = 250;
 int old_esc_mode = 0;
+int keyboard_key_timeout = 1000000;	/* settable via env */
 
 int use_8th_bit_as_meta = 1;
 
@@ -256,6 +257,10 @@ static Window x11_window;
 void init_key (void)
 {
     char *term = (char *) getenv ("TERM");
+    
+    char *kt = (char *)getenv("KEYBOARD_KEY_TIMEOUT_US");
+    if (kt != NULL)
+	keyboard_key_timeout = atoi(kt);
     
     /* This has to be the first define_sequence */
     /* So, we can assume that the first keys member has ESC */


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