… | |
… | |
1301 | void |
1301 | void |
1302 | rxvt_term::mouse_report (XButtonEvent &ev) |
1302 | rxvt_term::mouse_report (XButtonEvent &ev) |
1303 | { |
1303 | { |
1304 | int button_number, key_state = 0; |
1304 | int button_number, key_state = 0; |
1305 | int x, y; |
1305 | int x, y; |
|
|
1306 | int code = 32; |
1306 | |
1307 | |
1307 | x = Pixel2Col (ev.x); |
1308 | x = Pixel2Col (ev.x); |
1308 | y = Pixel2Row (ev.y); |
1309 | y = Pixel2Row (ev.y); |
|
|
1310 | if (ev.type == MotionNotify) { |
|
|
1311 | if (x == mouse_row && y == mouse_col) |
|
|
1312 | return; |
|
|
1313 | mouse_row = x; |
|
|
1314 | mouse_col = y; |
|
|
1315 | code += 32; |
|
|
1316 | } |
1309 | |
1317 | |
1310 | if (MEvent.button == AnyButton) |
1318 | if (MEvent.button == AnyButton) |
1311 | button_number = 3; |
1319 | button_number = 3; |
1312 | else |
1320 | else |
1313 | { |
1321 | { |
… | |
… | |
1359 | x + 1, |
1367 | x + 1, |
1360 | y + 1); |
1368 | y + 1); |
1361 | #endif |
1369 | #endif |
1362 | |
1370 | |
1363 | tt_printf ("\033[M%c%c%c", |
1371 | tt_printf ("\033[M%c%c%c", |
1364 | (32 + button_number + key_state), |
1372 | (code + button_number + key_state), |
1365 | (32 + x + 1), |
1373 | (32 + x + 1), |
1366 | (32 + y + 1)); |
1374 | (32 + y + 1)); |
1367 | } |
1375 | } |
1368 | |
1376 | |
1369 | /*{{{ process an X event */ |
1377 | /*{{{ process an X event */ |
… | |
… | |
1576 | case MotionNotify: |
1584 | case MotionNotify: |
1577 | #ifdef POINTER_BLANK |
1585 | #ifdef POINTER_BLANK |
1578 | if (hidden_pointer) |
1586 | if (hidden_pointer) |
1579 | pointer_unblank (); |
1587 | pointer_unblank (); |
1580 | #endif |
1588 | #endif |
|
|
1589 | if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask)) |
|
|
1590 | || priv_modes & PrivMode_MouseAnyEvent) |
|
|
1591 | mouse_report (ev.xbutton); |
1581 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1592 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1582 | break; |
1593 | break; |
1583 | |
1594 | |
1584 | if (ev.xany.window == vt) |
1595 | if (ev.xany.window == vt) |
1585 | { |
1596 | { |
… | |
… | |
2848 | { |
2859 | { |
2849 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
2860 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
2850 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2861 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2851 | // |
2862 | // |
2852 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
2863 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
2853 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
2864 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later |
2854 | // that we do not support xterm mouse reporting (should be 95 when we do). |
2865 | // versions. |
2855 | // |
2866 | // |
2856 | tt_printf ("\033[>%d;94;0c", 'U'); |
2867 | tt_printf ("\033[>%d;95;0c", 'U'); |
2857 | } |
2868 | } |
2858 | break; |
2869 | break; |
2859 | case '?': |
2870 | case '?': |
2860 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2871 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2861 | process_terminal_mode (ch, priv, nargs, arg); |
2872 | process_terminal_mode (ch, priv, nargs, arg); |
… | |
… | |
3626 | #ifndef NO_BACKSPACE_KEY |
3637 | #ifndef NO_BACKSPACE_KEY |
3627 | { 67, PrivMode_BackSpace }, |
3638 | { 67, PrivMode_BackSpace }, |
3628 | #endif |
3639 | #endif |
3629 | { 1000, PrivMode_MouseX11 }, |
3640 | { 1000, PrivMode_MouseX11 }, |
3630 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
3641 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
3631 | // 1002 Use Cell Motion Mouse Tracking. NYI, TODO |
3642 | { 1002, PrivMode_MouseBtnEvent }, |
3632 | // 1003 Use All Motion Mouse Tracking. NYI, TODO |
3643 | { 1003, PrivMode_MouseAnyEvent }, |
3633 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3644 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3634 | { 1011, PrivMode_Keypress }, // rxvt extension |
3645 | { 1011, PrivMode_Keypress }, // rxvt extension |
3635 | // 1035 enable modifiers for alt, numlock NYI |
3646 | // 1035 enable modifiers for alt, numlock NYI |
3636 | // 1036 send ESC for meta keys NYI |
3647 | // 1036 send ESC for meta keys NYI |
3637 | // 1037 send DEL for keypad delete NYI |
3648 | // 1037 send DEL for keypad delete NYI |
… | |
… | |
3711 | scr_autowrap (state); |
3722 | scr_autowrap (state); |
3712 | break; |
3723 | break; |
3713 | /* case 8: - auto repeat, can't do on a per window basis */ |
3724 | /* case 8: - auto repeat, can't do on a per window basis */ |
3714 | case 9: /* X10 mouse reporting */ |
3725 | case 9: /* X10 mouse reporting */ |
3715 | if (state) /* orthogonal */ |
3726 | if (state) /* orthogonal */ |
3716 | priv_modes &= ~PrivMode_MouseX11; |
3727 | priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3717 | break; |
3728 | break; |
3718 | #ifdef scrollBar_esc |
3729 | #ifdef scrollBar_esc |
3719 | case scrollBar_esc: |
3730 | case scrollBar_esc: |
3720 | if (scrollbar_mapping (state)) |
3731 | if (scrollbar_mapping (state)) |
3721 | { |
3732 | { |
… | |
… | |
3734 | break; |
3745 | break; |
3735 | /* case 66: - application key pad */ |
3746 | /* case 66: - application key pad */ |
3736 | /* case 67: - backspace key */ |
3747 | /* case 67: - backspace key */ |
3737 | case 1000: /* X11 mouse reporting */ |
3748 | case 1000: /* X11 mouse reporting */ |
3738 | if (state) /* orthogonal */ |
3749 | if (state) /* orthogonal */ |
3739 | priv_modes &= ~PrivMode_MouseX10; |
3750 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3740 | break; |
3751 | break; |
3741 | #if 0 |
3752 | #if 0 |
3742 | case 1001: |
3753 | case 1001: |
3743 | break; /* X11 mouse highlighting */ |
3754 | break; /* X11 mouse highlighting */ |
3744 | #endif |
3755 | #endif |
|
|
3756 | case 1002: |
|
|
3757 | case 1003: |
|
|
3758 | if (state) { |
|
|
3759 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); |
|
|
3760 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
|
|
3761 | vt_emask_mouse = PointerMotionMask; |
|
|
3762 | } else |
|
|
3763 | vt_emask_mouse = NoEventMask; |
|
|
3764 | vt_select_input (); |
|
|
3765 | break; |
3745 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3766 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3746 | set_option (Opt_scrollTtyOutput, !state); |
3767 | set_option (Opt_scrollTtyOutput, !state); |
3747 | break; |
3768 | break; |
3748 | case 1011: /* scroll to bottom on key press */ |
3769 | case 1011: /* scroll to bottom on key press */ |
3749 | set_option (Opt_scrollTtyKeypress, state); |
3770 | set_option (Opt_scrollTtyKeypress, state); |