fcitx5_dbus/
input_context.rs1use crate::utils::{
5 key_event::{KeyState, KeyVal},
6 CapabilityFlag,
7};
8use zbus::proxy;
9
10#[proxy(
11 interface = "org.fcitx.Fcitx.InputContext1",
12 default_service = "org.fcitx.Fcitx5",
13 default_path = "/org/freedesktop/portal/inputcontext/1"
14)]
15pub trait InputContext {
16 #[zbus(name = "DestroyIC")]
18 fn destroy_ic(&self) -> zbus::Result<()>;
19
20 fn focus_in(&self) -> zbus::Result<()>;
22
23 fn focus_out(&self) -> zbus::Result<()>;
25
26 fn hide_virtual_keyboard(&self) -> zbus::Result<()>;
28
29 fn invoke_action(&self, action: u32, cursor: i32) -> zbus::Result<()>;
31
32 fn is_virtual_keyboard_visible(&self) -> zbus::Result<bool>;
34
35 fn next_page(&self) -> zbus::Result<()>;
37
38 fn prev_page(&self) -> zbus::Result<()>;
40
41 fn process_key_event(
43 &self,
44 key_val: KeyVal,
45 key_code: u32,
46 key_state: KeyState,
47 is_release: bool,
48 time: u32,
49 ) -> zbus::Result<bool>;
50
51 #[allow(clippy::too_many_arguments)]
53 fn process_key_event_batch(
54 &self,
55 key_val: u32,
56 key_code: u32,
57 key_state: u32,
58 is_release: bool,
59 time: u32,
60 ) -> zbus::Result<(Vec<(u32, zbus::zvariant::OwnedValue)>, bool)>;
61
62 fn reset(&self) -> zbus::Result<()>;
64
65 fn select_candidate(&self, idx: i32) -> zbus::Result<()>;
67
68 fn set_capability(&self, cap: CapabilityFlag) -> zbus::Result<()>;
70
71 fn set_cursor_rect(&self, x: i32, y: i32, w: i32, h: i32) -> zbus::Result<()>;
73
74 fn set_cursor_rect_v2(&self, x: i32, y: i32, w: i32, h: i32, scale: i32) -> zbus::Result<()>;
76
77 fn set_supported_capability(&self, cap: CapabilityFlag) -> zbus::Result<()>;
79
80 fn set_surrounding_text(&self, text: &str, cursor: u32, anchor: u32) -> zbus::Result<()>;
82
83 fn set_surrounding_text_position(&self, cursor: u32, anchor: u32) -> zbus::Result<()>;
85
86 fn show_virtual_keyboard(&self) -> zbus::Result<()>;
88
89 #[zbus(signal)]
91 fn commit_string(&self, text: &str) -> zbus::Result<()>;
92
93 #[zbus(signal, name = "CurrentIM")]
95 fn current_im(&self, name: &str, unique_name: &str, language_code: &str) -> zbus::Result<()>;
96
97 #[zbus(signal)]
99 fn delete_surrounding_text(&self, offset: i32, size: u32) -> zbus::Result<()>;
100
101 #[zbus(signal)]
103 fn forward_key(&self, sym: u32, states: u32, is_release: bool) -> zbus::Result<()>;
104
105 #[zbus(signal)]
107 fn notify_focus_out(&self) -> zbus::Result<()>;
108
109 #[zbus(signal, name = "UpdateClientSideUI")]
111 fn update_client_side_ui(
112 &self,
113 preedit_strs: Vec<(&str, i32)>,
114 preedit_cursor: i32,
115 aux_up_strs: Vec<(&str, i32)>,
116 aux_down_strs: Vec<(&str, i32)>,
117 candidates: Vec<(&str, &str)>,
118 cursor_idx: i32,
119 layout_hint: i32,
120 has_prev: bool,
121 has_next: bool,
122 ) -> zbus::Result<()>;
123
124 #[zbus(signal)]
126 fn update_formatted_preedit(
127 &self,
128 strs: Vec<(&str, i32)>,
129 preedit_cursor: i32,
130 ) -> zbus::Result<()>;
131
132 #[zbus(signal)]
134 fn virtual_keyboard_visibility_changed(&self, is_changed: bool) -> zbus::Result<()>;
135}