Mercurial > hg
changeset 1561:2e86c1cc4eb1
Map mouse events to p* keycodes
author | franky |
---|---|
date | Thu, 30 Oct 2008 19:47:11 +0100 |
parents | ec55cdf44335 |
children | 248da27faff3 c1d0f906d379 |
files | mcabber/src/screen.c mcabber/src/screen.h |
diffstat | 2 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/src/screen.c Fri Oct 17 18:55:58 2008 +0200 +++ b/mcabber/src/screen.c Thu Oct 30 19:47:11 2008 +0100 @@ -733,6 +733,9 @@ intrflush(stdscr, FALSE); start_color(); use_default_colors(); +#ifdef NCURSES_MOUSE_VERSION + mousemask(ALL_MOUSE_EVENTS, NULL); +#endif if (settings_opt_get("escdelay")) { #ifdef HAVE_ESCDELAY @@ -3737,8 +3740,19 @@ kcode->value = wgetch(inputWnd); if (utf8_mode) { bool ismeta = (kcode->value == 27); - +#ifdef NCURSES_MOUSE_VERSION + bool ismouse = (kcode->value == KEY_MOUSE); + + if (ismouse) { + MEVENT mouse; + getmouse(&mouse); + kcode->value = mouse.bstate; + kcode->mcode = MKEY_MOUSE; + return; + } else if (ismeta) +#else if (ismeta) +#endif ks[0] = wgetch(inputWnd); else ks[0] = kcode->value; @@ -3818,6 +3832,8 @@ g_snprintf(asciikey, 15, "%s", asciicode); else if (kcode.mcode == MKEY_META) g_snprintf(asciikey, 15, "M%s", asciicode); + else if (kcode.mcode == MKEY_MOUSE) + g_snprintf(asciikey, 15, "p%s", asciicode); else g_snprintf(asciikey, 15, "MK%d", kcode.mcode);