Ticket #2662: putty-0.61-extended-mouse.patch

File putty-0.61-extended-mouse.patch, 2.4 KB (added by egmont, 12 years ago)
  • terminal.c

    diff -ur putty-0.61.orig/terminal.c putty-0.61/terminal.c
    old new  
    12241224    term->alt_which = 0; 
    12251225    term_print_finish(term); 
    12261226    term->xterm_mouse = 0; 
     1227    term->xterm_extended_mouse = 0; 
     1228    term->urxvt_extended_mouse = 0; 
    12271229    set_raw_mouse_mode(term->frontend, FALSE); 
    12281230    { 
    12291231        int i; 
     
    23982400            term->xterm_mouse = state ? 2 : 0; 
    23992401            set_raw_mouse_mode(term->frontend, state); 
    24002402            break; 
     2403          case 1005:                   /* xterm extended mouse */ 
     2404            term->xterm_extended_mouse = state ? 1 : 0; 
     2405            break; 
     2406          case 1015:                   /* urxvt extended mouse */ 
     2407            term->urxvt_extended_mouse = state ? 1 : 0; 
     2408            break; 
    24012409          case 1047:                   /* alternate screen */ 
    24022410            compatibility(OTHER); 
    24032411            deselect(term); 
     
    56995707    if (raw_mouse && 
    57005708        (term->selstate != ABOUT_TO) && (term->selstate != DRAGGING)) { 
    57015709        int encstate = 0, r, c; 
    5702         char abuf[16]; 
     5710        char abuf[32]; 
     5711        int len = 0; 
    57035712 
    57045713        if (term->ldisc) { 
    57055714 
     
    57425751                encstate += 0x04; 
    57435752            if (ctrl) 
    57445753                encstate += 0x10; 
    5745             r = y + 33; 
    5746             c = x + 33; 
     5754            r = y + 1; 
     5755            c = x + 1; 
    57475756 
    5748             sprintf(abuf, "\033[M%c%c%c", encstate, c, r); 
    5749             ldisc_send(term->ldisc, abuf, 6, 0); 
     5757            if (term->urxvt_extended_mouse) { 
     5758                len = sprintf(abuf, "\033[%d;%d;%dM", encstate, c, r); 
     5759            } else if (term->xterm_extended_mouse) { 
     5760                if (c <= 2015 && r <= 2015) { 
     5761                    wchar_t input[2]; 
     5762                    wchar_t *inputp = input; 
     5763                    int inputlen = 2; 
     5764                    input[0] = c + 32; 
     5765                    input[1] = r + 32; 
     5766 
     5767                    len = sprintf(abuf, "\033[M%c", encstate); 
     5768                    len += charset_from_unicode(&inputp, &inputlen, 
     5769                                                abuf + len, 4, 
     5770                                                CS_UTF8, NULL, NULL, 0); 
     5771                } 
     5772            } else if (c <= 223 && r <= 223) { 
     5773                len = sprintf(abuf, "\033[M%c%c%c", encstate, c + 32, r + 32); 
     5774            } 
     5775            ldisc_send(term->ldisc, abuf, len, 0); 
    57505776        } 
    57515777        return; 
    57525778    } 
  • terminal.h

    diff -ur putty-0.61.orig/terminal.h putty-0.61/terminal.h
    old new  
    152152    int big_cursor; 
    153153 
    154154    int xterm_mouse;                   /* send mouse messages to host */ 
     155    int xterm_extended_mouse; 
     156    int urxvt_extended_mouse; 
    155157    int mouse_is_down;                 /* used while tracking mouse buttons */ 
    156158 
    157159    int cset_attr[2];