mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-14 22:14:23 +00:00
parent
06863144c6
commit
a60b3b9389
2 changed files with 17 additions and 1 deletions
|
@ -76,6 +76,7 @@ pub(crate) fn handle_msg(
|
||||||
WM_MOUSEHWHEEL => handle_mouse_horizontal_wheel_msg(handle, wparam, lparam, state_ptr),
|
WM_MOUSEHWHEEL => handle_mouse_horizontal_wheel_msg(handle, wparam, lparam, state_ptr),
|
||||||
WM_SYSKEYDOWN => handle_syskeydown_msg(wparam, lparam, state_ptr),
|
WM_SYSKEYDOWN => handle_syskeydown_msg(wparam, lparam, state_ptr),
|
||||||
WM_SYSKEYUP => handle_syskeyup_msg(wparam, state_ptr),
|
WM_SYSKEYUP => handle_syskeyup_msg(wparam, state_ptr),
|
||||||
|
WM_SYSCOMMAND => handle_system_command(wparam, state_ptr),
|
||||||
WM_KEYDOWN => handle_keydown_msg(wparam, lparam, state_ptr),
|
WM_KEYDOWN => handle_keydown_msg(wparam, lparam, state_ptr),
|
||||||
WM_KEYUP => handle_keyup_msg(wparam, state_ptr),
|
WM_KEYUP => handle_keyup_msg(wparam, state_ptr),
|
||||||
WM_CHAR => handle_char_msg(wparam, lparam, state_ptr),
|
WM_CHAR => handle_char_msg(wparam, lparam, state_ptr),
|
||||||
|
@ -273,7 +274,8 @@ fn handle_syskeydown_msg(
|
||||||
keystroke,
|
keystroke,
|
||||||
is_held: lparam.0 & (0x1 << 30) > 0,
|
is_held: lparam.0 & (0x1 << 30) > 0,
|
||||||
};
|
};
|
||||||
let result = if func(PlatformInput::KeyDown(event)).default_prevented {
|
let result = if !func(PlatformInput::KeyDown(event)).propagate {
|
||||||
|
state_ptr.state.borrow_mut().system_key_handled = true;
|
||||||
Some(0)
|
Some(0)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -1067,6 +1069,17 @@ fn handle_system_settings_changed(
|
||||||
Some(0)
|
Some(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle_system_command(wparam: WPARAM, state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> {
|
||||||
|
if wparam.0 == SC_KEYMENU as usize {
|
||||||
|
let mut lock = state_ptr.state.borrow_mut();
|
||||||
|
if lock.system_key_handled {
|
||||||
|
lock.system_key_handled = false;
|
||||||
|
return Some(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
fn parse_syskeydown_msg_keystroke(wparam: WPARAM) -> Option<Keystroke> {
|
fn parse_syskeydown_msg_keystroke(wparam: WPARAM) -> Option<Keystroke> {
|
||||||
let modifiers = current_modifiers();
|
let modifiers = current_modifiers();
|
||||||
if !modifiers.alt {
|
if !modifiers.alt {
|
||||||
|
|
|
@ -40,6 +40,7 @@ pub struct WindowsWindowState {
|
||||||
|
|
||||||
pub callbacks: Callbacks,
|
pub callbacks: Callbacks,
|
||||||
pub input_handler: Option<PlatformInputHandler>,
|
pub input_handler: Option<PlatformInputHandler>,
|
||||||
|
pub system_key_handled: bool,
|
||||||
|
|
||||||
pub renderer: BladeRenderer,
|
pub renderer: BladeRenderer,
|
||||||
|
|
||||||
|
@ -87,6 +88,7 @@ impl WindowsWindowState {
|
||||||
let renderer = windows_renderer::windows_renderer(hwnd, transparent)?;
|
let renderer = windows_renderer::windows_renderer(hwnd, transparent)?;
|
||||||
let callbacks = Callbacks::default();
|
let callbacks = Callbacks::default();
|
||||||
let input_handler = None;
|
let input_handler = None;
|
||||||
|
let system_key_handled = false;
|
||||||
let click_state = ClickState::new();
|
let click_state = ClickState::new();
|
||||||
let system_settings = WindowsSystemSettings::new();
|
let system_settings = WindowsSystemSettings::new();
|
||||||
let nc_button_pressed = None;
|
let nc_button_pressed = None;
|
||||||
|
@ -100,6 +102,7 @@ impl WindowsWindowState {
|
||||||
scale_factor,
|
scale_factor,
|
||||||
callbacks,
|
callbacks,
|
||||||
input_handler,
|
input_handler,
|
||||||
|
system_key_handled,
|
||||||
renderer,
|
renderer,
|
||||||
click_state,
|
click_state,
|
||||||
system_settings,
|
system_settings,
|
||||||
|
|
Loading…
Reference in a new issue