mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-02 13:30:26 +01:00
36cbfbfb94
### Description Currently, there are some issues with input handling on Windows: #### 1. Direct crash when encountering IME input. https://github.com/zed-industries/zed/assets/14981363/598f7272-1948-4a42-99c5-2ef7b9162a1e #### 2. Handling messages every 1/60 seconds in the main thread. Despite being named "immediate_handle," it's not exactly immediate. ```rust // actually halt here let wait_result = unsafe { DCompositionWaitForCompositorClock(Some(&[self.inner.event]), INFINITE) }; // compositor clock ticked so we should draw a frame if wait_result == 1 { unsafe { invalidate_thread_windows(GetCurrentThreadId()) }; while unsafe { PeekMessageW(&mut msg, HWND::default(), 0, 0, PM_REMOVE) }.as_bool() ``` #### 3. According to Windows recommendations, character input should be obtained using `WM_CHAR` instead of `WM_KEYDOWN`. Additionally, there are problems with the handling within `WM_CHAR`. ```rust fn handle_char_msg(&self, wparam: WPARAM) -> LRESULT { let mut callbacks = self.callbacks.borrow_mut(); if let Some(callback) = callbacks.input.as_mut() { let modifiers = self.current_modifiers(); let msg_char = wparam.0 as u8 as char; // these are u16 chars, cant treat them as u8 ``` And, we don't handle `WM_SYSKEYDOWN` properly, which leads to `Alt + F4` not working. Release Notes: - N/A