Fix wheel down event on legacy pancurses

This commit is contained in:
Alexandre Bury 2021-04-10 23:36:38 -07:00
parent eb9f1b1a81
commit 3c7386dd50

View File

@ -327,6 +327,17 @@ impl Backend {
// or a weird double-release event. :S // or a weird double-release event. :S
self.last_mouse_button self.last_mouse_button
.map(MouseEvent::Hold) .map(MouseEvent::Hold)
.or_else(|| {
// In legacy mode, some buttons overlap,
// so we need to disambiguate.
if mevent.bstate
== pancurses::BUTTON5_DOUBLE_CLICKED as mmask_t
{
Some(MouseEvent::WheelDown)
} else {
None
}
})
.map(&make_event) .map(&make_event)
.unwrap_or_else(|| { .unwrap_or_else(|| {
debug!("We got a mouse drag, but no last mouse pressed?"); debug!("We got a mouse drag, but no last mouse pressed?");