summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@pidgin.im>2008-10-30 17:54:26 +0000
committerSadrul Habib Chowdhury <sadrul@pidgin.im>2008-10-30 17:54:26 +0000
commitd2883347637885df0e30503dca4c41624fd3902a (patch)
tree3afd73decc8f51708611e6a4576788812899b7ce
parent65f61d050afc732598059331ae9b3abbbf10ef26 (diff)
downloadpidgin-d2883347637885df0e30503dca4c41624fd3902a.tar.gz
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
-rw-r--r--ChangeLog3
-rw-r--r--finch/libgnt/gntkeys.c13
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f8c4e01f89..12091f6ce9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/finch/libgnt/gntkeys.c b/finch/libgnt/gntkeys.c
index b669bcc1e4..b4c22ad1d5 100644
--- a/finch/libgnt/gntkeys.c
+++ b/finch/libgnt/gntkeys.c
@@ -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_init_keys()
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 */