From d3cbfcfb7aa3c8887f9438b9b46c539375bf2f91 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 18 Oct 2022 18:12:11 -0700 Subject: [PATCH] fixes #574 Mouse wheel events during click-drag misdelivered as button events --- tscreen.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/tscreen.go b/tscreen.go index 1e61d25..c3fe7be 100644 --- a/tscreen.go +++ b/tscreen.go @@ -134,7 +134,6 @@ type tScreen struct { clear bool cursorx int cursory int - wasbtn bool acs map[rune]string charset string encoder transform.Transformer @@ -1233,28 +1232,16 @@ func (t *tScreen) buildMouseEvent(x, y, btn int) *EventMouse { switch btn & 0x43 { case 0: button = Button1 - t.wasbtn = true case 1: button = Button3 // Note we prefer to treat right as button 2 - t.wasbtn = true case 2: button = Button2 // And the middle button as button 3 - t.wasbtn = true case 3: button = ButtonNone - t.wasbtn = false case 0x40: - if !t.wasbtn { - button = WheelUp - } else { - button = Button1 - } + button = WheelUp case 0x41: - if !t.wasbtn { - button = WheelDown - } else { - button = Button2 - } + button = WheelDown } if btn&0x4 != 0 {