windows: Implement keyboard_layout_change (#30624)

Part of #29144

Release Notes:

- N/A
This commit is contained in:
张小白 2025-05-13 18:02:56 +08:00 committed by GitHub
parent 7cad943fde
commit 9426caa061
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 33 additions and 4 deletions

View file

@ -93,6 +93,7 @@ pub(crate) fn handle_msg(
WM_IME_COMPOSITION => handle_ime_composition(handle, lparam, state_ptr),
WM_SETCURSOR => handle_set_cursor(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),
_ => None,
};
@ -1279,6 +1280,18 @@ fn handle_system_theme_changed(
Some(0)
}
fn handle_input_language_changed(
lparam: LPARAM,
state_ptr: Rc<WindowsWindowStatePtr>,
) -> Option<isize> {
let thread = state_ptr.main_thread_id_win32;
let validation = state_ptr.validation_number;
unsafe {
PostThreadMessageW(thread, WM_INPUTLANGCHANGE, WPARAM(validation), lparam).log_err();
}
Some(0)
}
fn parse_syskeydown_msg_keystroke(wparam: WPARAM) -> Option<Keystroke> {
let modifiers = current_modifiers();
let vk_code = wparam.loword();