1 | /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ |
2 | /* vim:set et sts=4: */ |
3 | /* ibus - The Input Bus |
4 | * Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com> |
5 | * Copyright (C) 2008-2015 Red Hat, Inc. |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Lesser General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2.1 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Lesser General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Lesser General Public |
18 | * License along with this library; if not, write to the Free Software |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
20 | * USA |
21 | */ |
22 | |
23 | #if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION) |
24 | #error "Only <ibus.h> can be included directly" |
25 | #endif |
26 | |
27 | #ifndef __IBUS_TYPES_H_ |
28 | #define __IBUS_TYPES_H_ |
29 | |
30 | /** |
31 | * SECTION: ibustypes |
32 | * @short_description: Generic types for IBus. |
33 | * @stability: Stable |
34 | * |
35 | * This section consists generic types for IBus, including shift/control key |
36 | * modifiers, |
37 | * and a rectangle structure. |
38 | */ |
39 | |
40 | /** |
41 | * IBusModifierType: |
42 | * @IBUS_SHIFT_MASK: Shift is activated. |
43 | * @IBUS_LOCK_MASK: Cap Lock is locked. |
44 | * @IBUS_CONTROL_MASK: Control key is activated. |
45 | * @IBUS_MOD1_MASK: Modifier 1 (Usually Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)) activated. |
46 | * @IBUS_MOD2_MASK: Modifier 2 (Usually Num_Lock (0x4d)) activated. |
47 | * @IBUS_MOD3_MASK: Modifier 3 activated. |
48 | * @IBUS_MOD4_MASK: Modifier 4 (Usually Super_L (0xce), Hyper_L (0xcf)) activated. |
49 | * @IBUS_MOD5_MASK: Modifier 5 (ISO_Level3_Shift (0x5c), Mode_switch (0xcb)) activated. |
50 | * @IBUS_BUTTON1_MASK: Mouse button 1 (left) is activated. |
51 | * @IBUS_BUTTON2_MASK: Mouse button 2 (middle) is activated. |
52 | * @IBUS_BUTTON3_MASK: Mouse button 3 (right) is activated. |
53 | * @IBUS_BUTTON4_MASK: Mouse button 4 (scroll up) is activated. |
54 | * @IBUS_BUTTON5_MASK: Mouse button 5 (scroll down) is activated. |
55 | * @IBUS_HANDLED_MASK: Handled mask indicates the event has been handled by ibus. |
56 | * @IBUS_FORWARD_MASK: Forward mask indicates the event has been forward from ibus. |
57 | * @IBUS_IGNORED_MASK: It is an alias of IBUS_FORWARD_MASK. |
58 | * @IBUS_SUPER_MASK: Super (Usually Win) key is activated. |
59 | * @IBUS_HYPER_MASK: Hyper key is activated. |
60 | * @IBUS_META_MASK: Meta key is activated. |
61 | * @IBUS_RELEASE_MASK: Key is released. |
62 | * @IBUS_MODIFIER_MASK: Modifier mask for the all the masks above. |
63 | * |
64 | * Handles key modifier such as control, shift and alt and release event. |
65 | * Note that nits 15 - 25 are currently unused, while bit 29 is used internally. |
66 | */ |
67 | typedef enum |
68 | { |
69 | IBUS_SHIFT_MASK = 1 << 0, |
70 | IBUS_LOCK_MASK = 1 << 1, |
71 | IBUS_CONTROL_MASK = 1 << 2, |
72 | IBUS_MOD1_MASK = 1 << 3, |
73 | IBUS_MOD2_MASK = 1 << 4, |
74 | IBUS_MOD3_MASK = 1 << 5, |
75 | IBUS_MOD4_MASK = 1 << 6, |
76 | IBUS_MOD5_MASK = 1 << 7, |
77 | IBUS_BUTTON1_MASK = 1 << 8, |
78 | IBUS_BUTTON2_MASK = 1 << 9, |
79 | IBUS_BUTTON3_MASK = 1 << 10, |
80 | IBUS_BUTTON4_MASK = 1 << 11, |
81 | IBUS_BUTTON5_MASK = 1 << 12, |
82 | |
83 | /* The next few modifiers are used by XKB, so we skip to the end. |
84 | * Bits 15 - 23 are currently unused. Bit 29 is used internally. |
85 | */ |
86 | |
87 | /* ibus mask */ |
88 | IBUS_HANDLED_MASK = 1 << 24, |
89 | IBUS_FORWARD_MASK = 1 << 25, |
90 | IBUS_IGNORED_MASK = IBUS_FORWARD_MASK, |
91 | |
92 | IBUS_SUPER_MASK = 1 << 26, |
93 | IBUS_HYPER_MASK = 1 << 27, |
94 | IBUS_META_MASK = 1 << 28, |
95 | |
96 | IBUS_RELEASE_MASK = 1 << 30, |
97 | |
98 | IBUS_MODIFIER_MASK = 0x5f001fff |
99 | } IBusModifierType; |
100 | |
101 | /** |
102 | * IBusCapabilite: |
103 | * @IBUS_CAP_PREEDIT_TEXT: UI is capable to show pre-edit text. |
104 | * @IBUS_CAP_AUXILIARY_TEXT: UI is capable to show auxiliary text. |
105 | * @IBUS_CAP_LOOKUP_TABLE: UI is capable to show the lookup table. |
106 | * @IBUS_CAP_FOCUS: UI is capable to get focus. |
107 | * @IBUS_CAP_PROPERTY: UI is capable to have property. |
108 | * @IBUS_CAP_SURROUNDING_TEXT: Client can provide surround text, |
109 | * or IME can handle surround text. |
110 | * |
111 | * Capability flags of UI. |
112 | */ |
113 | typedef enum { |
114 | IBUS_CAP_PREEDIT_TEXT = 1 << 0, |
115 | IBUS_CAP_AUXILIARY_TEXT = 1 << 1, |
116 | IBUS_CAP_LOOKUP_TABLE = 1 << 2, |
117 | IBUS_CAP_FOCUS = 1 << 3, |
118 | IBUS_CAP_PROPERTY = 1 << 4, |
119 | IBUS_CAP_SURROUNDING_TEXT = 1 << 5, |
120 | } IBusCapabilite; |
121 | |
122 | /** |
123 | * IBusPreeditFocusMode: |
124 | * @IBUS_ENGINE_PREEDIT_CLEAR: pre-edit text is cleared. |
125 | * @IBUS_ENGINE_PREEDIT_COMMIT: pre-edit text is committed. |
126 | * |
127 | * Pre-edit commit mode when the focus is lost. |
128 | */ |
129 | typedef enum { |
130 | IBUS_ENGINE_PREEDIT_CLEAR = 0, |
131 | IBUS_ENGINE_PREEDIT_COMMIT = 1, |
132 | } IBusPreeditFocusMode; |
133 | |
134 | /** |
135 | * IBusOrientation: |
136 | * @IBUS_ORIENTATION_HORIZONTAL: Horizontal orientation. |
137 | * @IBUS_ORIENTATION_VERTICAL: Vertival orientation. |
138 | * @IBUS_ORIENTATION_SYSTEM: Use ibus global orientation setup. |
139 | * |
140 | * Orientation of UI. |
141 | */ |
142 | typedef enum { |
143 | IBUS_ORIENTATION_HORIZONTAL = 0, |
144 | IBUS_ORIENTATION_VERTICAL = 1, |
145 | IBUS_ORIENTATION_SYSTEM = 2, |
146 | } IBusOrientation; |
147 | |
148 | /** |
149 | * IBusBusNameFlag: |
150 | * @IBUS_BUS_NAME_FLAG_ALLOW_REPLACEMENT: |
151 | * same as DBUS_NAME_FLAG_ALLOW_REPLACEMENT |
152 | * @IBUS_BUS_NAME_FLAG_REPLACE_EXISTING: |
153 | * same as DBUS_NAME_FLAG_REPLACE_EXISTING |
154 | * @IBUS_BUS_NAME_FLAG_DO_NOT_QUEUE: |
155 | * same as DBUS_NAME_FLAG_DO_NOT_QUEUE |
156 | */ |
157 | typedef enum { |
158 | IBUS_BUS_NAME_FLAG_ALLOW_REPLACEMENT = (1 << 0), |
159 | IBUS_BUS_NAME_FLAG_REPLACE_EXISTING = (1 << 1), |
160 | IBUS_BUS_NAME_FLAG_DO_NOT_QUEUE = (1 << 2), |
161 | } IBusBusNameFlag; |
162 | |
163 | /** |
164 | * IBusBusRequestNameReply: |
165 | * @IBUS_BUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: |
166 | * same as DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER |
167 | * @IBUS_BUS_REQUEST_NAME_REPLY_IN_QUEUE: |
168 | * same as DBUS_REQUEST_NAME_REPLY_IN_QUEUE |
169 | * @IBUS_BUS_REQUEST_NAME_REPLY_EXISTS: |
170 | * same as DBUS_REQUEST_NAME_REPLY_EXISTS |
171 | * @IBUS_BUS_REQUEST_NAME_REPLY_ALREADY_OWNER: |
172 | * same as DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER |
173 | */ |
174 | typedef enum { |
175 | IBUS_BUS_REQUEST_NAME_REPLY_PRIMARY_OWNER = 1, |
176 | IBUS_BUS_REQUEST_NAME_REPLY_IN_QUEUE = 2, |
177 | IBUS_BUS_REQUEST_NAME_REPLY_EXISTS = 3, |
178 | IBUS_BUS_REQUEST_NAME_REPLY_ALREADY_OWNER = 4, |
179 | } IBusBusRequestNameReply; |
180 | |
181 | /** |
182 | * IBusBusStartServiceByNameReply: |
183 | * @IBUS_BUS_START_REPLY_SUCCESS: |
184 | * same as DBUS_START_REPLY_SUCCESS |
185 | * @IBUS_BUS_START_REPLY_ALREADY_RUNNING: |
186 | * same as DBUS_START_REPLY_ALREADY_RUNNING |
187 | */ |
188 | typedef enum { |
189 | IBUS_BUS_START_REPLY_SUCCESS = 1, |
190 | IBUS_BUS_START_REPLY_ALREADY_RUNNING = 2, |
191 | } IBusBusStartServiceByNameReply; |
192 | |
193 | /** |
194 | * IBusError: |
195 | * @IBUS_ERROR_NO_ENGINE: |
196 | * There is no engine associated with input context. |
197 | * @IBUS_ERROR_NO_CONFIG: |
198 | * There is no config module running. |
199 | * @IBUS_ERROR_FAILED: |
200 | * General failure. |
201 | */ |
202 | typedef enum { |
203 | IBUS_ERROR_NO_ENGINE, |
204 | IBUS_ERROR_NO_CONFIG, |
205 | IBUS_ERROR_FAILED |
206 | } IBusError; |
207 | |
208 | /** |
209 | * IBusRectangle: |
210 | * @x: x coordinate. |
211 | * @y: y coordinate. |
212 | * @width: width of the rectangle. |
213 | * @height: height of the renctangl. |
214 | * |
215 | * Rectangle definition. |
216 | */ |
217 | typedef struct _IBusRectangle IBusRectangle; |
218 | struct _IBusRectangle { |
219 | gint x; |
220 | gint y; |
221 | gint width; |
222 | gint height; |
223 | }; |
224 | |
225 | /** |
226 | * IBusFreeFunc: |
227 | * @object: object to be freed. |
228 | * |
229 | * Free function prototype. |
230 | */ |
231 | typedef void (* IBusFreeFunc) (gpointer object); |
232 | |
233 | /** |
234 | * IBusInputPurpose: |
235 | * @IBUS_INPUT_PURPOSE_FREE_FORM: Allow any character |
236 | * @IBUS_INPUT_PURPOSE_ALPHA: Allow only alphabetic characters |
237 | * @IBUS_INPUT_PURPOSE_DIGITS: Allow only digits |
238 | * @IBUS_INPUT_PURPOSE_NUMBER: Edited field expects numbers |
239 | * @IBUS_INPUT_PURPOSE_PHONE: Edited field expects phone number |
240 | * @IBUS_INPUT_PURPOSE_URL: Edited field expects URL |
241 | * @IBUS_INPUT_PURPOSE_EMAIL: Edited field expects email address |
242 | * @IBUS_INPUT_PURPOSE_NAME: Edited field expects the name of a person |
243 | * @IBUS_INPUT_PURPOSE_PASSWORD: Like @IBUS_INPUT_PURPOSE_FREE_FORM, |
244 | * but characters are hidden |
245 | * @IBUS_INPUT_PURPOSE_PIN: Like @IBUS_INPUT_PURPOSE_DIGITS, but |
246 | * characters are hidden |
247 | * |
248 | * Describes primary purpose of the input context. This information |
249 | * is particularly useful to implement intelligent behavior in |
250 | * engines, such as automatic input-mode switch and text prediction. |
251 | * |
252 | * This enumeration may be extended in the future; engines should |
253 | * interpret unknown values as 'free form'. |
254 | */ |
255 | typedef enum |
256 | { |
257 | IBUS_INPUT_PURPOSE_FREE_FORM, |
258 | IBUS_INPUT_PURPOSE_ALPHA, |
259 | IBUS_INPUT_PURPOSE_DIGITS, |
260 | IBUS_INPUT_PURPOSE_NUMBER, |
261 | IBUS_INPUT_PURPOSE_PHONE, |
262 | IBUS_INPUT_PURPOSE_URL, |
263 | IBUS_INPUT_PURPOSE_EMAIL, |
264 | IBUS_INPUT_PURPOSE_NAME, |
265 | IBUS_INPUT_PURPOSE_PASSWORD, |
266 | IBUS_INPUT_PURPOSE_PIN |
267 | } IBusInputPurpose; |
268 | |
269 | /** |
270 | * IBusInputHints: |
271 | * @IBUS_INPUT_HINT_NONE: No special behaviour suggested |
272 | * @IBUS_INPUT_HINT_SPELLCHECK: Suggest checking for typos |
273 | * @IBUS_INPUT_HINT_NO_SPELLCHECK: Suggest not checking for typos |
274 | * @IBUS_INPUT_HINT_WORD_COMPLETION: Suggest word completion |
275 | * @IBUS_INPUT_HINT_LOWERCASE: Suggest to convert all text to lowercase |
276 | * @IBUS_INPUT_HINT_UPPERCASE_CHARS: Suggest to capitalize all text |
277 | * @IBUS_INPUT_HINT_UPPERCASE_WORDS: Suggest to capitalize the first |
278 | * character of each word |
279 | * @IBUS_INPUT_HINT_UPPERCASE_SENTENCES: Suggest to capitalize the |
280 | * first word of each sentence |
281 | * @IBUS_INPUT_HINT_INHIBIT_OSK: Suggest to not show an onscreen keyboard |
282 | * (e.g for a calculator that already has all the keys). |
283 | * @IBUS_INPUT_HINT_VERTICAL_WRITING: The text is vertical. |
284 | * |
285 | * Describes hints that might be taken into account by engines. Note |
286 | * that engines may already tailor their behaviour according to the |
287 | * #IBusInputPurpose of the entry. |
288 | */ |
289 | typedef enum |
290 | { |
291 | IBUS_INPUT_HINT_NONE = 0, |
292 | IBUS_INPUT_HINT_SPELLCHECK = 1 << 0, |
293 | IBUS_INPUT_HINT_NO_SPELLCHECK = 1 << 1, |
294 | IBUS_INPUT_HINT_WORD_COMPLETION = 1 << 2, |
295 | IBUS_INPUT_HINT_LOWERCASE = 1 << 3, |
296 | IBUS_INPUT_HINT_UPPERCASE_CHARS = 1 << 4, |
297 | IBUS_INPUT_HINT_UPPERCASE_WORDS = 1 << 5, |
298 | IBUS_INPUT_HINT_UPPERCASE_SENTENCES = 1 << 6, |
299 | IBUS_INPUT_HINT_INHIBIT_OSK = 1 << 7, |
300 | IBUS_INPUT_HINT_VERTICAL_WRITING = 1 << 8 |
301 | } IBusInputHints; |
302 | |
303 | #endif |
304 | |
305 | |