]> Sergey Matveev's repositories - st.git/commit
Fix mousereport
authorrobert <robertrussell.72001@gmail.com>
Sat, 8 Jan 2022 19:40:34 +0000 (11:40 -0800)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Mon, 10 Jan 2022 16:04:01 +0000 (17:04 +0100)
commitea7cd7b62fdfa6a1fbd882d1565d557577f2cf32
tree5eafff9b5a615369874408a9820471982ac727b3
parent7fb0c0cc681f36be2ad12091ef93a41671f32738
Fix mousereport

This patch replaces the previous one I sent.

The following changes are made in this patch:
 - Fix tracking of pressed buttons. Previously, pressing two buttons and
   then releasing one would make st think no buttons are pressed, which
   in particular broke MODE_MOUSEMOTION.
 - Always send the lowest-numbered pressed button on motion events; when
   no button is pressed for a motion event in MODE_MOUSEMANY, then send
   a release. This matches the behaviour of xterm. (Previously, st sent
   the most recently pressed button in the motion report.)
 - Remove UB (?) access to potentially inactive struct member
   e->xbutton.button of XEvent union.
 - Fix (unlikely) possibility of overflow for large button numbers.

The one discrepancy I found between st and xterm is that xterm sometimes
encodes buttons with large numbers (>5) strangely. E.g., xterm reports
presses of buttons 8 and 9 as releases, whereas st properly (?) encodes
them as presses.
x.c