McKael / mcabber (http://mcabber.com)

Mirror of the mcabber upstream repository. MCabber is a small Jabber console client.

Clone this repository (size: 5.2 MB): HTTPS / SSH
$ hg clone http://bitbucket.org/McKael/mcabber/
commit 1561: 2e86c1cc4eb1
parent 1560: ec55cdf44335
branch: default
Map mouse events to p* keycodes
franky
17 months ago

Changed (Δ433 bytes):

raw changeset »

mcabber/src/screen.c (17 lines added, 1 lines removed)

mcabber/src/screen.h (2 lines added, 1 lines removed)

Up to file-list mcabber/src/screen.c:

@@ -733,6 +733,9 @@ void scr_InitCurses(void)
733
733
  intrflush(stdscr, FALSE);
734
734
  start_color();
735
735
  use_default_colors();
736
#ifdef NCURSES_MOUSE_VERSION
737
  mousemask(ALL_MOUSE_EVENTS, NULL);
738
#endif
736
739
737
740
  if (settings_opt_get("escdelay")) {
738
741
#ifdef HAVE_ESCDELAY
@@ -3737,8 +3740,19 @@ void scr_Getch(keycode *kcode)
3737
3740
  kcode->value = wgetch(inputWnd);
3738
3741
  if (utf8_mode) {
3739
3742
    bool ismeta = (kcode->value == 27);
3740
3743
#ifdef NCURSES_MOUSE_VERSION
3744
    bool ismouse = (kcode->value == KEY_MOUSE);
3745
3746
    if (ismouse) {
3747
      MEVENT mouse;
3748
      getmouse(&mouse);
3749
      kcode->value = mouse.bstate;
3750
      kcode->mcode = MKEY_MOUSE;
3751
      return;
3752
    } else if (ismeta)
3753
#else
3741
3754
    if (ismeta)
3755
#endif
3742
3756
      ks[0] = wgetch(inputWnd);
3743
3757
    else
3744
3758
      ks[0] = kcode->value;
@@ -3818,6 +3832,8 @@ static int bindcommand(keycode kcode)
3818
3832
    g_snprintf(asciikey, 15, "%s", asciicode);
3819
3833
  else if (kcode.mcode == MKEY_META)
3820
3834
    g_snprintf(asciikey, 15, "M%s", asciicode);
3835
  else if (kcode.mcode == MKEY_MOUSE)
3836
    g_snprintf(asciikey, 15, "p%s", asciicode);
3821
3837
  else
3822
3838
    g_snprintf(asciikey, 15, "MK%d", kcode.mcode);
3823
3839

Up to file-list mcabber/src/screen.h:

@@ -70,7 +70,8 @@ typedef struct {
70
70
    MKEY_CTRL_INS,
71
71
    MKEY_CTRL_DEL,
72
72
    MKEY_CTRL_SHIFT_HOME,
73
    MKEY_CTRL_SHIFT_END
73
    MKEY_CTRL_SHIFT_END,
74
    MKEY_MOUSE
74
75
  } mcode;
75
76
} keycode;
76
77