mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-31 05:40:04 -04:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user