plat/linux_ibus.rs (Linux)#
Source: lib/plat/linux_ibus.rs
linux_ibus -- input methods on X11: IBus (and fcitx5's IBus frontend) through the session
bus portal org.freedesktop.portal.IBus, on a thread of its own (linux_dbus.rs). Wayland has
its own path (text-input-v3, linux_wl_ime.rs).
ibus_focus(win, on, x, y, h) a text field of window win got (on: its caret at root x,
y, height h) or lost the keyboard focus: FocusIn +
SetCursorLocation / FocusOut; the input context is made on
the first focus
ibus_key(keyval, keycode, state) -> bool ProcessKeyEvent (keyval = X keysym, keycode =
evdev code, state = X modifier bits, IBUS_RELEASE 1 << 30
for a release): true = the input method took the key; its
result arrives as ime_commit_set / ime_preedit_set. false
without an input method or after 300 ms
ibus_available() -> bool jfgui_IME=0 turns it off
ibus_ready() -> bool the input context exists (keys go to it only then)
Signals of the context (only from the portal connection that made it): CommitText ->
ime_commit_text, UpdatePreeditText (cursor in
characters -> bytes) / HidePreeditText -> ime_preedit_set, ForwardKeyEvent -> E_TEXT or the
key's E_KEY_DOWN / E_KEY_UP. Capabilities: preedit text and focus (IBus draws its own
candidate window). Every result wakes the UI thread.
/// ProcessKeyEvent state bit of a key release
IBUS_RELEASE: u32 = 1 << 30
fn ibus_available() -> boolwhether an input method may be asked (a session bus, not turned off)fn ibus_ready() -> boolwhether the input context exists (before that keys are not sent)fn ibus_focus(win: u8, on: bool, x: i32, y: i32, h: i32)a text field got or lost the keyboard focusfn ibus_key(keyval: u32, keycode: u32, state: u32) -> boollet the input method see a key -> it took it