Skip to main content

tilo_presentation/
text_input.rs

1//! Optional original-field acknowledgements beside standard native IME delivery:
2//! no transcript, and no microphone or input ownership.
3use winit::window::Window;
4
5pub fn set_content_type(window: &Window, hint: u32, purpose: u32) {
6    #[cfg(target_os = "linux")]
7    {
8        use winit::platform::wayland::WindowExtWayland;
9        window.set_ime_content_type(Some(winit::platform::wayland::ImeContentType {
10            hint,
11            purpose,
12        }));
13    }
14    #[cfg(not(target_os = "linux"))]
15    let _ = (window, hint, purpose);
16}
17
18pub fn publish(window: &Window, snapshot: Option<[u8; 32]>) -> bool {
19    #[cfg(target_os = "linux")]
20    {
21        use winit::platform::wayland::WindowExtWayland;
22        window.private_text_input(snapshot)
23    }
24    #[cfg(not(target_os = "linux"))]
25    {
26        let _ = (window, snapshot);
27        false
28    }
29}
30
31pub fn acknowledge(window: &Window, serial: u32, outcome: u32) {
32    #[cfg(target_os = "linux")]
33    {
34        use winit::platform::wayland::WindowExtWayland;
35        window.acknowledge_private_text_input(serial, outcome);
36    }
37    #[cfg(not(target_os = "linux"))]
38    let _ = (window, serial, outcome);
39}