GNOME Bugzilla – Bug 745074
Mouse 1003 mode reports wrong button
Last modified: 2015-02-27 11:40:18 UTC
Found at https://bugzilla.redhat.com/show_bug.cgi?id=1195481, sibling of bug 736447 When the mouse is moved without any buttons being pressed, button 0 (left) is reported instead of 3 (none). Test with echo -ne '\e[?1003h\e[?1006h' (1006 is only for more readable output; notice xterm reports 35 vs. vte 32)
The easy bits: vte_terminal_feed_mouse_event() forgets to map button==0 -> cb=3. The bit more complicated bits: We need to keep track of which buttons are pressed (probably more at the same time) and report one of them when there's a motion. Xterm seems to report the lowest one that's pressed at that time.
Created attachment 297821 [details] [review] Fix Fix v1, I hope it's okay. Does anyone have a 3-button mouse and could double check xterm's behavior? (Otherwise I'll have to dig into its source to verify that indeed the leftmost pressed button is reported on movement.)
Nevermind, I've checked xterm's source. Its mouse_button is a bitmap just like in my patch, and on drag it emits FirstBitN(screen->mouse_button). It's pretty straightforward and is obviously the same.
Fixed