1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-11 14:25:57 +03:00

Implement forgotten PointerEventKind::Release, mouse features seem to work now

This commit is contained in:
Timmy Xiao 2024-01-19 17:47:49 -08:00 committed by Wez Furlong
parent 6807d7c18f
commit 60066034aa
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

View File

@ -10,8 +10,6 @@ use wayland_client::protocol::wl_seat::WlSeat;
use wayland_client::{Connection, Proxy, QueueHandle};
use wezterm_input_types::MousePress;
use crate::ConnectionOps;
use super::state::WaylandState;
use super::WaylandConnection;
@ -123,7 +121,7 @@ impl PendingMouse {
self.surface_coords.replace(evt.position);
changed
}
PointerEventKind::Press { button, .. } => {
PointerEventKind::Press { button, .. } | PointerEventKind::Release { button, .. } => {
fn linux_button(b: u32) -> Option<MousePress> {
// See BTN_LEFT and friends in <linux/input-event-codes.h>
match b {
@ -138,7 +136,12 @@ impl PendingMouse {
None => return false,
};
let changed = self.button.is_empty();
self.button.push((button, ButtonState::Pressed));
let button_state = match evt.kind {
PointerEventKind::Press { .. } => ButtonState::Pressed,
PointerEventKind::Release { .. } => ButtonState::Released,
_ => unreachable!(),
};
self.button.push((button, button_state));
changed
}
PointerEventKind::Axis {
@ -152,7 +155,6 @@ impl PendingMouse {
.replace((x + horizontal.absolute, y + vertical.absolute));
changed
}
_ => false,
}
}