JFLib

plat/ime.rs#

Source: lib/plat/ime.rs

  • struct Preedit

    • text: String
    • cursor: usize
  • fn ime_commit_set(win:u8,text:&str) -> bool One composition commit is one event, avoiding truncation by the character ring.

  • fn ime_commit_text(win:u8,text:&str) -> usize Committed text of any length: commits of at most 4096 bytes, split between characters -> the bytes taken (queued now, or waiting until the app took the commits before them; fewer only past PENDING_MAX waiting bytes or for a window number out of range).

(E4) what the text being typed is (ime_purpose): the input method and an on-screen

// keyboard choose their mode by it
IP_TEXT: u32 = 0
IP_URL: u32 = 1
IP_EMAIL: u32 = 2
IP_NUMBER: u32 = 3
IP_PHONE: u32 = 4
/// no input method (Windows: the window's input context is taken away; X11: no IBus; Wayland:
/// the password purpose); ui's TB_PASSWORD boxes set it themselves
IP_PASSWORD: u32 = 5
IP_SEARCH: u32 = 6
  • fn ime_inline(on: bool) (E4) the app draws the composition (ime_preedit) at its caret itself: Windows hides the input method's own composition window (its candidates stay; WM_IME_SETCONTEXT without ISC_SHOWUICOMPOSITIONWINDOW, sent again to the window with the keyboard on a change). IBus and Wayland's text input have no window of their own for it: nothing changes there

  • fn ime_inline_on() -> bool (E4) ime_inline's state

  • fn ime_purpose(p: u32) (E4) the purpose of the text being typed (IP_*): Windows takes the input method away for IP_PASSWORD and gives it back for the others (also when a window gets the keyboard); X11 keeps the keys of an IP_PASSWORD field from IBus; Wayland's text input gets it as its content purpose (again when it changes while enabled); elsewhere it is only kept (ime_purpose_of). ui's TB_PASSWORD boxes set IP_PASSWORD themselves while they have the keyboard

  • fn ime_purpose_of() -> u32 (E4) ime_purpose's value

  • fn ime_commit_take(token:u32) -> Option<String>

  • fn ime_preedit(win: u8) -> Preedit

  • fn ime_preedit_set(win: u8, text: &str, cursor: usize) Publish valid UTF-8 and a byte caret; invalid/oversized updates clear composition.

Source: docs/API.md in the JFLib repository.