Currently urxvt emits mouse reports upon pressing extra mouse buttons, i.e. those that come after wheel up/down/left/right, and which xev identifies as 8 and up. Buttons 8 and 9 are commonly labeled as "back" and "forward". However, these mouse reports have a few problems.
For buttons 8 and 9, the values reported in the escape sequences are the same as those that are reserved for shift+wheel up (68) and shift+wheel down (69). Release reports are also not being emitted for these buttons. The current logic treats buttons with an id >= 4 as a wheel events. xterm has taken the approach of using ids 128 and above for these buttons, avoiding the conflict with shift+wheel up/down codes. This patch is an attempt at addressing these issues by matching xterm behavior by 1) changing reported button codes for those extra buttons, 2) adding 2 byte button representations in UTF8 mode for those buttons, and 3) publishing release events for those buttons. --- src/command.C | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/command.C b/src/command.C index 69ec0eed..bb52a067 100644 --- a/src/command.C +++ b/src/command.C @@ -1298,7 +1298,11 @@ rxvt_term::mouse_report (XButtonEvent &ev) button_number = MEvent.button - Button1; /* add 0x3D for wheel events, like xterm does */ - if (button_number >= 3) + if (button_number > 10) + return; + else if (button_number >= 7) + button_number += 128 - 7; + else if (button_number >= 3) button_number += 64 - 3; if (priv_modes & PrivMode_MouseX10) @@ -1358,10 +1362,17 @@ rxvt_term::mouse_report (XButtonEvent &ev) x, y); else if (priv_modes & PrivMode_ExtMouseUTF8) - tt_printf ("\033[M%c%lc%lc", - code, - wint_t (32 + x), - wint_t (32 + y)); + if (code < 128) + tt_printf ("\033[M%c%lc%lc", + code, + wint_t (32 + x), + wint_t (32 + y)); + else + tt_printf ("\033[M%c%c%lc%lc", + 0xc0 + (code >> 6), + 0x80 + (code & 0x3f), + wint_t (32 + x), + wint_t (32 + y)); else #endif tt_printf ("\033[M%c%c%c", @@ -2143,7 +2154,7 @@ rxvt_term::button_release (XButtonEvent &ev) { /* mouse report from vt window */ /* don't report release of wheel "buttons" */ - if (ev.button >= 4) + if (ev.button >= 4 && ev.button <= 7) return; #ifdef MOUSE_REPORT_DOUBLECLICK /* only report the release of 'slow' single clicks */ -- 2.39.2 _______________________________________________ rxvt-unicode mailing list rxvt-unicode@lists.schmorp.de http://lists.schmorp.de/mailman/listinfo/rxvt-unicode