1#![allow(non_camel_case_types)]
2#![cfg_attr(rustfmt, rustfmt_skip)]
3
4use std::ffi::c_void;
5
6use dlib::dlopen_external_library;
7use once_cell::sync::Lazy;
8
9pub type gint8 = ::std::os::raw::c_schar;
10pub type guint8 = ::std::os::raw::c_uchar;
11pub type guint16 = ::std::os::raw::c_ushort;
12pub type gint32 = ::std::os::raw::c_int;
13pub type guint32 = ::std::os::raw::c_uint;
14pub type gsize = ::std::os::raw::c_ulong;
15pub type gchar = ::std::os::raw::c_char;
16pub type glong = ::std::os::raw::c_long;
17pub type gint = ::std::os::raw::c_int;
18pub type gboolean = gint;
19pub type gulong = ::std::os::raw::c_ulong;
20pub type guint = ::std::os::raw::c_uint;
21pub type gdouble = f64;
22pub type gpointer = *mut ::std::os::raw::c_void;
23pub type GQuark = guint32;
24pub type GType = gsize;
25
26pub const IBUS_CAP_PREEDIT_TEXT: guint32 = 1 << 0;
27pub const IBUS_CAP_AUXILIARY_TEXT: guint32 = 1 << 1;
28pub const IBUS_CAP_LOOKUP_TABLE: guint32 = 1 << 2;
29pub const IBUS_CAP_FOCUS: guint32 = 1 << 3;
30pub const IBUS_CAP_PROPERTY: guint32 = 1 << 4;
31pub const IBUS_CAP_SURROUNDING_TEXT: guint32 = 1 << 5;
32
33pub const IBUS_SHIFT_MASK: guint32 = 1 << 0;
34pub const IBUS_LOCK_MASK: guint32 = 1 << 1;
35pub const IBUS_CONTROL_MASK: guint32 = 1 << 2;
36pub const IBUS_MOD1_MASK: guint32 = 1 << 3;
37pub const IBUS_MOD2_MASK: guint32 = 1 << 4;
38pub const IBUS_MOD3_MASK: guint32 = 1 << 5;
39pub const IBUS_MOD4_MASK: guint32 = 1 << 6;
40pub const IBUS_MOD5_MASK: guint32 = 1 << 7;
41pub const IBUS_BUTTON1_MASK: guint32 = 1 << 8;
42pub const IBUS_BUTTON2_MASK: guint32 = 1 << 9;
43pub const IBUS_BUTTON3_MASK: guint32 = 1 << 10;
44pub const IBUS_BUTTON4_MASK: guint32 = 1 << 11;
45pub const IBUS_BUTTON5_MASK: guint32 = 1 << 12;
46pub const IBUS_HANDLED_MASK: guint32 = 1 << 24;
47pub const IBUS_FORWARD_MASK: guint32 = 1 << 25;
48pub const IBUS_IGNORED_MASK: guint32 = IBUS_FORWARD_MASK;
49pub const IBUS_SUPER_MASK: guint32 = 1 << 26;
50pub const IBUS_HYPER_MASK: guint32 = 1 << 27;
51pub const IBUS_META_MASK: guint32 = 1 << 28;
52pub const IBUS_RELEASE_MASK: guint32 = 1 << 30;
53pub const IBUS_MODIFIER_MASK: guint32 = 0x5f001ff;
54
55#[doc = " gunichar:"]
56#[doc = ""]
57#[doc = " A type which can hold any UTF-32 or UCS-4 character code,"]
58#[doc = " also known as a Unicode code point."]
59#[doc = ""]
60#[doc = " If you want to produce the UTF-8 representation of a #gunichar,"]
61#[doc = " use g_ucs4_to_utf8(). See also g_utf8_to_ucs4() for the reverse"]
62#[doc = " process."]
63#[doc = ""]
64#[doc = " To print/scan values of this type as integer, use"]
65#[doc = " %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT."]
66#[doc = ""]
67#[doc = " The notation to express a Unicode code point in running text is"]
68#[doc = " as a hexadecimal number with four to six digits and uppercase"]
69#[doc = " letters, prefixed by the string \"U+\". Leading zeros are omitted,"]
70#[doc = " unless the code point would have fewer than four hexadecimal digits."]
71#[doc = " For example, \"U+0041 LATIN CAPITAL LETTER A\". To print a code point"]
72#[doc = " in the U+-notation, use the format string \"U+\\%04\"G_GINT32_FORMAT\"X\"."]
73#[doc = " To scan, use the format string \"U+\\%06\"G_GINT32_FORMAT\"X\"."]
74#[doc = ""]
75#[doc = " ```"]
76#[doc = " gunichar c;"]
77#[doc = " sscanf (\"U+0041\", \"U+%06\"G_GINT32_FORMAT\"X\", &c)"]
78#[doc = " g_print (\"Read U+%04\"G_GINT32_FORMAT\"X\", c);"]
79#[doc = " ```"]
80pub type gunichar = guint32;
81
82#[repr(C)]
83#[derive(Debug, Copy, Clone)]
84pub struct GList {
85 pub data: gpointer,
86 pub next: *mut GList,
87 pub prev: *mut GList,
88}
89
90#[doc = " IBusBus:"]
91#[doc = ""]
92#[doc = " An opaque data type representing IBus bus (daemon communication) status."]
93#[repr(C)]
94#[repr(align(8))]
95#[derive(Debug, Copy, Clone)]
96pub struct IBusBus {
97 pub _bindgen_opaque_blob: [u64; 6usize],
98}
99
100#[doc = " IBusInputContext:"]
101#[doc = ""]
102#[doc = " An opaque data type representing an IBusInputContext."]
103#[repr(C)]
104#[repr(align(8))]
105#[derive(Debug, Copy, Clone)]
106pub struct IBusInputContext {
107 pub _bindgen_opaque_blob: [u64; 5usize],
108}
109
110#[doc = " IBusEngineDesc:"]
111#[doc = ""]
112#[doc = " Input method engine description data."]
113#[doc = " You can get extended values with g_object_get_properties."]
114#[repr(C)]
115#[repr(align(8))]
116#[derive(Debug, Copy, Clone)]
117pub struct IBusEngineDesc {
118 pub _bindgen_opaque_blob: [u64; 7usize],
119}
120
121#[doc = " @text: The string content of IBusText in UTF-8."]
122#[doc = " @attrs: Associated IBusAttributes."]
123#[doc = ""]
124#[doc = " A text object in IBus."]
125#[repr(C)]
126#[repr(align(8))]
127#[derive(Debug, Copy, Clone)]
128pub struct IBusText {
129 pub _bindgen_opaque_blob: [u64; 9usize],
130}
131
132#[doc = " IBusAttrList:"]
133#[doc = " @attributes: GArray that holds #IBusAttribute."]
134#[doc = ""]
135#[doc = " Array of IBusAttribute."]
136#[repr(C)]
137#[repr(align(8))]
138#[derive(Debug, Copy, Clone)]
139pub struct IBusAttrList {
140 pub _bindgen_opaque_blob: [u64; 7usize],
141}
142
143#[doc = " IBusAttribute:"]
144#[doc = " @type: IBusAttributeType"]
145#[doc = " @value: Value for the type."]
146#[doc = " @start_index: The starting index, inclusive."]
147#[doc = " @end_index: The ending index, exclusive."]
148#[doc = ""]
149#[doc = " Signify the type, value and scope of the attribute."]
150#[doc = " The scope starts from @start_index till the @end_index-1."]
151#[repr(C)]
152#[repr(align(8))]
153#[derive(Debug, Copy, Clone)]
154pub struct IBusAttribute {
155 pub _bindgen_opaque_blob: [u64; 8usize],
156}
157
158dlopen_external_library!(
159 IBus,
160functions:
161 fn ibus_bus_get_type() -> GType,
165 fn ibus_bus_new() -> *mut IBusBus,
166 fn ibus_bus_is_connected(*mut IBusBus) -> gboolean,
167 fn ibus_bus_hello(*mut IBusBus) -> *const gchar,
168 fn ibus_bus_request_name(*mut IBusBus, *const gchar, guint32) -> guint32,
169 fn ibus_bus_release_name(*mut IBusBus, *const gchar) -> guint,
170 fn ibus_bus_name_has_owner(*mut IBusBus, *const gchar) -> gboolean,
171 fn ibus_bus_list_names(*mut IBusBus) -> *mut GList,
172 fn ibus_bus_add_match(*mut IBusBus, *const gchar) -> gboolean,
173 fn ibus_bus_remove_match(*mut IBusBus, *const gchar) -> gboolean,
174 fn ibus_bus_get_name_owner(*mut IBusBus, *const gchar) -> *mut gchar,
175 fn ibus_bus_exit(*mut IBusBus, gboolean) -> gboolean,
176 fn ibus_bus_create_input_context(*mut IBusBus, *const gchar) -> *mut IBusInputContext,
177 fn ibus_bus_current_input_context(*mut IBusBus) -> *mut gchar,
178 fn ibus_bus_list_engines(*mut IBusBus) -> *mut GList,
180 fn ibus_bus_get_use_sys_layout(*mut IBusBus) -> gboolean,
181 fn ibus_bus_get_use_global_engine(*mut IBusBus) -> gboolean,
182 fn ibus_bus_get_global_engine(*mut IBusBus) -> *mut IBusEngineDesc,
183 fn ibus_bus_is_global_engine_enabled(*mut IBusBus) -> gboolean,
184 fn ibus_bus_set_global_engine(*mut IBusBus, *const gchar) -> gboolean,
185
186 fn ibus_input_context_get_type() -> GType,
190 fn ibus_input_context_process_key_event(*mut IBusInputContext, guint32, guint32, guint32) -> gboolean,
191 fn ibus_input_context_set_cursor_location(*mut IBusInputContext, gint32, gint32, gint32, gint32) -> (),
192 fn ibus_input_context_set_capabilities(*mut IBusInputContext, guint32) -> (),
194 fn ibus_input_context_focus_in(*mut IBusInputContext) -> (),
195 fn ibus_input_context_focus_out(*mut IBusInputContext) -> (),
196 fn ibus_input_context_reset(*mut IBusInputContext) -> (),
197 fn ibus_input_context_get_engine(*mut IBusInputContext) -> *mut IBusEngineDesc,
198 fn ibus_input_context_set_engine(*mut IBusInputContext, *const gchar) -> (),
199 fn ibus_input_context_set_surrounding_text(*mut IBusInputContext, *mut IBusText, guint32, guint32) -> (),
200 fn ibus_input_context_needs_surrounding_text(*mut IBusInputContext) -> gboolean,
201
202 fn ibus_engine_desc_get_type() -> GType,
206 fn ibus_engine_desc_new(*const gchar, *const gchar, *const gchar, *const gchar, *const gchar, *const gchar, *const gchar, *const gchar) -> *mut IBusEngineDesc,
207 fn ibus_engine_desc_get_name(*mut IBusEngineDesc) -> *const gchar,
209 fn ibus_engine_desc_get_longname(*mut IBusEngineDesc) -> *const gchar,
210 fn ibus_engine_desc_get_description(*mut IBusEngineDesc) -> *const gchar,
211 fn ibus_engine_desc_get_language(*mut IBusEngineDesc) -> *const gchar,
212 fn ibus_engine_desc_get_license(*mut IBusEngineDesc) -> *const gchar,
213 fn ibus_engine_desc_get_author(*mut IBusEngineDesc) -> *const gchar,
214 fn ibus_engine_desc_get_icon(*mut IBusEngineDesc) -> *const gchar,
215 fn ibus_engine_desc_get_layout(*mut IBusEngineDesc) -> *const gchar,
216 fn ibus_engine_desc_get_layout_variant(*mut IBusEngineDesc) -> *const gchar,
217 fn ibus_engine_desc_get_layout_option(*mut IBusEngineDesc) -> *const gchar,
218 fn ibus_engine_desc_get_rank(*mut IBusEngineDesc) -> guint,
219 fn ibus_engine_desc_get_hotkeys(*mut IBusEngineDesc) -> *const gchar,
220 fn ibus_engine_desc_get_symbol(*mut IBusEngineDesc) -> *const gchar,
221 fn ibus_engine_desc_get_setup(*mut IBusEngineDesc) -> *const gchar,
222 fn ibus_engine_desc_get_version(*mut IBusEngineDesc) -> *const gchar,
223 fn ibus_engine_desc_get_textdomain(*mut IBusEngineDesc) -> *const gchar,
224 fn ibus_engine_desc_get_icon_prop_key(*mut IBusEngineDesc) -> *const gchar,
225
226 fn ibus_engine_desc_output(*mut IBusEngineDesc, *mut c_void, gint) -> (),
229
230 fn ibus_text_get_type() -> GType,
234 fn ibus_text_new_from_string(*const gchar) -> *mut IBusText,
235 fn ibus_text_new_from_ucs4(*const gunichar) -> *mut IBusText,
236 fn ibus_text_new_from_static_string(*const gchar) -> *mut IBusText,
237 fn ibus_text_new_from_unichar(gunichar) -> *mut IBusText,
238 fn ibus_text_get_length(*mut IBusText) -> guint,
239 fn ibus_text_get_is_static(*mut IBusText) -> gboolean,
240 fn ibus_text_get_text(*mut IBusText) -> *const gchar,
241 fn ibus_text_get_attributes(*mut IBusText) -> *mut IBusAttrList,
242 fn ibus_text_set_attributes(*mut IBusText, *mut IBusAttrList) -> (),
243
244 fn ibus_attr_list_get_type() -> GType,
248 fn ibus_attr_list_new() -> *mut IBusAttrList,
249 fn ibus_attr_list_append(*mut IBusAttrList, *mut IBusAttribute) -> (),
250 fn ibus_attr_list_get(*mut IBusAttrList, guint) -> *mut IBusAttribute,
251
252 fn ibus_attribute_get_type() -> GType,
256 fn ibus_attribute_new(guint,guint,guint,guint) -> *mut IBusAttribute,
257 fn ibus_attribute_get_attr_type(*mut IBusAttribute) -> guint,
258 fn ibus_attribute_get_value(*mut IBusAttribute) -> guint,
259 fn ibus_attribute_get_start_index(*mut IBusAttribute) -> guint,
260 fn ibus_attribute_get_end_index(*mut IBusAttribute) -> guint,
261 fn ibus_attr_underline_new(guint, guint, guint) -> *mut IBusAttribute,
262 fn ibus_attr_foreground_new(guint, guint, guint) -> *mut IBusAttribute,
263 fn ibus_attr_background_new(guint, guint, guint) -> *mut IBusAttribute,
264);
265
266pub static IBUS: Lazy<IBus> = Lazy::new(|| unsafe {
267 IBus::open("libibus-1.0.so").expect(
268 "Failed to load ibus. You might need to install `libibus`"
269 )
270});