# HG changeset patch # User Sadrul Habib Chowdhury # Date 1225389266 0 # Node ID 23687caad265d8852ddd08843cafc6f558c685e1 # Parent c06b85e1d02042575b15c7867da2fcb61b9dff64 Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin diff -r c06b85e1d020 -r 23687caad265 ChangeLog --- a/ChangeLog Thu Oct 30 05:41:19 2008 +0000 +++ b/ChangeLog Thu Oct 30 17:54:26 2008 +0000 @@ -8,6 +8,9 @@ --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 -r c06b85e1d020 -r 23687caad265 finch/libgnt/gntkeys.c --- a/finch/libgnt/gntkeys.c Thu Oct 30 05:41:19 2008 +0000 +++ b/finch/libgnt/gntkeys.c Thu Oct 30 17:54:26 2008 +0000 @@ -102,7 +102,12 @@ #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 @@ } 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) { + 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 */