pidgin: e017ef61: Allow binding meta-arrow keys for action...

sadrul at pidgin.im sadrul at pidgin.im
Thu Oct 30 14:01:19 EDT 2008


-----------------------------------------------------------------
Revision: e017ef61e76c96af0a324ab890f2e6783a8af023
Ancestor: 9287a75e196278c66cd6724dc8d30a471a029c27
Author: sadrul at pidgin.im
Date: 2008-10-30T17:54:26
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e017ef61e76c96af0a324ab890f2e6783a8af023

Modified files:
        ChangeLog finch/libgnt/gntkeys.c

ChangeLog: 

Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin

-------------- next part --------------
============================================================
--- ChangeLog	42316ef00a0c9d18d11be3959538ae0547cf99a4
+++ ChangeLog	d29943e6b4654a98e10f597f7377e3d691ea4b9d
@@ -8,6 +8,9 @@ version 2.5.3 (??/??/????):
 	  --with-system-ssl-certs and GnuTLS need to include these in the
 	  system certs directory.
 
+	Finch:
+	* Allow binding meta+arrow keys for actions.
+
 version 2.5.2 (10/19/2008):
 	libpurple:
 	* Fixed a crash on removing a custom buddy icon on a buddy.
============================================================
--- finch/libgnt/gntkeys.c	272d18106794d003431f7817d83f930f60013f4f
+++ finch/libgnt/gntkeys.c	22ccb155d220dd80ce4feffe8b06115ee0dd99f9
@@ -102,7 +102,12 @@ void gnt_init_keys()
 #define INSERT_COMB(k, code) do { \
 		snprintf(key, sizeof(key), "%s%s%s", controls[c], alts[a], k);  \
 		INSERT_KEY(key, code);  \
-	} while (0);
+	} while (0)
+#define INSERT_COMB_CODE(k, c1, c2) do { \
+		char __[32]; \
+		snprintf(__, sizeof(__), "%s%s", c1, c2); \
+		INSERT_COMB(k, __); \
+	} while (0)
 
 	/* Lower-case alphabets */
 	for (a = 0, c = 0; controls[c]; c++, a = 0) {
@@ -124,6 +129,10 @@ void gnt_init_keys()
 			}
 			if (c == 0) {
 				INSERT_COMB("tab", "\033\t");
+				INSERT_COMB_CODE("up", "\033", GNT_KEY_UP);
+				INSERT_COMB_CODE("down", "\033", GNT_KEY_DOWN);
+				INSERT_COMB_CODE("left", "\033", GNT_KEY_LEFT);
+				INSERT_COMB_CODE("right", "\033", GNT_KEY_RIGHT);
 			}
 		}
 	}
@@ -144,6 +153,8 @@ void gnt_keys_refine(char *text)
 
 void gnt_keys_refine(char *text)
 {
+	while (*text == 27 && *(text + 1) == 27)
+		text++;
 	if (*text == 27 && *(text + 1) == '[' &&
 			(*(text + 2) >= 'A' && *(text + 2) <= 'D')) {
 		/* Apparently this is necessary for urxvt and screen and xterm */


More information about the Commits mailing list