winit-core/window: add Window::request_ime_update

Allow updating IME state atomically to make it easier for platforms
where it's atomic by its nature, like Wayland. The old API is marked
as deprecated and is routed to the new atomic API.

Co-authored-by: dcz <gilapfco.dcz@porcupinefactory.org>
This commit is contained in:
DorotaC
2025-06-28 06:14:20 +02:00
committed by GitHub
parent fa0795a50c
commit 08907148ec
19 changed files with 866 additions and 222 deletions

View File

@@ -1416,7 +1416,7 @@ unsafe fn public_window_callback_inner(
},
WM_IME_STARTCOMPOSITION => {
let ime_allowed = userdata.window_state_lock().ime_allowed;
let ime_allowed = userdata.window_state_lock().ime_capabilities.is_some();
if ime_allowed {
userdata.window_state_lock().ime_state = ImeState::Enabled;
@@ -1429,7 +1429,7 @@ unsafe fn public_window_callback_inner(
WM_IME_COMPOSITION => {
let ime_allowed_and_composing = {
let w = userdata.window_state_lock();
w.ime_allowed && w.ime_state != ImeState::Disabled
w.ime_capabilities.is_some() && w.ime_state != ImeState::Disabled
};
// Windows Hangul IME sends WM_IME_COMPOSITION after WM_IME_ENDCOMPOSITION, so
// check whether composing.
@@ -1480,7 +1480,7 @@ unsafe fn public_window_callback_inner(
WM_IME_ENDCOMPOSITION => {
let ime_allowed_or_composing = {
let w = userdata.window_state_lock();
w.ime_allowed || w.ime_state != ImeState::Disabled
w.ime_capabilities.is_some() || w.ime_state != ImeState::Disabled
};
if ime_allowed_or_composing {
if userdata.window_state_lock().ime_state == ImeState::Preedit {