Fix some bugs in mouse tracking logic
* Button number in X10 mode: I believe the button - 1 came from "C b is button - 1" from [0]. However, above this section, it states "Normally, parameters (such as pointer poisition and button number) for all mouse tracking escape sequences generated by xterm encode numeric parameters in a single character as value+32. For example, ! specifies the value 1." Also, from the description of SGR, "The encoded button value in this case does not add 32 since that was useful only in the X10 scheme for ensuring that the byte containing the button value is a printable code." This suggests that we should still add 32 to the button value when in MODE_MOUSEX10. * No button release reporting in X10 mode: "X10 compatibility mode sends an escape sequence only on button press, encoding the location and the mouse button pressed." * Fix MODE_MOUSEMOTION: Currently, motion reporting is skipped when oldbutton == 3 (corresponding to no button being pressed). However, oldbutton is only set on a button press, which will never be 3. [0]: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
This commit is contained in:
parent
cc2ea3147a
commit
eae31a532e
22
st.c
22
st.c
|
@ -823,18 +823,23 @@ mousereport(XEvent *e) {
|
||||||
button = oldbutton + 32;
|
button = oldbutton + 32;
|
||||||
ox = x;
|
ox = x;
|
||||||
oy = y;
|
oy = y;
|
||||||
} else if(!IS_SET(MODE_MOUSESGR)
|
|
||||||
&& (e->xbutton.type == ButtonRelease
|
|
||||||
|| button == AnyButton)) {
|
|
||||||
button = 3;
|
|
||||||
} else {
|
} else {
|
||||||
button -= Button1;
|
if(!IS_SET(MODE_MOUSESGR) && e->xbutton.type == ButtonRelease) {
|
||||||
if(button >= 3)
|
button = 3;
|
||||||
button += 64 - 3;
|
} else {
|
||||||
|
button -= Button1;
|
||||||
|
if(button >= 3)
|
||||||
|
button += 64 - 3;
|
||||||
|
}
|
||||||
if(e->xbutton.type == ButtonPress) {
|
if(e->xbutton.type == ButtonPress) {
|
||||||
oldbutton = button;
|
oldbutton = button;
|
||||||
ox = x;
|
ox = x;
|
||||||
oy = y;
|
oy = y;
|
||||||
|
} else if(e->xbutton.type == ButtonRelease) {
|
||||||
|
oldbutton = 3;
|
||||||
|
/* MODE_MOUSEX10: no button release reporting */
|
||||||
|
if(IS_SET(MODE_MOUSEX10))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,8 +856,7 @@ mousereport(XEvent *e) {
|
||||||
e->xbutton.type == ButtonRelease ? 'm' : 'M');
|
e->xbutton.type == ButtonRelease ? 'm' : 'M');
|
||||||
} else if(x < 223 && y < 223) {
|
} else if(x < 223 && y < 223) {
|
||||||
len = snprintf(buf, sizeof(buf), "\033[M%c%c%c",
|
len = snprintf(buf, sizeof(buf), "\033[M%c%c%c",
|
||||||
IS_SET(MODE_MOUSEX10)? button-1 : 32+button,
|
32+button, 32+x+1, 32+y+1);
|
||||||
32+x+1, 32+y+1);
|
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue