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