Struct xcb_imdkit::ImeClient [−][src]
pub struct ImeClient { /* fields omitted */ }Expand description
Input Method Editor (IME) client.
ImeClient represents one instance of an Input Method Editor client. It provides callbacks for
event handling as well as control over the position of the IME window. There should be only one
IME client per application and it is advised to create at most one instance.
Implementations
Set the global logger for xcb-imdkit.
The callback will receive debug messages from the C library this crate is wrapping.
pub fn new(
conn: Arc<Connection>,
screen_id: i32,
input_style: InputStyle,
im_name: Option<&str>
) -> Pin<Box<Self>>
pub fn new(
conn: Arc<Connection>,
screen_id: i32,
input_style: InputStyle,
im_name: Option<&str>
) -> Pin<Box<Self>>
Create a new ImeClient.
The first two arguments correspond to the result of xcb::Connection::connect with the
connection wrapped into an Arc to ensure that the Ime does not outlive its
connection.
For documentation on input_style refer to InputStyle.
im_name can be used to specify a custom IME server to connect to using the syntax
@im=custom_server.
pub unsafe fn unsafe_new(
conn: &Connection,
screen_id: i32,
input_style: InputStyle,
im_name: Option<&str>
) -> Pin<Box<Self>>
pub unsafe fn unsafe_new(
conn: &Connection,
screen_id: i32,
input_style: InputStyle,
im_name: Option<&str>
) -> Pin<Box<Self>>
Let the IME client process XCB’s events.
Return true if the IME client is handling the event and false if the event is ignored
by the IME client and has to be handled separately.
This method should be called on any event from the event queue and not just keypress/keyrelease events as it handles other events as well.
Typically you will want to let the IME client handle all keypress/keyrelease events in your
main loop. The IME client will then forward all key events that were not used for input
composition to the callback set by set_forward_event_cb. Often those events include all
keyrelease events as well as the events for ESC, Enter or key combinations such as
CTRL+C.
To obtain the text currently typed into the IME and the final string consult
set_preedit_draw_cb and set_commit_string_cb.
Set the position at which to place the IME window.
Set the position of the IME window relative to the window specified by win. Coordinates
increase from the top left corner of the window.
Return true if an update for the IME window position has been sent to the IME, false if
the update has been queued. If there is still an update request queued and this method is
called, the previously queued request is discarded in favor of the new one.
pub fn set_commit_string_cb<F>(&mut self, f: F) where
F: for<'a> FnMut(u32, &'a str) + 'static,
pub fn set_commit_string_cb<F>(&mut self, f: F) where
F: for<'a> FnMut(u32, &'a str) + 'static,
Set callback to be called once input composition is done.
The window (set by update_pos) as well as the completed input are passed as arguments.
pub fn set_forward_event_cb<F>(&mut self, f: F) where
F: for<'a> FnMut(u32, &'a KeyPressEvent) + 'static,
pub fn set_forward_event_cb<F>(&mut self, f: F) where
F: for<'a> FnMut(u32, &'a KeyPressEvent) + 'static,
Often those events include all keyrelease events as well as the events for ESC, Enter
or key combinations such as CTRL+C. Please note that xcb::KeyPressEvent ==
xcb::KeyReleaseEvent (see xcb::ffi::xcb_key_release_event_t) and keyrelease events
are also supplied.
Callback called once the IME has been opened.
The current window (set by update_pos) is supplied as argument.
Calls callback only if InputStyle::PREEDIT_CALLBACKS is set.
pub fn set_preedit_draw_cb<F>(&mut self, f: F) where
F: for<'a> FnMut(u32, PreeditInfo<'a>) + 'static,
pub fn set_preedit_draw_cb<F>(&mut self, f: F) where
F: for<'a> FnMut(u32, PreeditInfo<'a>) + 'static,
Callback called whenever the text whitin the IME has changed.
The current window (set by update_pos) is supplied as argument as well as
PreeditInfo, which contains, among other things, the current text of the IME.
Calls callback only if InputStyle::PREEDIT_CALLBACKS is set.
Callback called once the IME has been closed.
The current window (set by update_pos) is supplied as argument.
Calls callback only if InputStyle::PREEDIT_CALLBACKS is set.