1 /* caribou-gtk-module.c generated by valac 0.32.0.49-00a57, the Vala compiler
2  * generated from caribou-gtk-module.vala, do not modify */
3 
4 
5 #include <glib.h>
6 #include <glib-object.h>
7 #include <gio/gio.h>
8 #include <string.h>
9 #include <gtk/gtk.h>
10 #include <gdk/gdk.h>
11 #include <stdio.h>
12 #include <gdk/gdkx.h>
13 #include <atk/atk.h>
14 #include <gobject/gvaluecollector.h>
15 
16 
17 #define CARIBOU_TYPE_KEYBOARD (caribou_keyboard_get_type ())
18 #define CARIBOU_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_KEYBOARD, CaribouKeyboard))
19 #define CARIBOU_IS_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_KEYBOARD))
20 #define CARIBOU_KEYBOARD_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CARIBOU_TYPE_KEYBOARD, CaribouKeyboardIface))
21 
22 typedef struct _CaribouKeyboard CaribouKeyboard;
23 typedef struct _CaribouKeyboardIface CaribouKeyboardIface;
24 
25 #define CARIBOU_TYPE_KEYBOARD_PROXY (caribou_keyboard_proxy_get_type ())
26 typedef GDBusProxy CaribouKeyboardProxy;
27 typedef GDBusProxyClass CaribouKeyboardProxyClass;
28 
29 #define CARIBOU_TYPE_GTK_MODULE (caribou_gtk_module_get_type ())
30 #define CARIBOU_GTK_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_GTK_MODULE, CaribouGtkModule))
31 #define CARIBOU_GTK_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_GTK_MODULE, CaribouGtkModuleClass))
32 #define CARIBOU_IS_GTK_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_GTK_MODULE))
33 #define CARIBOU_IS_GTK_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_GTK_MODULE))
34 #define CARIBOU_GTK_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_GTK_MODULE, CaribouGtkModuleClass))
35 
36 typedef struct _CaribouGtkModule CaribouGtkModule;
37 typedef struct _CaribouGtkModuleClass CaribouGtkModuleClass;
38 typedef struct _CaribouGtkModulePrivate CaribouGtkModulePrivate;
39 #define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
40 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
41 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
42 #define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))
43 typedef struct _Block1Data Block1Data;
44 #define _caribou_gtk_module_unref0(var) ((var == NULL) ? NULL : (var = (caribou_gtk_module_unref (var), NULL)))
45 typedef struct _CaribouParamSpecGtkModule CaribouParamSpecGtkModule;
46 
47 struct _CaribouKeyboardIface {
48 	GTypeInterface parent_iface;
49 	void (*set_cursor_location) (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
50 	void (*set_entry_location) (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
51 	void (*show) (CaribouKeyboard* self, guint32 timestamp, GError** error);
52 	void (*hide) (CaribouKeyboard* self, guint32 timestamp, GError** error);
53 };
54 
55 struct _CaribouGtkModule {
56 	GTypeInstance parent_instance;
57 	volatile int ref_count;
58 	CaribouGtkModulePrivate * priv;
59 };
60 
61 struct _CaribouGtkModuleClass {
62 	GTypeClass parent_class;
63 	void (*finalize) (CaribouGtkModule *self);
64 };
65 
66 struct _CaribouGtkModulePrivate {
67 	GHashTable* windows;
68 	CaribouKeyboard* keyboard;
69 	GdkDisplay* display;
70 };
71 
72 struct _Block1Data {
73 	int _ref_count_;
74 	CaribouGtkModule* self;
75 	GtkWindow* window;
76 };
77 
78 struct _CaribouParamSpecGtkModule {
79 	GParamSpec parent_instance;
80 };
81 
82 
83 static gpointer caribou_gtk_module_parent_class = NULL;
84 
85 GType caribou_keyboard_proxy_get_type (void) G_GNUC_CONST;
86 guint caribou_keyboard_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
87 GType caribou_keyboard_get_type (void) G_GNUC_CONST;
88 void caribou_keyboard_set_cursor_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
89 void caribou_keyboard_set_entry_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
90 void caribou_keyboard_show (CaribouKeyboard* self, guint32 timestamp, GError** error);
91 void caribou_keyboard_hide (CaribouKeyboard* self, guint32 timestamp, GError** error);
92 static void caribou_keyboard_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
93 static void caribou_keyboard_proxy_set_cursor_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
94 static void caribou_keyboard_proxy_set_entry_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
95 static void caribou_keyboard_proxy_show (CaribouKeyboard* self, guint32 timestamp, GError** error);
96 static void caribou_keyboard_proxy_hide (CaribouKeyboard* self, guint32 timestamp, GError** error);
97 static void caribou_keyboard_proxy_caribou_keyboard_interface_init (CaribouKeyboardIface* iface);
98 static void _dbus_caribou_keyboard_set_cursor_location (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
99 static void _dbus_caribou_keyboard_set_entry_location (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
100 static void _dbus_caribou_keyboard_show (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
101 static void _dbus_caribou_keyboard_hide (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
102 static void caribou_keyboard_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
103 static GVariant* caribou_keyboard_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
104 static gboolean caribou_keyboard_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
105 static void _caribou_keyboard_unregister_object (gpointer user_data);
106 gpointer caribou_gtk_module_ref (gpointer instance);
107 void caribou_gtk_module_unref (gpointer instance);
108 GParamSpec* caribou_param_spec_gtk_module (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
109 void caribou_value_set_gtk_module (GValue* value, gpointer v_object);
110 void caribou_value_take_gtk_module (GValue* value, gpointer v_object);
111 gpointer caribou_value_get_gtk_module (const GValue* value);
112 GType caribou_gtk_module_get_type (void) G_GNUC_CONST;
113 #define CARIBOU_GTK_MODULE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CARIBOU_TYPE_GTK_MODULE, CaribouGtkModulePrivate))
114 enum  {
115 	CARIBOU_GTK_MODULE_DUMMY_PROPERTY
116 };
117 CaribouGtkModule* caribou_gtk_module_new (void);
118 CaribouGtkModule* caribou_gtk_module_construct (GType object_type);
119 static void _g_object_unref0_ (gpointer var);
120 static void caribou_gtk_module_callback (CaribouGtkModule* self, GObject* obj, GAsyncResult* res);
121 static void _caribou_gtk_module_callback_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
122 static GdkFilterReturn caribou_gtk_module_event_filter (CaribouGtkModule* self, GdkXEvent* xevent, GdkEvent* evt);
123 static GdkFilterReturn _caribou_gtk_module_event_filter_gdk_filter_func (GdkXEvent* xevent, GdkEvent* event, gpointer self);
124 static void caribou_gtk_module_do_focus_change (CaribouGtkModule* self, GtkWidget* widget);
125 static Block1Data* block1_data_ref (Block1Data* _data1_);
126 static void block1_data_unref (void * _userdata_);
127 static void caribou_gtk_module_toplevel_focus_changed (CaribouGtkModule* self, GObject* obj, GParamSpec* prop);
128 static void _caribou_gtk_module_toplevel_focus_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
129 static void caribou_gtk_module_window_focus_changed (CaribouGtkModule* self, GtkWindow* window, GtkWidget* widget);
130 static void _caribou_gtk_module_window_focus_changed_gtk_window_set_focus (GtkWindow* _sender, GtkWidget* focus, gpointer self);
131 static void ___lambda4_ (Block1Data* _data1_);
132 static void ____lambda4__gtk_widget_destroy (GtkWidget* _sender, gpointer self);
133 static void caribou_gtk_module_get_origin_geometry (CaribouGtkModule* self, GdkWindow* window, gint* x, gint* y, gint* w, gint* h);
134 void caribou_gtk_module_unload (CaribouGtkModule* self);
135 static void caribou_gtk_module_finalize (CaribouGtkModule* obj);
136 
137 static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_cursor_location_x = {-1, "x", "i"};
138 static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_cursor_location_y = {-1, "y", "i"};
139 static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_cursor_location_w = {-1, "w", "i"};
140 static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_cursor_location_h = {-1, "h", "i"};
141 static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_set_cursor_location_in[] = {&_caribou_keyboard_dbus_arg_info_set_cursor_location_x, &_caribou_keyboard_dbus_arg_info_set_cursor_location_y, &_caribou_keyboard_dbus_arg_info_set_cursor_location_w, &_caribou_keyboard_dbus_arg_info_set_cursor_location_h, NULL};
142 static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_set_cursor_location_out[] = {NULL};
143 static const GDBusMethodInfo _caribou_keyboard_dbus_method_info_set_cursor_location = {-1, "SetCursorLocation", (GDBusArgInfo **) (&_caribou_keyboard_dbus_arg_info_set_cursor_location_in), (GDBusArgInfo **) (&_caribou_keyboard_dbus_arg_info_set_cursor_location_out)};
144 static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_entry_location_x = {-1, "x", "i"};
145 static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_entry_location_y = {-1, "y", "i"};
146 static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_entry_location_w = {-1, "w", "i"};
147 static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_entry_location_h = {-1, "h", "i"};
148 static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_set_entry_location_in[] = {&_caribou_keyboard_dbus_arg_info_set_entry_location_x, &_caribou_keyboard_dbus_arg_info_set_entry_location_y, &_caribou_keyboard_dbus_arg_info_set_entry_location_w, &_caribou_keyboard_dbus_arg_info_set_entry_location_h, NULL};
149 static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_set_entry_location_out[] = {NULL};
150 static const GDBusMethodInfo _caribou_keyboard_dbus_method_info_set_entry_location = {-1, "SetEntryLocation", (GDBusArgInfo **) (&_caribou_keyboard_dbus_arg_info_set_entry_location_in), (GDBusArgInfo **) (&_caribou_keyboard_dbus_arg_info_set_entry_location_out)};
151 static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_show_timestamp = {-1, "timestamp", "u"};
152 static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_show_in[] = {&_caribou_keyboard_dbus_arg_info_show_timestamp, NULL};
153 static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_show_out[] = {NULL};
154 static const GDBusMethodInfo _caribou_keyboard_dbus_method_info_show = {-1, "Show", (GDBusArgInfo **) (&_caribou_keyboard_dbus_arg_info_show_in), (GDBusArgInfo **) (&_caribou_keyboard_dbus_arg_info_show_out)};
155 static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_hide_timestamp = {-1, "timestamp", "u"};
156 static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_hide_in[] = {&_caribou_keyboard_dbus_arg_info_hide_timestamp, NULL};
157 static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_hide_out[] = {NULL};
158 static const GDBusMethodInfo _caribou_keyboard_dbus_method_info_hide = {-1, "Hide", (GDBusArgInfo **) (&_caribou_keyboard_dbus_arg_info_hide_in), (GDBusArgInfo **) (&_caribou_keyboard_dbus_arg_info_hide_out)};
159 static const GDBusMethodInfo * const _caribou_keyboard_dbus_method_info[] = {&_caribou_keyboard_dbus_method_info_set_cursor_location, &_caribou_keyboard_dbus_method_info_set_entry_location, &_caribou_keyboard_dbus_method_info_show, &_caribou_keyboard_dbus_method_info_hide, NULL};
160 static const GDBusSignalInfo * const _caribou_keyboard_dbus_signal_info[] = {NULL};
161 static const GDBusPropertyInfo * const _caribou_keyboard_dbus_property_info[] = {NULL};
162 static const GDBusInterfaceInfo _caribou_keyboard_dbus_interface_info = {-1, "org.gnome.Caribou.Keyboard", (GDBusMethodInfo **) (&_caribou_keyboard_dbus_method_info), (GDBusSignalInfo **) (&_caribou_keyboard_dbus_signal_info), (GDBusPropertyInfo **) (&_caribou_keyboard_dbus_property_info)};
163 static const GDBusInterfaceVTable _caribou_keyboard_dbus_interface_vtable = {caribou_keyboard_dbus_interface_method_call, caribou_keyboard_dbus_interface_get_property, caribou_keyboard_dbus_interface_set_property};
164 
caribou_keyboard_set_cursor_location(CaribouKeyboard * self,gint x,gint y,gint w,gint h,GError ** error)165 void caribou_keyboard_set_cursor_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error) {
166 	g_return_if_fail (self != NULL);
167 	CARIBOU_KEYBOARD_GET_INTERFACE (self)->set_cursor_location (self, x, y, w, h, error);
168 }
169 
170 
caribou_keyboard_set_entry_location(CaribouKeyboard * self,gint x,gint y,gint w,gint h,GError ** error)171 void caribou_keyboard_set_entry_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error) {
172 	g_return_if_fail (self != NULL);
173 	CARIBOU_KEYBOARD_GET_INTERFACE (self)->set_entry_location (self, x, y, w, h, error);
174 }
175 
176 
caribou_keyboard_show(CaribouKeyboard * self,guint32 timestamp,GError ** error)177 void caribou_keyboard_show (CaribouKeyboard* self, guint32 timestamp, GError** error) {
178 	g_return_if_fail (self != NULL);
179 	CARIBOU_KEYBOARD_GET_INTERFACE (self)->show (self, timestamp, error);
180 }
181 
182 
caribou_keyboard_hide(CaribouKeyboard * self,guint32 timestamp,GError ** error)183 void caribou_keyboard_hide (CaribouKeyboard* self, guint32 timestamp, GError** error) {
184 	g_return_if_fail (self != NULL);
185 	CARIBOU_KEYBOARD_GET_INTERFACE (self)->hide (self, timestamp, error);
186 }
187 
188 
caribou_keyboard_base_init(CaribouKeyboardIface * iface)189 static void caribou_keyboard_base_init (CaribouKeyboardIface * iface) {
190 	static gboolean initialized = FALSE;
191 	if (!initialized) {
192 		initialized = TRUE;
193 	}
194 }
195 
196 
caribou_keyboard_get_type(void)197 GType caribou_keyboard_get_type (void) {
198 	static volatile gsize caribou_keyboard_type_id__volatile = 0;
199 	if (g_once_init_enter (&caribou_keyboard_type_id__volatile)) {
200 		static const GTypeInfo g_define_type_info = { sizeof (CaribouKeyboardIface), (GBaseInitFunc) caribou_keyboard_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
201 		GType caribou_keyboard_type_id;
202 		caribou_keyboard_type_id = g_type_register_static (G_TYPE_INTERFACE, "CaribouKeyboard", &g_define_type_info, 0);
203 		g_type_interface_add_prerequisite (caribou_keyboard_type_id, G_TYPE_OBJECT);
204 		g_type_set_qdata (caribou_keyboard_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) caribou_keyboard_proxy_get_type);
205 		g_type_set_qdata (caribou_keyboard_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.gnome.Caribou.Keyboard");
206 		g_type_set_qdata (caribou_keyboard_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_caribou_keyboard_dbus_interface_info));
207 		g_type_set_qdata (caribou_keyboard_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) caribou_keyboard_register_object);
208 		g_once_init_leave (&caribou_keyboard_type_id__volatile, caribou_keyboard_type_id);
209 	}
210 	return caribou_keyboard_type_id__volatile;
211 }
212 
213 
214 G_DEFINE_TYPE_EXTENDED (CaribouKeyboardProxy, caribou_keyboard_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (CARIBOU_TYPE_KEYBOARD, caribou_keyboard_proxy_caribou_keyboard_interface_init) )
caribou_keyboard_proxy_class_init(CaribouKeyboardProxyClass * klass)215 static void caribou_keyboard_proxy_class_init (CaribouKeyboardProxyClass* klass) {
216 	G_DBUS_PROXY_CLASS (klass)->g_signal = caribou_keyboard_proxy_g_signal;
217 }
218 
219 
caribou_keyboard_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name,const gchar * signal_name,GVariant * parameters)220 static void caribou_keyboard_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
221 }
222 
223 
caribou_keyboard_proxy_init(CaribouKeyboardProxy * self)224 static void caribou_keyboard_proxy_init (CaribouKeyboardProxy* self) {
225 }
226 
227 
caribou_keyboard_proxy_set_cursor_location(CaribouKeyboard * self,gint x,gint y,gint w,gint h,GError ** error)228 static void caribou_keyboard_proxy_set_cursor_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error) {
229 	GDBusMessage *_message;
230 	GVariant *_arguments;
231 	GVariantBuilder _arguments_builder;
232 	GDBusMessage *_reply_message;
233 	G_IO_ERROR;
234 	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.gnome.Caribou.Keyboard", "SetCursorLocation");
235 	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
236 	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (x));
237 	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (y));
238 	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (w));
239 	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (h));
240 	_arguments = g_variant_builder_end (&_arguments_builder);
241 	g_dbus_message_set_body (_message, _arguments);
242 	_reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
243 	g_object_unref (_message);
244 	if (!_reply_message) {
245 		return;
246 	}
247 	if (g_dbus_message_to_gerror (_reply_message, error)) {
248 		g_object_unref (_reply_message);
249 		return;
250 	}
251 	g_object_unref (_reply_message);
252 }
253 
254 
caribou_keyboard_proxy_set_entry_location(CaribouKeyboard * self,gint x,gint y,gint w,gint h,GError ** error)255 static void caribou_keyboard_proxy_set_entry_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error) {
256 	GDBusMessage *_message;
257 	GVariant *_arguments;
258 	GVariantBuilder _arguments_builder;
259 	GDBusMessage *_reply_message;
260 	G_IO_ERROR;
261 	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.gnome.Caribou.Keyboard", "SetEntryLocation");
262 	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
263 	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (x));
264 	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (y));
265 	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (w));
266 	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (h));
267 	_arguments = g_variant_builder_end (&_arguments_builder);
268 	g_dbus_message_set_body (_message, _arguments);
269 	_reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
270 	g_object_unref (_message);
271 	if (!_reply_message) {
272 		return;
273 	}
274 	if (g_dbus_message_to_gerror (_reply_message, error)) {
275 		g_object_unref (_reply_message);
276 		return;
277 	}
278 	g_object_unref (_reply_message);
279 }
280 
281 
caribou_keyboard_proxy_show(CaribouKeyboard * self,guint32 timestamp,GError ** error)282 static void caribou_keyboard_proxy_show (CaribouKeyboard* self, guint32 timestamp, GError** error) {
283 	GDBusMessage *_message;
284 	GVariant *_arguments;
285 	GVariantBuilder _arguments_builder;
286 	GDBusMessage *_reply_message;
287 	G_IO_ERROR;
288 	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.gnome.Caribou.Keyboard", "Show");
289 	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
290 	g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (timestamp));
291 	_arguments = g_variant_builder_end (&_arguments_builder);
292 	g_dbus_message_set_body (_message, _arguments);
293 	_reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
294 	g_object_unref (_message);
295 	if (!_reply_message) {
296 		return;
297 	}
298 	if (g_dbus_message_to_gerror (_reply_message, error)) {
299 		g_object_unref (_reply_message);
300 		return;
301 	}
302 	g_object_unref (_reply_message);
303 }
304 
305 
caribou_keyboard_proxy_hide(CaribouKeyboard * self,guint32 timestamp,GError ** error)306 static void caribou_keyboard_proxy_hide (CaribouKeyboard* self, guint32 timestamp, GError** error) {
307 	GDBusMessage *_message;
308 	GVariant *_arguments;
309 	GVariantBuilder _arguments_builder;
310 	GDBusMessage *_reply_message;
311 	G_IO_ERROR;
312 	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.gnome.Caribou.Keyboard", "Hide");
313 	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
314 	g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (timestamp));
315 	_arguments = g_variant_builder_end (&_arguments_builder);
316 	g_dbus_message_set_body (_message, _arguments);
317 	_reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
318 	g_object_unref (_message);
319 	if (!_reply_message) {
320 		return;
321 	}
322 	if (g_dbus_message_to_gerror (_reply_message, error)) {
323 		g_object_unref (_reply_message);
324 		return;
325 	}
326 	g_object_unref (_reply_message);
327 }
328 
329 
caribou_keyboard_proxy_caribou_keyboard_interface_init(CaribouKeyboardIface * iface)330 static void caribou_keyboard_proxy_caribou_keyboard_interface_init (CaribouKeyboardIface* iface) {
331 	iface->set_cursor_location = caribou_keyboard_proxy_set_cursor_location;
332 	iface->set_entry_location = caribou_keyboard_proxy_set_entry_location;
333 	iface->show = caribou_keyboard_proxy_show;
334 	iface->hide = caribou_keyboard_proxy_hide;
335 }
336 
337 
_dbus_caribou_keyboard_set_cursor_location(CaribouKeyboard * self,GVariant * _parameters_,GDBusMethodInvocation * invocation)338 static void _dbus_caribou_keyboard_set_cursor_location (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
339 	GError* error = NULL;
340 	GVariantIter _arguments_iter;
341 	gint x = 0;
342 	GVariant* _tmp0_;
343 	gint y = 0;
344 	GVariant* _tmp1_;
345 	gint w = 0;
346 	GVariant* _tmp2_;
347 	gint h = 0;
348 	GVariant* _tmp3_;
349 	GDBusMessage* _reply_message;
350 	GVariant* _reply;
351 	GVariantBuilder _reply_builder;
352 	g_variant_iter_init (&_arguments_iter, _parameters_);
353 	_tmp0_ = g_variant_iter_next_value (&_arguments_iter);
354 	x = g_variant_get_int32 (_tmp0_);
355 	g_variant_unref (_tmp0_);
356 	_tmp1_ = g_variant_iter_next_value (&_arguments_iter);
357 	y = g_variant_get_int32 (_tmp1_);
358 	g_variant_unref (_tmp1_);
359 	_tmp2_ = g_variant_iter_next_value (&_arguments_iter);
360 	w = g_variant_get_int32 (_tmp2_);
361 	g_variant_unref (_tmp2_);
362 	_tmp3_ = g_variant_iter_next_value (&_arguments_iter);
363 	h = g_variant_get_int32 (_tmp3_);
364 	g_variant_unref (_tmp3_);
365 	caribou_keyboard_set_cursor_location (self, x, y, w, h, &error);
366 	if (error) {
367 		g_dbus_method_invocation_return_gerror (invocation, error);
368 		return;
369 	}
370 	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
371 	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
372 	_reply = g_variant_builder_end (&_reply_builder);
373 	g_dbus_message_set_body (_reply_message, _reply);
374 	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
375 	g_object_unref (invocation);
376 	g_object_unref (_reply_message);
377 }
378 
379 
_dbus_caribou_keyboard_set_entry_location(CaribouKeyboard * self,GVariant * _parameters_,GDBusMethodInvocation * invocation)380 static void _dbus_caribou_keyboard_set_entry_location (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
381 	GError* error = NULL;
382 	GVariantIter _arguments_iter;
383 	gint x = 0;
384 	GVariant* _tmp4_;
385 	gint y = 0;
386 	GVariant* _tmp5_;
387 	gint w = 0;
388 	GVariant* _tmp6_;
389 	gint h = 0;
390 	GVariant* _tmp7_;
391 	GDBusMessage* _reply_message;
392 	GVariant* _reply;
393 	GVariantBuilder _reply_builder;
394 	g_variant_iter_init (&_arguments_iter, _parameters_);
395 	_tmp4_ = g_variant_iter_next_value (&_arguments_iter);
396 	x = g_variant_get_int32 (_tmp4_);
397 	g_variant_unref (_tmp4_);
398 	_tmp5_ = g_variant_iter_next_value (&_arguments_iter);
399 	y = g_variant_get_int32 (_tmp5_);
400 	g_variant_unref (_tmp5_);
401 	_tmp6_ = g_variant_iter_next_value (&_arguments_iter);
402 	w = g_variant_get_int32 (_tmp6_);
403 	g_variant_unref (_tmp6_);
404 	_tmp7_ = g_variant_iter_next_value (&_arguments_iter);
405 	h = g_variant_get_int32 (_tmp7_);
406 	g_variant_unref (_tmp7_);
407 	caribou_keyboard_set_entry_location (self, x, y, w, h, &error);
408 	if (error) {
409 		g_dbus_method_invocation_return_gerror (invocation, error);
410 		return;
411 	}
412 	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
413 	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
414 	_reply = g_variant_builder_end (&_reply_builder);
415 	g_dbus_message_set_body (_reply_message, _reply);
416 	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
417 	g_object_unref (invocation);
418 	g_object_unref (_reply_message);
419 }
420 
421 
_dbus_caribou_keyboard_show(CaribouKeyboard * self,GVariant * _parameters_,GDBusMethodInvocation * invocation)422 static void _dbus_caribou_keyboard_show (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
423 	GError* error = NULL;
424 	GVariantIter _arguments_iter;
425 	guint32 timestamp = 0U;
426 	GVariant* _tmp8_;
427 	GDBusMessage* _reply_message;
428 	GVariant* _reply;
429 	GVariantBuilder _reply_builder;
430 	g_variant_iter_init (&_arguments_iter, _parameters_);
431 	_tmp8_ = g_variant_iter_next_value (&_arguments_iter);
432 	timestamp = g_variant_get_uint32 (_tmp8_);
433 	g_variant_unref (_tmp8_);
434 	caribou_keyboard_show (self, timestamp, &error);
435 	if (error) {
436 		g_dbus_method_invocation_return_gerror (invocation, error);
437 		return;
438 	}
439 	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
440 	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
441 	_reply = g_variant_builder_end (&_reply_builder);
442 	g_dbus_message_set_body (_reply_message, _reply);
443 	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
444 	g_object_unref (invocation);
445 	g_object_unref (_reply_message);
446 }
447 
448 
_dbus_caribou_keyboard_hide(CaribouKeyboard * self,GVariant * _parameters_,GDBusMethodInvocation * invocation)449 static void _dbus_caribou_keyboard_hide (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
450 	GError* error = NULL;
451 	GVariantIter _arguments_iter;
452 	guint32 timestamp = 0U;
453 	GVariant* _tmp9_;
454 	GDBusMessage* _reply_message;
455 	GVariant* _reply;
456 	GVariantBuilder _reply_builder;
457 	g_variant_iter_init (&_arguments_iter, _parameters_);
458 	_tmp9_ = g_variant_iter_next_value (&_arguments_iter);
459 	timestamp = g_variant_get_uint32 (_tmp9_);
460 	g_variant_unref (_tmp9_);
461 	caribou_keyboard_hide (self, timestamp, &error);
462 	if (error) {
463 		g_dbus_method_invocation_return_gerror (invocation, error);
464 		return;
465 	}
466 	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
467 	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
468 	_reply = g_variant_builder_end (&_reply_builder);
469 	g_dbus_message_set_body (_reply_message, _reply);
470 	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
471 	g_object_unref (invocation);
472 	g_object_unref (_reply_message);
473 }
474 
475 
caribou_keyboard_dbus_interface_method_call(GDBusConnection * connection,const gchar * sender,const gchar * object_path,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)476 static void caribou_keyboard_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
477 	gpointer* data;
478 	gpointer object;
479 	data = user_data;
480 	object = data[0];
481 	if (strcmp (method_name, "SetCursorLocation") == 0) {
482 		_dbus_caribou_keyboard_set_cursor_location (object, parameters, invocation);
483 	} else if (strcmp (method_name, "SetEntryLocation") == 0) {
484 		_dbus_caribou_keyboard_set_entry_location (object, parameters, invocation);
485 	} else if (strcmp (method_name, "Show") == 0) {
486 		_dbus_caribou_keyboard_show (object, parameters, invocation);
487 	} else if (strcmp (method_name, "Hide") == 0) {
488 		_dbus_caribou_keyboard_hide (object, parameters, invocation);
489 	} else {
490 		g_object_unref (invocation);
491 	}
492 }
493 
494 
caribou_keyboard_dbus_interface_get_property(GDBusConnection * connection,const gchar * sender,const gchar * object_path,const gchar * interface_name,const gchar * property_name,GError ** error,gpointer user_data)495 static GVariant* caribou_keyboard_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
496 	gpointer* data;
497 	gpointer object;
498 	data = user_data;
499 	object = data[0];
500 	return NULL;
501 }
502 
503 
caribou_keyboard_dbus_interface_set_property(GDBusConnection * connection,const gchar * sender,const gchar * object_path,const gchar * interface_name,const gchar * property_name,GVariant * value,GError ** error,gpointer user_data)504 static gboolean caribou_keyboard_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
505 	gpointer* data;
506 	gpointer object;
507 	data = user_data;
508 	object = data[0];
509 	return FALSE;
510 }
511 
512 
caribou_keyboard_register_object(gpointer object,GDBusConnection * connection,const gchar * path,GError ** error)513 guint caribou_keyboard_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
514 	guint result;
515 	gpointer *data;
516 	data = g_new (gpointer, 3);
517 	data[0] = g_object_ref (object);
518 	data[1] = g_object_ref (connection);
519 	data[2] = g_strdup (path);
520 	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_caribou_keyboard_dbus_interface_info), &_caribou_keyboard_dbus_interface_vtable, data, _caribou_keyboard_unregister_object, error);
521 	if (!result) {
522 		return 0;
523 	}
524 	return result;
525 }
526 
527 
_caribou_keyboard_unregister_object(gpointer user_data)528 static void _caribou_keyboard_unregister_object (gpointer user_data) {
529 	gpointer* data;
530 	data = user_data;
531 	g_object_unref (data[0]);
532 	g_object_unref (data[1]);
533 	g_free (data[2]);
534 	g_free (data);
535 }
536 
537 
_g_object_unref0_(gpointer var)538 static void _g_object_unref0_ (gpointer var) {
539 	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
540 }
541 
542 
_g_object_ref0(gpointer self)543 static gpointer _g_object_ref0 (gpointer self) {
544 	return self ? g_object_ref (self) : NULL;
545 }
546 
547 
_caribou_gtk_module_callback_gasync_ready_callback(GObject * source_object,GAsyncResult * res,gpointer self)548 static void _caribou_gtk_module_callback_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
549 	caribou_gtk_module_callback ((CaribouGtkModule*) self, source_object, res);
550 	caribou_gtk_module_unref (self);
551 }
552 
553 
caribou_gtk_module_construct(GType object_type)554 CaribouGtkModule* caribou_gtk_module_construct (GType object_type) {
555 	CaribouGtkModule* self = NULL;
556 	GHashTable* _tmp0_ = NULL;
557 	GdkDisplay* _tmp1_ = NULL;
558 	GdkDisplay* _tmp2_ = NULL;
559 	GError * _inner_error_ = NULL;
560 	self = (CaribouGtkModule*) g_type_create_instance (object_type);
561 	_tmp0_ = g_hash_table_new_full (NULL, NULL, _g_object_unref0_, NULL);
562 	_g_hash_table_unref0 (self->priv->windows);
563 	self->priv->windows = _tmp0_;
564 	_tmp1_ = gdk_display_get_default ();
565 	_tmp2_ = _g_object_ref0 (_tmp1_);
566 	_g_object_unref0 (self->priv->display);
567 	self->priv->display = _tmp2_;
568 	g_async_initable_new_async (CARIBOU_TYPE_KEYBOARD_PROXY, 0, NULL, _caribou_gtk_module_callback_gasync_ready_callback, caribou_gtk_module_ref (self), "g-flags", 0, "g-name", "org.gnome.Caribou.Keyboard", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/gnome/Caribou/Keyboard", "g-interface-name", "org.gnome.Caribou.Keyboard", "g-interface-info", g_type_get_qdata (CARIBOU_TYPE_KEYBOARD, g_quark_from_static_string ("vala-dbus-interface-info")), NULL);
569 	return self;
570 }
571 
572 
caribou_gtk_module_new(void)573 CaribouGtkModule* caribou_gtk_module_new (void) {
574 	return caribou_gtk_module_construct (CARIBOU_TYPE_GTK_MODULE);
575 }
576 
577 
_caribou_gtk_module_event_filter_gdk_filter_func(GdkXEvent * xevent,GdkEvent * event,gpointer self)578 static GdkFilterReturn _caribou_gtk_module_event_filter_gdk_filter_func (GdkXEvent* xevent, GdkEvent* event, gpointer self) {
579 	GdkFilterReturn result;
580 	result = caribou_gtk_module_event_filter ((CaribouGtkModule*) self, xevent, event);
581 	return result;
582 }
583 
584 
caribou_gtk_module_callback(CaribouGtkModule * self,GObject * obj,GAsyncResult * res)585 static void caribou_gtk_module_callback (CaribouGtkModule* self, GObject* obj, GAsyncResult* res) {
586 	GList* toplevels = NULL;
587 	GList* _tmp8_ = NULL;
588 	GList* _tmp9_ = NULL;
589 	GError * _inner_error_ = NULL;
590 	g_return_if_fail (self != NULL);
591 	g_return_if_fail (res != NULL);
592 	{
593 		CaribouKeyboard* _tmp0_ = NULL;
594 		GAsyncResult* _tmp1_ = NULL;
595 		CaribouKeyboard* _tmp2_ = NULL;
596 		CaribouKeyboard* _tmp3_ = NULL;
597 		CaribouKeyboard* _tmp4_ = NULL;
598 		_tmp1_ = res;
599 		_tmp2_ = g_async_result_get_source_object (_tmp1_);
600 		_tmp3_ = g_async_initable_new_finish (_tmp2_, _tmp1_, &_inner_error_);
601 		g_object_unref (_tmp2_);
602 		_tmp0_ = (CaribouKeyboard*) _tmp3_;
603 		if (G_UNLIKELY (_inner_error_ != NULL)) {
604 			goto __catch0_g_error;
605 		}
606 		_tmp4_ = _tmp0_;
607 		_tmp0_ = NULL;
608 		_g_object_unref0 (self->priv->keyboard);
609 		self->priv->keyboard = _tmp4_;
610 		_g_object_unref0 (_tmp0_);
611 	}
612 	goto __finally0;
613 	__catch0_g_error:
614 	{
615 		GError* e = NULL;
616 		FILE* _tmp5_ = NULL;
617 		GError* _tmp6_ = NULL;
618 		const gchar* _tmp7_ = NULL;
619 		e = _inner_error_;
620 		_inner_error_ = NULL;
621 		_tmp5_ = stderr;
622 		_tmp6_ = e;
623 		_tmp7_ = _tmp6_->message;
624 		fprintf (_tmp5_, "%s\n", _tmp7_);
625 		_g_error_free0 (e);
626 		return;
627 	}
628 	__finally0:
629 	if (G_UNLIKELY (_inner_error_ != NULL)) {
630 		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
631 		g_clear_error (&_inner_error_);
632 		return;
633 	}
634 	gdk_window_add_filter (NULL, _caribou_gtk_module_event_filter_gdk_filter_func, self);
635 	_tmp8_ = gtk_window_list_toplevels ();
636 	toplevels = _tmp8_;
637 	_tmp9_ = toplevels;
638 	{
639 		GList* w_collection = NULL;
640 		GList* w_it = NULL;
641 		w_collection = _tmp9_;
642 		for (w_it = w_collection; w_it != NULL; w_it = w_it->next) {
643 			GtkWindow* w = NULL;
644 			w = (GtkWindow*) w_it->data;
645 			{
646 				GtkWindow* _tmp10_ = NULL;
647 				gboolean _tmp11_ = FALSE;
648 				gboolean _tmp12_ = FALSE;
649 				_tmp10_ = w;
650 				g_object_get (_tmp10_, "has-toplevel-focus", &_tmp11_, NULL);
651 				_tmp12_ = _tmp11_;
652 				if (_tmp12_) {
653 					GtkWindow* _tmp13_ = NULL;
654 					GtkWidget* _tmp14_ = NULL;
655 					_tmp13_ = w;
656 					_tmp14_ = gtk_window_get_focus (_tmp13_);
657 					caribou_gtk_module_do_focus_change (self, _tmp14_);
658 					break;
659 				}
660 			}
661 		}
662 	}
663 	_g_list_free0 (toplevels);
664 }
665 
666 
block1_data_ref(Block1Data * _data1_)667 static Block1Data* block1_data_ref (Block1Data* _data1_) {
668 	g_atomic_int_inc (&_data1_->_ref_count_);
669 	return _data1_;
670 }
671 
672 
block1_data_unref(void * _userdata_)673 static void block1_data_unref (void * _userdata_) {
674 	Block1Data* _data1_;
675 	_data1_ = (Block1Data*) _userdata_;
676 	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
677 		CaribouGtkModule* self;
678 		self = _data1_->self;
679 		_g_object_unref0 (_data1_->window);
680 		_caribou_gtk_module_unref0 (self);
681 		g_slice_free (Block1Data, _data1_);
682 	}
683 }
684 
685 
_caribou_gtk_module_toplevel_focus_changed_g_object_notify(GObject * _sender,GParamSpec * pspec,gpointer self)686 static void _caribou_gtk_module_toplevel_focus_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
687 	caribou_gtk_module_toplevel_focus_changed ((CaribouGtkModule*) self, _sender, pspec);
688 }
689 
690 
_caribou_gtk_module_window_focus_changed_gtk_window_set_focus(GtkWindow * _sender,GtkWidget * focus,gpointer self)691 static void _caribou_gtk_module_window_focus_changed_gtk_window_set_focus (GtkWindow* _sender, GtkWidget* focus, gpointer self) {
692 	caribou_gtk_module_window_focus_changed ((CaribouGtkModule*) self, _sender, focus);
693 }
694 
695 
___lambda4_(Block1Data * _data1_)696 static void ___lambda4_ (Block1Data* _data1_) {
697 	CaribouGtkModule* self;
698 	GHashTable* _tmp0_ = NULL;
699 	GtkWindow* _tmp1_ = NULL;
700 	self = _data1_->self;
701 	_tmp0_ = self->priv->windows;
702 	_tmp1_ = _data1_->window;
703 	g_hash_table_remove (_tmp0_, _tmp1_);
704 }
705 
706 
____lambda4__gtk_widget_destroy(GtkWidget * _sender,gpointer self)707 static void ____lambda4__gtk_widget_destroy (GtkWidget* _sender, gpointer self) {
708 	___lambda4_ (self);
709 }
710 
711 
caribou_gtk_module_event_filter(CaribouGtkModule * self,GdkXEvent * xevent,GdkEvent * evt)712 static GdkFilterReturn caribou_gtk_module_event_filter (CaribouGtkModule* self, GdkXEvent* xevent, GdkEvent* evt) {
713 	GdkFilterReturn result = 0;
714 	Block1Data* _data1_;
715 	GdkWindow* gdkwindow = NULL;
716 	void* data = NULL;
717 	GdkEvent* _tmp0_ = NULL;
718 	GdkEventAny* _tmp1_ = NULL;
719 	GdkEventAny* _tmp2_ = NULL;
720 	GdkWindow* _tmp3_ = NULL;
721 	GdkWindow* _tmp4_ = NULL;
722 	gboolean _tmp5_ = FALSE;
723 	GdkWindow* _tmp6_ = NULL;
724 	GdkWindow* _tmp9_ = NULL;
725 	void* _tmp10_ = NULL;
726 	gboolean _tmp11_ = FALSE;
727 	void* _tmp12_ = NULL;
728 	void* _tmp14_ = NULL;
729 	GtkWindow* _tmp15_ = NULL;
730 	GHashTable* _tmp16_ = NULL;
731 	GtkWindow* _tmp17_ = NULL;
732 	gconstpointer _tmp18_ = NULL;
733 	g_return_val_if_fail (self != NULL, 0);
734 	g_return_val_if_fail (xevent != NULL, 0);
735 	g_return_val_if_fail (evt != NULL, 0);
736 	_data1_ = g_slice_new0 (Block1Data);
737 	_data1_->_ref_count_ = 1;
738 	_data1_->self = caribou_gtk_module_ref (self);
739 	_tmp0_ = evt;
740 	_tmp1_ = (GdkEventAny *) (_tmp0_);
741 	_tmp2_ = _tmp1_;
742 	_tmp3_ = _tmp2_->window;
743 	_tmp4_ = _g_object_ref0 (_tmp3_);
744 	_g_object_unref0 (gdkwindow);
745 	gdkwindow = _tmp4_;
746 	_tmp6_ = gdkwindow;
747 	if (_tmp6_ == NULL) {
748 		_tmp5_ = TRUE;
749 	} else {
750 		GdkWindow* _tmp7_ = NULL;
751 		GdkWindowType _tmp8_ = 0;
752 		_tmp7_ = gdkwindow;
753 		_tmp8_ = gdk_window_get_window_type (_tmp7_);
754 		_tmp5_ = _tmp8_ != GDK_WINDOW_TOPLEVEL;
755 	}
756 	if (_tmp5_) {
757 		result = GDK_FILTER_CONTINUE;
758 		_g_object_unref0 (gdkwindow);
759 		block1_data_unref (_data1_);
760 		_data1_ = NULL;
761 		return result;
762 	}
763 	_tmp9_ = gdkwindow;
764 	gdk_window_get_user_data (_tmp9_, &_tmp10_);
765 	data = _tmp10_;
766 	_tmp12_ = data;
767 	if (_tmp12_ == NULL) {
768 		_tmp11_ = TRUE;
769 	} else {
770 		void* _tmp13_ = NULL;
771 		_tmp13_ = data;
772 		_tmp11_ = !G_TYPE_CHECK_INSTANCE_TYPE ((GObject*) _tmp13_, gtk_window_get_type ());
773 	}
774 	if (_tmp11_) {
775 		result = GDK_FILTER_CONTINUE;
776 		_g_object_unref0 (gdkwindow);
777 		block1_data_unref (_data1_);
778 		_data1_ = NULL;
779 		return result;
780 	}
781 	_tmp14_ = data;
782 	_tmp15_ = _g_object_ref0 ((GtkWindow*) _tmp14_);
783 	_g_object_unref0 (_data1_->window);
784 	_data1_->window = _tmp15_;
785 	_tmp16_ = self->priv->windows;
786 	_tmp17_ = _data1_->window;
787 	_tmp18_ = g_hash_table_lookup (_tmp16_, _tmp17_);
788 	if (!((gboolean) ((gintptr) _tmp18_))) {
789 		GHashTable* _tmp19_ = NULL;
790 		GtkWindow* _tmp20_ = NULL;
791 		GtkWindow* _tmp21_ = NULL;
792 		GtkWindow* _tmp22_ = NULL;
793 		GtkWindow* _tmp23_ = NULL;
794 		GtkWindow* _tmp24_ = NULL;
795 		_tmp19_ = self->priv->windows;
796 		_tmp20_ = _data1_->window;
797 		_tmp21_ = _g_object_ref0 (_tmp20_);
798 		g_hash_table_insert (_tmp19_, _tmp21_, (gpointer) ((gintptr) TRUE));
799 		_tmp22_ = _data1_->window;
800 		g_signal_connect ((GObject*) _tmp22_, "notify::has-toplevel-focus", (GCallback) _caribou_gtk_module_toplevel_focus_changed_g_object_notify, self);
801 		_tmp23_ = _data1_->window;
802 		g_signal_connect (_tmp23_, "set-focus", (GCallback) _caribou_gtk_module_window_focus_changed_gtk_window_set_focus, self);
803 		_tmp24_ = _data1_->window;
804 		g_signal_connect_data ((GtkWidget*) _tmp24_, "destroy", (GCallback) ____lambda4__gtk_widget_destroy, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
805 	}
806 	result = GDK_FILTER_CONTINUE;
807 	_g_object_unref0 (gdkwindow);
808 	block1_data_unref (_data1_);
809 	_data1_ = NULL;
810 	return result;
811 }
812 
813 
caribou_gtk_module_toplevel_focus_changed(CaribouGtkModule * self,GObject * obj,GParamSpec * prop)814 static void caribou_gtk_module_toplevel_focus_changed (CaribouGtkModule* self, GObject* obj, GParamSpec* prop) {
815 	GtkWindow* window = NULL;
816 	GObject* _tmp0_ = NULL;
817 	GtkWindow* _tmp1_ = NULL;
818 	GtkWindow* _tmp2_ = NULL;
819 	gboolean _tmp3_ = FALSE;
820 	gboolean _tmp4_ = FALSE;
821 	g_return_if_fail (self != NULL);
822 	g_return_if_fail (obj != NULL);
823 	g_return_if_fail (prop != NULL);
824 	_tmp0_ = obj;
825 	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_window_get_type (), GtkWindow));
826 	window = _tmp1_;
827 	_tmp2_ = window;
828 	g_object_get (_tmp2_, "has-toplevel-focus", &_tmp3_, NULL);
829 	_tmp4_ = _tmp3_;
830 	if (_tmp4_) {
831 		GtkWindow* _tmp5_ = NULL;
832 		GtkWidget* _tmp6_ = NULL;
833 		_tmp5_ = window;
834 		_tmp6_ = gtk_window_get_focus (_tmp5_);
835 		caribou_gtk_module_do_focus_change (self, _tmp6_);
836 	}
837 	_g_object_unref0 (window);
838 }
839 
840 
caribou_gtk_module_window_focus_changed(CaribouGtkModule * self,GtkWindow * window,GtkWidget * widget)841 static void caribou_gtk_module_window_focus_changed (CaribouGtkModule* self, GtkWindow* window, GtkWidget* widget) {
842 	GtkWidget* _tmp0_ = NULL;
843 	g_return_if_fail (self != NULL);
844 	g_return_if_fail (window != NULL);
845 	_tmp0_ = widget;
846 	caribou_gtk_module_do_focus_change (self, _tmp0_);
847 }
848 
849 
caribou_gtk_module_do_focus_change(CaribouGtkModule * self,GtkWidget * widget)850 static void caribou_gtk_module_do_focus_change (CaribouGtkModule* self, GtkWidget* widget) {
851 	guint32 timestamp = 0U;
852 	GdkDisplay* _tmp0_ = NULL;
853 	guint32 _tmp1_ = 0U;
854 	gboolean _tmp2_ = FALSE;
855 	gboolean _tmp3_ = FALSE;
856 	GtkWidget* _tmp4_ = NULL;
857 	GError * _inner_error_ = NULL;
858 	g_return_if_fail (self != NULL);
859 	_tmp0_ = self->priv->display;
860 	_tmp1_ = gdk_x11_display_get_user_time (_tmp0_);
861 	timestamp = _tmp1_;
862 	_tmp4_ = widget;
863 	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, GTK_TYPE_EDITABLE)) {
864 		GtkWidget* _tmp5_ = NULL;
865 		gboolean _tmp6_ = FALSE;
866 		_tmp5_ = widget;
867 		_tmp6_ = gtk_editable_get_editable (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GTK_TYPE_EDITABLE, GtkEditable));
868 		_tmp3_ = _tmp6_;
869 	} else {
870 		_tmp3_ = FALSE;
871 	}
872 	if (_tmp3_) {
873 		_tmp2_ = TRUE;
874 	} else {
875 		gboolean _tmp7_ = FALSE;
876 		GtkWidget* _tmp8_ = NULL;
877 		_tmp8_ = widget;
878 		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, gtk_text_view_get_type ())) {
879 			GtkWidget* _tmp9_ = NULL;
880 			gboolean _tmp10_ = FALSE;
881 			_tmp9_ = widget;
882 			_tmp10_ = gtk_text_view_get_editable (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, gtk_text_view_get_type (), GtkTextView));
883 			_tmp7_ = _tmp10_;
884 		} else {
885 			_tmp7_ = FALSE;
886 		}
887 		_tmp2_ = _tmp7_;
888 	}
889 	if (_tmp2_) {
890 		GdkWindow* current_window = NULL;
891 		GtkWidget* _tmp11_ = NULL;
892 		GdkWindow* _tmp12_ = NULL;
893 		GdkWindow* _tmp13_ = NULL;
894 		AtkObject* object = NULL;
895 		GtkWidget* _tmp14_ = NULL;
896 		AtkObject* _tmp15_ = NULL;
897 		AtkObject* _tmp16_ = NULL;
898 		gint x = 0;
899 		gint y = 0;
900 		gint w = 0;
901 		gint h = 0;
902 		gint caret_offset = 0;
903 		AtkObject* _tmp17_ = NULL;
904 		_tmp11_ = widget;
905 		_tmp12_ = gtk_widget_get_window (_tmp11_);
906 		_tmp13_ = _g_object_ref0 (_tmp12_);
907 		current_window = _tmp13_;
908 		_tmp14_ = widget;
909 		_tmp15_ = gtk_widget_get_accessible (_tmp14_);
910 		_tmp16_ = _g_object_ref0 (_tmp15_);
911 		object = _tmp16_;
912 		x = 0;
913 		y = 0;
914 		w = 0;
915 		h = 0;
916 		caret_offset = 0;
917 		_tmp17_ = object;
918 		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp17_, ATK_TYPE_TEXT)) {
919 			AtkObject* _tmp18_ = NULL;
920 			gint _tmp19_ = 0;
921 			AtkObject* _tmp20_ = NULL;
922 			gint _tmp21_ = 0;
923 			gint _tmp22_ = 0;
924 			gint _tmp23_ = 0;
925 			gint _tmp24_ = 0;
926 			gint _tmp25_ = 0;
927 			_tmp18_ = object;
928 			_tmp19_ = atk_text_get_caret_offset (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, ATK_TYPE_TEXT, AtkText));
929 			caret_offset = _tmp19_;
930 			_tmp20_ = object;
931 			_tmp21_ = caret_offset;
932 			atk_text_get_character_extents (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, ATK_TYPE_TEXT, AtkText), _tmp21_, &_tmp22_, &_tmp23_, &_tmp24_, &_tmp25_, ATK_XY_SCREEN);
933 			x = _tmp22_;
934 			y = _tmp23_;
935 			w = _tmp24_;
936 			h = _tmp25_;
937 		} else {
938 			GdkWindow* _tmp26_ = NULL;
939 			_tmp26_ = current_window;
940 			if (_tmp26_ != NULL) {
941 				GdkWindow* _tmp27_ = NULL;
942 				gint _tmp28_ = 0;
943 				gint _tmp29_ = 0;
944 				gint _tmp30_ = 0;
945 				gint _tmp31_ = 0;
946 				_tmp27_ = current_window;
947 				caribou_gtk_module_get_origin_geometry (self, _tmp27_, &_tmp28_, &_tmp29_, &_tmp30_, &_tmp31_);
948 				x = _tmp28_;
949 				y = _tmp29_;
950 				w = _tmp30_;
951 				h = _tmp31_;
952 			}
953 		}
954 		{
955 			CaribouKeyboard* _tmp32_ = NULL;
956 			guint32 _tmp33_ = 0U;
957 			CaribouKeyboard* _tmp34_ = NULL;
958 			gint _tmp35_ = 0;
959 			gint _tmp36_ = 0;
960 			gint _tmp37_ = 0;
961 			gint _tmp38_ = 0;
962 			_tmp32_ = self->priv->keyboard;
963 			_tmp33_ = timestamp;
964 			caribou_keyboard_show (_tmp32_, _tmp33_, &_inner_error_);
965 			if (G_UNLIKELY (_inner_error_ != NULL)) {
966 				if (_inner_error_->domain == G_IO_ERROR) {
967 					goto __catch1_g_io_error;
968 				}
969 				_g_object_unref0 (object);
970 				_g_object_unref0 (current_window);
971 				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
972 				g_clear_error (&_inner_error_);
973 				return;
974 			}
975 			_tmp34_ = self->priv->keyboard;
976 			_tmp35_ = x;
977 			_tmp36_ = y;
978 			_tmp37_ = w;
979 			_tmp38_ = h;
980 			caribou_keyboard_set_cursor_location (_tmp34_, _tmp35_, _tmp36_, _tmp37_, _tmp38_, &_inner_error_);
981 			if (G_UNLIKELY (_inner_error_ != NULL)) {
982 				if (_inner_error_->domain == G_IO_ERROR) {
983 					goto __catch1_g_io_error;
984 				}
985 				_g_object_unref0 (object);
986 				_g_object_unref0 (current_window);
987 				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
988 				g_clear_error (&_inner_error_);
989 				return;
990 			}
991 		}
992 		goto __finally1;
993 		__catch1_g_io_error:
994 		{
995 			GError* e = NULL;
996 			FILE* _tmp39_ = NULL;
997 			GError* _tmp40_ = NULL;
998 			const gchar* _tmp41_ = NULL;
999 			e = _inner_error_;
1000 			_inner_error_ = NULL;
1001 			_tmp39_ = stderr;
1002 			_tmp40_ = e;
1003 			_tmp41_ = _tmp40_->message;
1004 			fprintf (_tmp39_, "%s\n", _tmp41_);
1005 			_g_error_free0 (e);
1006 		}
1007 		__finally1:
1008 		if (G_UNLIKELY (_inner_error_ != NULL)) {
1009 			_g_object_unref0 (object);
1010 			_g_object_unref0 (current_window);
1011 			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1012 			g_clear_error (&_inner_error_);
1013 			return;
1014 		}
1015 		_g_object_unref0 (object);
1016 		_g_object_unref0 (current_window);
1017 	} else {
1018 		{
1019 			CaribouKeyboard* _tmp42_ = NULL;
1020 			guint32 _tmp43_ = 0U;
1021 			_tmp42_ = self->priv->keyboard;
1022 			_tmp43_ = timestamp;
1023 			caribou_keyboard_hide (_tmp42_, _tmp43_, &_inner_error_);
1024 			if (G_UNLIKELY (_inner_error_ != NULL)) {
1025 				if (_inner_error_->domain == G_IO_ERROR) {
1026 					goto __catch2_g_io_error;
1027 				}
1028 				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1029 				g_clear_error (&_inner_error_);
1030 				return;
1031 			}
1032 		}
1033 		goto __finally2;
1034 		__catch2_g_io_error:
1035 		{
1036 			GError* e = NULL;
1037 			FILE* _tmp44_ = NULL;
1038 			GError* _tmp45_ = NULL;
1039 			const gchar* _tmp46_ = NULL;
1040 			e = _inner_error_;
1041 			_inner_error_ = NULL;
1042 			_tmp44_ = stderr;
1043 			_tmp45_ = e;
1044 			_tmp46_ = _tmp45_->message;
1045 			fprintf (_tmp44_, "%s\n", _tmp46_);
1046 			_g_error_free0 (e);
1047 		}
1048 		__finally2:
1049 		if (G_UNLIKELY (_inner_error_ != NULL)) {
1050 			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1051 			g_clear_error (&_inner_error_);
1052 			return;
1053 		}
1054 	}
1055 }
1056 
1057 
caribou_gtk_module_get_origin_geometry(CaribouGtkModule * self,GdkWindow * window,gint * x,gint * y,gint * w,gint * h)1058 static void caribou_gtk_module_get_origin_geometry (CaribouGtkModule* self, GdkWindow* window, gint* x, gint* y, gint* w, gint* h) {
1059 	gint _vala_x = 0;
1060 	gint _vala_y = 0;
1061 	gint _vala_w = 0;
1062 	gint _vala_h = 0;
1063 	GdkWindow* _tmp0_ = NULL;
1064 	gint _tmp1_ = 0;
1065 	gint _tmp2_ = 0;
1066 	GdkWindow* _tmp3_ = NULL;
1067 	gint _tmp4_ = 0;
1068 	gint _tmp5_ = 0;
1069 	g_return_if_fail (self != NULL);
1070 	g_return_if_fail (window != NULL);
1071 	_tmp0_ = window;
1072 	gdk_window_get_origin (_tmp0_, &_tmp1_, &_tmp2_);
1073 	_vala_x = _tmp1_;
1074 	_vala_y = _tmp2_;
1075 	_tmp3_ = window;
1076 	gdk_window_get_geometry (_tmp3_, NULL, NULL, &_tmp4_, &_tmp5_);
1077 	_vala_w = _tmp4_;
1078 	_vala_h = _tmp5_;
1079 	if (x) {
1080 		*x = _vala_x;
1081 	}
1082 	if (y) {
1083 		*y = _vala_y;
1084 	}
1085 	if (w) {
1086 		*w = _vala_w;
1087 	}
1088 	if (h) {
1089 		*h = _vala_h;
1090 	}
1091 }
1092 
1093 
caribou_gtk_module_unload(CaribouGtkModule * self)1094 void caribou_gtk_module_unload (CaribouGtkModule* self) {
1095 	GHashTable* _tmp0_ = NULL;
1096 	GList* _tmp1_ = NULL;
1097 	g_return_if_fail (self != NULL);
1098 	gdk_window_remove_filter (NULL, _caribou_gtk_module_event_filter_gdk_filter_func, self);
1099 	_tmp0_ = self->priv->windows;
1100 	_tmp1_ = g_hash_table_get_keys (_tmp0_);
1101 	{
1102 		GList* window_collection = NULL;
1103 		GList* window_it = NULL;
1104 		window_collection = _tmp1_;
1105 		for (window_it = window_collection; window_it != NULL; window_it = window_it->next) {
1106 			GtkWindow* _tmp2_ = NULL;
1107 			GtkWindow* window = NULL;
1108 			_tmp2_ = _g_object_ref0 ((GtkWindow*) window_it->data);
1109 			window = _tmp2_;
1110 			{
1111 				GtkWindow* _tmp3_ = NULL;
1112 				guint _tmp4_ = 0U;
1113 				GQuark _tmp5_ = 0U;
1114 				_tmp3_ = window;
1115 				g_signal_parse_name ("notify::has-toplevel-focus", G_TYPE_OBJECT, &_tmp4_, &_tmp5_, TRUE);
1116 				g_signal_handlers_disconnect_matched ((GObject*) _tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, _tmp5_, NULL, (GCallback) _caribou_gtk_module_toplevel_focus_changed_g_object_notify, self);
1117 				_g_object_unref0 (window);
1118 			}
1119 		}
1120 		_g_list_free0 (window_collection);
1121 	}
1122 }
1123 
1124 
caribou_value_gtk_module_init(GValue * value)1125 static void caribou_value_gtk_module_init (GValue* value) {
1126 	value->data[0].v_pointer = NULL;
1127 }
1128 
1129 
caribou_value_gtk_module_free_value(GValue * value)1130 static void caribou_value_gtk_module_free_value (GValue* value) {
1131 	if (value->data[0].v_pointer) {
1132 		caribou_gtk_module_unref (value->data[0].v_pointer);
1133 	}
1134 }
1135 
1136 
caribou_value_gtk_module_copy_value(const GValue * src_value,GValue * dest_value)1137 static void caribou_value_gtk_module_copy_value (const GValue* src_value, GValue* dest_value) {
1138 	if (src_value->data[0].v_pointer) {
1139 		dest_value->data[0].v_pointer = caribou_gtk_module_ref (src_value->data[0].v_pointer);
1140 	} else {
1141 		dest_value->data[0].v_pointer = NULL;
1142 	}
1143 }
1144 
1145 
caribou_value_gtk_module_peek_pointer(const GValue * value)1146 static gpointer caribou_value_gtk_module_peek_pointer (const GValue* value) {
1147 	return value->data[0].v_pointer;
1148 }
1149 
1150 
caribou_value_gtk_module_collect_value(GValue * value,guint n_collect_values,GTypeCValue * collect_values,guint collect_flags)1151 static gchar* caribou_value_gtk_module_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
1152 	if (collect_values[0].v_pointer) {
1153 		CaribouGtkModule* object;
1154 		object = collect_values[0].v_pointer;
1155 		if (object->parent_instance.g_class == NULL) {
1156 			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
1157 		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
1158 			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
1159 		}
1160 		value->data[0].v_pointer = caribou_gtk_module_ref (object);
1161 	} else {
1162 		value->data[0].v_pointer = NULL;
1163 	}
1164 	return NULL;
1165 }
1166 
1167 
caribou_value_gtk_module_lcopy_value(const GValue * value,guint n_collect_values,GTypeCValue * collect_values,guint collect_flags)1168 static gchar* caribou_value_gtk_module_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
1169 	CaribouGtkModule** object_p;
1170 	object_p = collect_values[0].v_pointer;
1171 	if (!object_p) {
1172 		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
1173 	}
1174 	if (!value->data[0].v_pointer) {
1175 		*object_p = NULL;
1176 	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
1177 		*object_p = value->data[0].v_pointer;
1178 	} else {
1179 		*object_p = caribou_gtk_module_ref (value->data[0].v_pointer);
1180 	}
1181 	return NULL;
1182 }
1183 
1184 
caribou_param_spec_gtk_module(const gchar * name,const gchar * nick,const gchar * blurb,GType object_type,GParamFlags flags)1185 GParamSpec* caribou_param_spec_gtk_module (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
1186 	CaribouParamSpecGtkModule* spec;
1187 	g_return_val_if_fail (g_type_is_a (object_type, CARIBOU_TYPE_GTK_MODULE), NULL);
1188 	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
1189 	G_PARAM_SPEC (spec)->value_type = object_type;
1190 	return G_PARAM_SPEC (spec);
1191 }
1192 
1193 
caribou_value_get_gtk_module(const GValue * value)1194 gpointer caribou_value_get_gtk_module (const GValue* value) {
1195 	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CARIBOU_TYPE_GTK_MODULE), NULL);
1196 	return value->data[0].v_pointer;
1197 }
1198 
1199 
caribou_value_set_gtk_module(GValue * value,gpointer v_object)1200 void caribou_value_set_gtk_module (GValue* value, gpointer v_object) {
1201 	CaribouGtkModule* old;
1202 	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CARIBOU_TYPE_GTK_MODULE));
1203 	old = value->data[0].v_pointer;
1204 	if (v_object) {
1205 		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, CARIBOU_TYPE_GTK_MODULE));
1206 		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
1207 		value->data[0].v_pointer = v_object;
1208 		caribou_gtk_module_ref (value->data[0].v_pointer);
1209 	} else {
1210 		value->data[0].v_pointer = NULL;
1211 	}
1212 	if (old) {
1213 		caribou_gtk_module_unref (old);
1214 	}
1215 }
1216 
1217 
caribou_value_take_gtk_module(GValue * value,gpointer v_object)1218 void caribou_value_take_gtk_module (GValue* value, gpointer v_object) {
1219 	CaribouGtkModule* old;
1220 	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CARIBOU_TYPE_GTK_MODULE));
1221 	old = value->data[0].v_pointer;
1222 	if (v_object) {
1223 		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, CARIBOU_TYPE_GTK_MODULE));
1224 		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
1225 		value->data[0].v_pointer = v_object;
1226 	} else {
1227 		value->data[0].v_pointer = NULL;
1228 	}
1229 	if (old) {
1230 		caribou_gtk_module_unref (old);
1231 	}
1232 }
1233 
1234 
caribou_gtk_module_class_init(CaribouGtkModuleClass * klass)1235 static void caribou_gtk_module_class_init (CaribouGtkModuleClass * klass) {
1236 	caribou_gtk_module_parent_class = g_type_class_peek_parent (klass);
1237 	((CaribouGtkModuleClass *) klass)->finalize = caribou_gtk_module_finalize;
1238 	g_type_class_add_private (klass, sizeof (CaribouGtkModulePrivate));
1239 }
1240 
1241 
caribou_gtk_module_instance_init(CaribouGtkModule * self)1242 static void caribou_gtk_module_instance_init (CaribouGtkModule * self) {
1243 	self->priv = CARIBOU_GTK_MODULE_GET_PRIVATE (self);
1244 	self->ref_count = 1;
1245 }
1246 
1247 
caribou_gtk_module_finalize(CaribouGtkModule * obj)1248 static void caribou_gtk_module_finalize (CaribouGtkModule* obj) {
1249 	CaribouGtkModule * self;
1250 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CARIBOU_TYPE_GTK_MODULE, CaribouGtkModule);
1251 	g_signal_handlers_destroy (self);
1252 	_g_hash_table_unref0 (self->priv->windows);
1253 	_g_object_unref0 (self->priv->keyboard);
1254 	_g_object_unref0 (self->priv->display);
1255 }
1256 
1257 
caribou_gtk_module_get_type(void)1258 GType caribou_gtk_module_get_type (void) {
1259 	static volatile gsize caribou_gtk_module_type_id__volatile = 0;
1260 	if (g_once_init_enter (&caribou_gtk_module_type_id__volatile)) {
1261 		static const GTypeValueTable g_define_type_value_table = { caribou_value_gtk_module_init, caribou_value_gtk_module_free_value, caribou_value_gtk_module_copy_value, caribou_value_gtk_module_peek_pointer, "p", caribou_value_gtk_module_collect_value, "p", caribou_value_gtk_module_lcopy_value };
1262 		static const GTypeInfo g_define_type_info = { sizeof (CaribouGtkModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) caribou_gtk_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CaribouGtkModule), 0, (GInstanceInitFunc) caribou_gtk_module_instance_init, &g_define_type_value_table };
1263 		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
1264 		GType caribou_gtk_module_type_id;
1265 		caribou_gtk_module_type_id = g_type_register_fundamental (g_type_fundamental_next (), "CaribouGtkModule", &g_define_type_info, &g_define_type_fundamental_info, 0);
1266 		g_once_init_leave (&caribou_gtk_module_type_id__volatile, caribou_gtk_module_type_id);
1267 	}
1268 	return caribou_gtk_module_type_id__volatile;
1269 }
1270 
1271 
caribou_gtk_module_ref(gpointer instance)1272 gpointer caribou_gtk_module_ref (gpointer instance) {
1273 	CaribouGtkModule* self;
1274 	self = instance;
1275 	g_atomic_int_inc (&self->ref_count);
1276 	return instance;
1277 }
1278 
1279 
caribou_gtk_module_unref(gpointer instance)1280 void caribou_gtk_module_unref (gpointer instance) {
1281 	CaribouGtkModule* self;
1282 	self = instance;
1283 	if (g_atomic_int_dec_and_test (&self->ref_count)) {
1284 		CARIBOU_GTK_MODULE_GET_CLASS (self)->finalize (self);
1285 		g_type_free_instance ((GTypeInstance *) self);
1286 	}
1287 }
1288 
1289 
1290 
1291