Search code examples
terminalputtynim-lang

does putty support SET_ANY_EVENT_MOUSE , if yes how enable it?


i'm adding mouse support to a ncurses like library and i'm sending the control sequence:

SET_ANY_EVENT_MOUSE (1003h) but it seems putty does not support it?

It does support SET_BTN_EVENT_MOUSE (1002h)

All other terminals i tried (xterm, vte bases terminals, iterm) working just fine. Does putty also support SET_ANY_EVENT_MOUSE and must i enable something else?

How would you debug such kind control sequences?


Solution

  • I'd look at PuTTY's source code, which is in a Git repository. The relevant place to look is in terminal.c in the toggle_mode function. The switch/case statement is ordered by mode number:

          case 1000:                   /* xterm mouse 1 (normal) */
            term->xterm_mouse = state ? 1 : 0;
            win_set_raw_mouse_mode(term->win, state);
            break;
          case 1002:                   /* xterm mouse 2 (inc. button drags) */
            term->xterm_mouse = state ? 2 : 0;
            win_set_raw_mouse_mode(term->win, state);
            break;
          case 1006:                   /* xterm extended mouse */
            term->xterm_extended_mouse = state;
            break;
          case 1015:                   /* urxvt extended mouse */
            term->urxvt_extended_mouse = state;
            break;
          case 1047:
    

    and as you see, it does nothing for 1003 (nor does the log mention it anywhere).

    I'd link to the source, but the host doesn't respond at the moment. However, from my local copy, I see the 1002 feature was added here:

    commit 93101b5a716c3464789ecf5af6403c68559afa43
    Author: Simon Tatham <anakin@pobox.com>
    Date:   Sun May 6 14:20:41 2001 +0000
    
        Wez Furlong's patch to add xterm mouse reporting and proper mouse
        wheel support.
    
        [originally from svn r1097]
    
    diff --git a/terminal.c b/terminal.c
    

    so it's not a recently-overlooked issue.