{
int button_number, key_state = 0;
int x, y;
+ int code = 32;
x = Pixel2Col (ev.x);
y = Pixel2Row (ev.y);
+ if (ev.type == MotionNotify) {
+ if (x == mouse_row && y == mouse_col)
+ return;
+ mouse_row = x;
+ mouse_col = y;
+ code += 32;
+ }
if (MEvent.button == AnyButton)
button_number = 3;
#endif
tt_printf ("\033[M%c%c%c",
- (32 + button_number + key_state),
+ (code + button_number + key_state),
(32 + x + 1),
(32 + y + 1));
}
if (hidden_pointer)
pointer_unblank ();
#endif
+ if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask))
+ || priv_modes & PrivMode_MouseAnyEvent)
+ mouse_report (ev.xbutton);
if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
break;
// 'U' for rxvt-unicode != 7.[34] (where it was broken).
//
// second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt
- // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify
- // that we do not support xterm mouse reporting (should be 95 when we do).
+ // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later
+ // versions.
//
- tt_printf ("\033[>%d;94;0c", 'U');
+ tt_printf ("\033[>%d;95;0c", 'U');
}
break;
case '?':
#endif
{ 1000, PrivMode_MouseX11 },
// 1001 Use Hilite Mouse Tracking. NYI, TODO
- // 1002 Use Cell Motion Mouse Tracking. NYI, TODO
- // 1003 Use All Motion Mouse Tracking. NYI, TODO
+ { 1002, PrivMode_MouseBtnEvent },
+ { 1003, PrivMode_MouseAnyEvent },
{ 1010, PrivMode_TtyOutputInh }, // rxvt extension
{ 1011, PrivMode_Keypress }, // rxvt extension
// 1035 enable modifiers for alt, numlock NYI
/* case 8: - auto repeat, can't do on a per window basis */
case 9: /* X10 mouse reporting */
if (state) /* orthogonal */
- priv_modes &= ~PrivMode_MouseX11;
+ priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
break;
#ifdef scrollBar_esc
case scrollBar_esc:
/* case 67: - backspace key */
case 1000: /* X11 mouse reporting */
if (state) /* orthogonal */
- priv_modes &= ~PrivMode_MouseX10;
+ priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
break;
#if 0
case 1001:
break; /* X11 mouse highlighting */
#endif
+ case 1002:
+ case 1003:
+ if (state) {
+ priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
+ priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
+ vt_emask_mouse = PointerMotionMask;
+ } else
+ vt_emask_mouse = NoEventMask;
+ vt_select_input ();
+ break;
case 1010: /* scroll to bottom on TTY output inhibit */
set_option (Opt_scrollTtyOutput, !state);
break;
#define PrivMode_smoothScroll (1UL<<17)
#define PrivMode_vt52 (1UL<<18)
#define PrivMode_LFNL (1UL<<19)
+#define PrivMode_MouseBtnEvent (1UL<<20)
+#define PrivMode_MouseAnyEvent (1UL<<21)
/* too annoying to implement X11 highlight tracking */
/* #define PrivMode_MouseX11Track (1LU<<20) */
-#define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11)
+#define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent)
#ifdef ALLOW_132_MODE
# define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK)
window_vt_x,
window_vt_y,
window_sb_x,
+ mouse_row,
+ mouse_col,
# ifdef POINTER_BLANK
pointerBlankDelay,
# endif
# endif
#endif
- long vt_emask, vt_emask_perl, vt_emask_xim;
+ long vt_emask, vt_emask_perl, vt_emask_xim, vt_emask_mouse;
void vt_select_input () const NOTHROW
{
- XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim);
+ XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim | vt_emask_mouse);
}
#if ENABLE_TRANSPARENCY || ENABLE_PERL