Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
windows: Avoid setting the mouse cursor while the window is disabled (#33230)
张小白28f56ad7ae3c
diff --git a/crates/gpui/src/platform/windows/events.rs b/crates/gpui/src/platform/windows/events.rsindex 027c6c4dac2..a390762ddda 100644--- a/crates/gpui/src/platform/windows/events.rs+++ b/crates/gpui/src/platform/windows/events.rs@@ -92,7 +92,7 @@ pub(crate) fn handle_msg(WM_DEADCHAR => handle_dead_char_msg(wparam, state_ptr),WM_IME_STARTCOMPOSITION => handle_ime_position(handle, state_ptr),WM_IME_COMPOSITION => handle_ime_composition(handle, lparam, state_ptr),- WM_SETCURSOR => handle_set_cursor(lparam, state_ptr),+ WM_SETCURSOR => handle_set_cursor(handle, lparam, state_ptr),WM_SETTINGCHANGE => handle_system_settings_changed(handle, lparam, state_ptr),WM_INPUTLANGCHANGE => handle_input_language_changed(lparam, state_ptr),WM_GPUI_CURSOR_STYLE_CHANGED => handle_cursor_changed(lparam, state_ptr),@@ -1108,11 +1108,24 @@ fn handle_cursor_changed(lparam: LPARAM, state_ptr: Rc<WindowsWindowStatePtr>) -Some(0)}-fn handle_set_cursor(lparam: LPARAM, state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> {- if matches!(- lparam.loword() as u32,- HTLEFT | HTRIGHT | HTTOP | HTTOPLEFT | HTTOPRIGHT | HTBOTTOM | HTBOTTOMLEFT | HTBOTTOMRIGHT- ) {+fn handle_set_cursor(+ handle: HWND,+ lparam: LPARAM,+ state_ptr: Rc<WindowsWindowStatePtr>,+) -> Option<isize> {+ if unsafe { !IsWindowEnabled(handle).as_bool() }+ || matches!(+ lparam.loword() as u32,+ HTLEFT+ | HTRIGHT+ | HTTOP+ | HTTOPLEFT+ | HTTOPRIGHT+ | HTBOTTOM+ | HTBOTTOMLEFT+ | HTBOTTOMRIGHT+ )+ {return None;}unsafe {