From 3c5d7e001ee41c1651506d6ac59a9daa81466049 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 21 Jul 2022 15:53:21 +0200 Subject: [PATCH] Always mark keydown events as handled to suppress beep --- crates/gpui/src/platform/mac/window.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index d50f03b18d7d813ecdb890ca4401f917f6db7eab..2d03e89c2c43bb674fe0fab58b9e125349a8c4e3 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -721,19 +721,16 @@ extern "C" fn handle_key_equivalent(this: &Object, _: Sel, native_event: id) -> let _: BOOL = msg_send![input_context, handleEvent: native_event]; } - let mut handled = false; let mut window_state_borrow = window_state.borrow_mut(); if let Some(event) = window_state_borrow.pending_key_down_event.take() { if let Some(mut callback) = window_state_borrow.event_callback.take() { drop(window_state_borrow); - handled = callback(Event::KeyDown(event)); + callback(Event::KeyDown(event)); window_state.borrow_mut().event_callback = Some(callback); } - } else { - handled = true; } - handled as BOOL + YES } else { NO }