Skip to main content

IBusEngine

Trait IBusEngine 

Source
pub trait IBusEngine: Send + Sync {
    // Provided methods
    fn process_key_event(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
        _keyval: Keysym,
        _keycode: KeyCode,
        _state: IBusModifierState,
    ) -> impl Future<Output = Result<bool>> + Send { ... }
    fn set_cursor_location(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
        _x: i32,
        _y: i32,
        _w: i32,
        _h: i32,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn focus_in(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn focus_out(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn reset(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn enable(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn disable(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn candidate_clicked(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
        _index: u32,
        _button: u32,
        _state: u32,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn page_up(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn page_down(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn cursor_up(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn cursor_down(
        &mut self,
        _se: SignalEmitter<'_>,
        _server: &ObjectServer,
    ) -> impl Future<Output = Result<()>> + Send { ... }
}
Expand description

Implement this trait to implement an input method.

Your implementation can use the methods of the IBusEngineBackend to display text to the user.

Provided Methods§

Source

fn process_key_event( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, _keyval: Keysym, _keycode: KeyCode, _state: IBusModifierState, ) -> impl Future<Output = Result<bool>> + Send

A key was pressed or released.

keyval encodes the symbol of the key interpreted according to the current keyboard layout.

keycode encodes the position of the key on the keyboard, which is independent of the keyboard layout.

state encodes wether the key was pressed or released, and modifiers (shift, control…).

Note that when shift+a is pressed, keyval will be Keysym::A (instead of Keysym::a). state.shift() will still be true. Same applies for AltGr in keyboard layouts which have it.

Source

fn set_cursor_location( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, _x: i32, _y: i32, _w: i32, _h: i32, ) -> impl Future<Output = Result<()>> + Send

设置光标位置

Source

fn focus_in( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, ) -> impl Future<Output = Result<()>> + Send

获得焦点

Source

fn focus_out( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, ) -> impl Future<Output = Result<()>> + Send

失去焦点

Source

fn reset( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, ) -> impl Future<Output = Result<()>> + Send

重置

Source

fn enable( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, ) -> impl Future<Output = Result<()>> + Send

启用

Source

fn disable( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, ) -> impl Future<Output = Result<()>> + Send

禁用

Source

fn candidate_clicked( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, _index: u32, _button: u32, _state: u32, ) -> impl Future<Output = Result<()>> + Send

(UI) Emitted when a candidate on a lookup table is clicked

_index is the 0-based index of the clicked candiate in the current page, not in the full lookup table

Source

fn page_up( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, ) -> impl Future<Output = Result<()>> + Send

(UI) Emitted when the “previous page” button is clicked on a lookup table

Source

fn page_down( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, ) -> impl Future<Output = Result<()>> + Send

(UI) Emitted when the “next page” button is clicked on a lookup table

Source

fn cursor_up( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, ) -> impl Future<Output = Result<()>> + Send

(UI) Emmitted when the user scrolls up (with the mouse wheel) on a lookup table

Source

fn cursor_down( &mut self, _se: SignalEmitter<'_>, _server: &ObjectServer, ) -> impl Future<Output = Result<()>> + Send

(UI) Emmitted when the user scrolls down (with the mouse wheel) on a lookup table

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§