diff options
| author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2021-03-19 11:54:36 +0100 |
|---|---|---|
| committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2021-03-19 11:58:59 +0100 |
| commit | 9e68fdbcdb06dfa3d23fe3a7a7f7b59e40e1ea2f (patch) | |
| tree | f3ba82d15da9608f9b0f4c70b3881d78424cb2a6 | |
| parent | remove unused variable from previous patch (diff) | |
| download | st-9e68fdbcdb06dfa3d23fe3a7a7f7b59e40e1ea2f.tar.gz st-9e68fdbcdb06dfa3d23fe3a7a7f7b59e40e1ea2f.zip | |
fix: correctly encode mouse buttons >= 8 in X10 and SGR mode
These are typically mapped in X11 to the side-buttons (backward/forwards) on
the mouse. A comparison of the button numbers in SGR mode (first field):
st old:
0 1 2 64 65 66 67 68 69 70
st new (it is the same as xterm now):
0 1 2 64 65 66 67 128 129 130
A script to test and reproduce it, first argument is "h" (on) or "l" (off):
#!/bin/sh
printf '\x1b[?1000%s\x1b[?1006%s' "$1" "$1"
for n in 1 2 3 4 5 6 7 8 9 10; do
printf 'button %d\n' "$n"
xdotool click "$n"
printf '\n\n'
done
Diffstat (limited to '')
| -rw-r--r-- | x.c | 4 |
1 files changed, 3 insertions, 1 deletions
| @@ -387,7 +387,9 @@ mousereport(XEvent *e) | |||
| 387 | button = 3; | 387 | button = 3; |
| 388 | } else { | 388 | } else { |
| 389 | button -= Button1; | 389 | button -= Button1; |
| 390 | if (button >= 3) | 390 | if (button >= 7) |
| 391 | button += 128 - 7; | ||
| 392 | else if (button >= 3) | ||
| 391 | button += 64 - 3; | 393 | button += 64 - 3; |
| 392 | } | 394 | } |
| 393 | if (e->xbutton.type == ButtonPress) { | 395 | if (e->xbutton.type == ButtonPress) { |
