Compare commits

..

1 Commits

Author SHA1 Message Date
Ferdinand Schober
295be87a29 macos: fix duplicated key release event 2025-10-29 17:46:57 +01:00

View File

@@ -88,7 +88,7 @@ impl MacOSEmulation {
button_state, button_state,
previous_button: None, previous_button: None,
previous_button_click: None, previous_button_click: None,
button_click_state: 0, button_click_state: 1,
repeat_task: None, repeat_task: None,
notify_repeat_task: Arc::new(Notify::new()), notify_repeat_task: Arc::new(Notify::new()),
modifier_state: Rc::new(Cell::new(XMods::empty())), modifier_state: Rc::new(Cell::new(XMods::empty())),
@@ -244,8 +244,7 @@ impl Emulation for MacOSEmulation {
) -> Result<(), EmulationError> { ) -> Result<(), EmulationError> {
log::trace!("{event:?}"); log::trace!("{event:?}");
match event { match event {
Event::Pointer(pointer_event) => { Event::Pointer(pointer_event) => match pointer_event {
match pointer_event {
PointerEvent::Motion { time: _, dx, dy } => { PointerEvent::Motion { time: _, dx, dy } => {
let mut mouse_location = match self.get_mouse_location() { let mut mouse_location = match self.get_mouse_location() {
Some(l) => l, Some(l) => l,
@@ -396,13 +395,7 @@ impl Emulation for MacOSEmulation {
}; };
event.post(CGEventTapLocation::HID); event.post(CGEventTapLocation::HID);
} }
} },
// reset button click state in case it's not a button event
if !matches!(pointer_event, PointerEvent::Button { .. }) {
self.button_click_state = 0;
}
}
Event::Keyboard(keyboard_event) => match keyboard_event { Event::Keyboard(keyboard_event) => match keyboard_event {
KeyboardEvent::Key { KeyboardEvent::Key {
time: _, time: _,