/* caribou-gtk-module.c generated by valac 0.30.0.3-b11d, the Vala compiler
 * generated from caribou-gtk-module.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/Xregion.h>
#include <gdk/gdkx.h>
#include <atk/atk.h>
#include <gobject/gvaluecollector.h>


#define CARIBOU_TYPE_KEYBOARD (caribou_keyboard_get_type ())
#define CARIBOU_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_KEYBOARD, CaribouKeyboard))
#define CARIBOU_IS_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_KEYBOARD))
#define CARIBOU_KEYBOARD_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CARIBOU_TYPE_KEYBOARD, CaribouKeyboardIface))

typedef struct _CaribouKeyboard CaribouKeyboard;
typedef struct _CaribouKeyboardIface CaribouKeyboardIface;

#define CARIBOU_TYPE_KEYBOARD_PROXY (caribou_keyboard_proxy_get_type ())
typedef GDBusProxy CaribouKeyboardProxy;
typedef GDBusProxyClass CaribouKeyboardProxyClass;

#define CARIBOU_TYPE_GTK_MODULE (caribou_gtk_module_get_type ())
#define CARIBOU_GTK_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_GTK_MODULE, CaribouGtkModule))
#define CARIBOU_GTK_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_GTK_MODULE, CaribouGtkModuleClass))
#define CARIBOU_IS_GTK_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_GTK_MODULE))
#define CARIBOU_IS_GTK_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_GTK_MODULE))
#define CARIBOU_GTK_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_GTK_MODULE, CaribouGtkModuleClass))

typedef struct _CaribouGtkModule CaribouGtkModule;
typedef struct _CaribouGtkModuleClass CaribouGtkModuleClass;
typedef struct _CaribouGtkModulePrivate CaribouGtkModulePrivate;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _caribou_gtk_module_unref0(var) ((var == NULL) ? NULL : (var = (caribou_gtk_module_unref (var), NULL)))
typedef struct _CaribouParamSpecGtkModule CaribouParamSpecGtkModule;

struct _CaribouKeyboardIface {
	GTypeInterface parent_iface;
	void (*set_cursor_location) (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
	void (*set_entry_location) (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
	void (*show) (CaribouKeyboard* self, guint32 timestamp, GError** error);
	void (*hide) (CaribouKeyboard* self, guint32 timestamp, GError** error);
};

struct _CaribouGtkModule {
	GTypeInstance parent_instance;
	volatile int ref_count;
	CaribouGtkModulePrivate * priv;
};

struct _CaribouGtkModuleClass {
	GTypeClass parent_class;
	void (*finalize) (CaribouGtkModule *self);
};

struct _CaribouGtkModulePrivate {
	GHashTable* windows;
	CaribouKeyboard* keyboard;
	GdkDisplay* display;
};

struct _Block1Data {
	int _ref_count_;
	CaribouGtkModule* self;
	GtkWindow* window;
};

struct _CaribouParamSpecGtkModule {
	GParamSpec parent_instance;
};


static gpointer caribou_gtk_module_parent_class = NULL;

GType caribou_keyboard_proxy_get_type (void) G_GNUC_CONST;
guint caribou_keyboard_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
GType caribou_keyboard_get_type (void) G_GNUC_CONST;
void caribou_keyboard_set_cursor_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
void caribou_keyboard_set_entry_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
void caribou_keyboard_show (CaribouKeyboard* self, guint32 timestamp, GError** error);
void caribou_keyboard_hide (CaribouKeyboard* self, guint32 timestamp, GError** error);
static void caribou_keyboard_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
static void caribou_keyboard_proxy_set_cursor_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
static void caribou_keyboard_proxy_set_entry_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error);
static void caribou_keyboard_proxy_show (CaribouKeyboard* self, guint32 timestamp, GError** error);
static void caribou_keyboard_proxy_hide (CaribouKeyboard* self, guint32 timestamp, GError** error);
static void caribou_keyboard_proxy_caribou_keyboard_interface_init (CaribouKeyboardIface* iface);
static void _dbus_caribou_keyboard_set_cursor_location (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void _dbus_caribou_keyboard_set_entry_location (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void _dbus_caribou_keyboard_show (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void _dbus_caribou_keyboard_hide (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
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);
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);
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);
static void _caribou_keyboard_unregister_object (gpointer user_data);
gpointer caribou_gtk_module_ref (gpointer instance);
void caribou_gtk_module_unref (gpointer instance);
GParamSpec* caribou_param_spec_gtk_module (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void caribou_value_set_gtk_module (GValue* value, gpointer v_object);
void caribou_value_take_gtk_module (GValue* value, gpointer v_object);
gpointer caribou_value_get_gtk_module (const GValue* value);
GType caribou_gtk_module_get_type (void) G_GNUC_CONST;
#define CARIBOU_GTK_MODULE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CARIBOU_TYPE_GTK_MODULE, CaribouGtkModulePrivate))
enum  {
	CARIBOU_GTK_MODULE_DUMMY_PROPERTY
};
CaribouGtkModule* caribou_gtk_module_new (void);
CaribouGtkModule* caribou_gtk_module_construct (GType object_type);
static void _g_object_unref0_ (gpointer var);
static void caribou_gtk_module_callback (CaribouGtkModule* self, GObject* obj, GAsyncResult* res);
static void _caribou_gtk_module_callback_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static GdkFilterReturn caribou_gtk_module_event_filter (CaribouGtkModule* self, GdkXEvent* xevent, GdkEvent* evt);
static GdkFilterReturn _caribou_gtk_module_event_filter_gdk_filter_func (GdkXEvent* xevent, GdkEvent* event, gpointer self);
static void caribou_gtk_module_do_focus_change (CaribouGtkModule* self, GtkWidget* widget);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void caribou_gtk_module_toplevel_focus_changed (CaribouGtkModule* self, GObject* obj, GParamSpec* prop);
static void _caribou_gtk_module_toplevel_focus_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void caribou_gtk_module_window_focus_changed (CaribouGtkModule* self, GtkWindow* window, GtkWidget* widget);
static void _caribou_gtk_module_window_focus_changed_gtk_window_set_focus (GtkWindow* _sender, GtkWidget* focus, gpointer self);
static void ___lambda4_ (Block1Data* _data1_);
static void ____lambda4__gtk_object_destroy (GtkObject* _sender, gpointer self);
static void caribou_gtk_module_get_origin_geometry (CaribouGtkModule* self, GdkWindow* window, gint* x, gint* y, gint* w, gint* h);
void caribou_gtk_module_unload (CaribouGtkModule* self);
static void caribou_gtk_module_finalize (CaribouGtkModule* obj);

static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_cursor_location_x = {-1, "x", "i"};
static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_cursor_location_y = {-1, "y", "i"};
static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_cursor_location_w = {-1, "w", "i"};
static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_cursor_location_h = {-1, "h", "i"};
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};
static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_set_cursor_location_out[] = {NULL};
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)};
static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_entry_location_x = {-1, "x", "i"};
static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_entry_location_y = {-1, "y", "i"};
static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_entry_location_w = {-1, "w", "i"};
static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_set_entry_location_h = {-1, "h", "i"};
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};
static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_set_entry_location_out[] = {NULL};
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)};
static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_show_timestamp = {-1, "timestamp", "u"};
static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_show_in[] = {&_caribou_keyboard_dbus_arg_info_show_timestamp, NULL};
static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_show_out[] = {NULL};
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)};
static const GDBusArgInfo _caribou_keyboard_dbus_arg_info_hide_timestamp = {-1, "timestamp", "u"};
static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_hide_in[] = {&_caribou_keyboard_dbus_arg_info_hide_timestamp, NULL};
static const GDBusArgInfo * const _caribou_keyboard_dbus_arg_info_hide_out[] = {NULL};
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)};
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};
static const GDBusSignalInfo * const _caribou_keyboard_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _caribou_keyboard_dbus_property_info[] = {NULL};
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)};
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};

void caribou_keyboard_set_cursor_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error) {
	g_return_if_fail (self != NULL);
	CARIBOU_KEYBOARD_GET_INTERFACE (self)->set_cursor_location (self, x, y, w, h, error);
}


void caribou_keyboard_set_entry_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error) {
	g_return_if_fail (self != NULL);
	CARIBOU_KEYBOARD_GET_INTERFACE (self)->set_entry_location (self, x, y, w, h, error);
}


void caribou_keyboard_show (CaribouKeyboard* self, guint32 timestamp, GError** error) {
	g_return_if_fail (self != NULL);
	CARIBOU_KEYBOARD_GET_INTERFACE (self)->show (self, timestamp, error);
}


void caribou_keyboard_hide (CaribouKeyboard* self, guint32 timestamp, GError** error) {
	g_return_if_fail (self != NULL);
	CARIBOU_KEYBOARD_GET_INTERFACE (self)->hide (self, timestamp, error);
}


static void caribou_keyboard_base_init (CaribouKeyboardIface * iface) {
	static gboolean initialized = FALSE;
	if (!initialized) {
		initialized = TRUE;
	}
}


GType caribou_keyboard_get_type (void) {
	static volatile gsize caribou_keyboard_type_id__volatile = 0;
	if (g_once_init_enter (&caribou_keyboard_type_id__volatile)) {
		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 };
		GType caribou_keyboard_type_id;
		caribou_keyboard_type_id = g_type_register_static (G_TYPE_INTERFACE, "CaribouKeyboard", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (caribou_keyboard_type_id, G_TYPE_OBJECT);
		g_type_set_qdata (caribou_keyboard_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) caribou_keyboard_proxy_get_type);
		g_type_set_qdata (caribou_keyboard_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.gnome.Caribou.Keyboard");
		g_type_set_qdata (caribou_keyboard_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_caribou_keyboard_dbus_interface_info));
		g_type_set_qdata (caribou_keyboard_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) caribou_keyboard_register_object);
		g_once_init_leave (&caribou_keyboard_type_id__volatile, caribou_keyboard_type_id);
	}
	return caribou_keyboard_type_id__volatile;
}


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) )
static void caribou_keyboard_proxy_class_init (CaribouKeyboardProxyClass* klass) {
	G_DBUS_PROXY_CLASS (klass)->g_signal = caribou_keyboard_proxy_g_signal;
}


static void caribou_keyboard_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
}


static void caribou_keyboard_proxy_init (CaribouKeyboardProxy* self) {
}


static void caribou_keyboard_proxy_set_cursor_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error) {
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	G_IO_ERROR;
	_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");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (x));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (y));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (w));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (h));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	_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);
	g_object_unref (_message);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}


static void caribou_keyboard_proxy_set_entry_location (CaribouKeyboard* self, gint x, gint y, gint w, gint h, GError** error) {
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	G_IO_ERROR;
	_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");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (x));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (y));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (w));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (h));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	_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);
	g_object_unref (_message);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}


static void caribou_keyboard_proxy_show (CaribouKeyboard* self, guint32 timestamp, GError** error) {
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	G_IO_ERROR;
	_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");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (timestamp));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	_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);
	g_object_unref (_message);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}


static void caribou_keyboard_proxy_hide (CaribouKeyboard* self, guint32 timestamp, GError** error) {
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	G_IO_ERROR;
	_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");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (timestamp));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	_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);
	g_object_unref (_message);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}


static void caribou_keyboard_proxy_caribou_keyboard_interface_init (CaribouKeyboardIface* iface) {
	iface->set_cursor_location = caribou_keyboard_proxy_set_cursor_location;
	iface->set_entry_location = caribou_keyboard_proxy_set_entry_location;
	iface->show = caribou_keyboard_proxy_show;
	iface->hide = caribou_keyboard_proxy_hide;
}


static void _dbus_caribou_keyboard_set_cursor_location (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gint x = 0;
	GVariant* _tmp0_;
	gint y = 0;
	GVariant* _tmp1_;
	gint w = 0;
	GVariant* _tmp2_;
	gint h = 0;
	GVariant* _tmp3_;
	GDBusMessage* _reply_message;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp0_ = g_variant_iter_next_value (&_arguments_iter);
	x = g_variant_get_int32 (_tmp0_);
	g_variant_unref (_tmp0_);
	_tmp1_ = g_variant_iter_next_value (&_arguments_iter);
	y = g_variant_get_int32 (_tmp1_);
	g_variant_unref (_tmp1_);
	_tmp2_ = g_variant_iter_next_value (&_arguments_iter);
	w = g_variant_get_int32 (_tmp2_);
	g_variant_unref (_tmp2_);
	_tmp3_ = g_variant_iter_next_value (&_arguments_iter);
	h = g_variant_get_int32 (_tmp3_);
	g_variant_unref (_tmp3_);
	caribou_keyboard_set_cursor_location (self, x, y, w, h, &error);
	if (error) {
		g_dbus_method_invocation_return_gerror (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}


static void _dbus_caribou_keyboard_set_entry_location (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gint x = 0;
	GVariant* _tmp4_;
	gint y = 0;
	GVariant* _tmp5_;
	gint w = 0;
	GVariant* _tmp6_;
	gint h = 0;
	GVariant* _tmp7_;
	GDBusMessage* _reply_message;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp4_ = g_variant_iter_next_value (&_arguments_iter);
	x = g_variant_get_int32 (_tmp4_);
	g_variant_unref (_tmp4_);
	_tmp5_ = g_variant_iter_next_value (&_arguments_iter);
	y = g_variant_get_int32 (_tmp5_);
	g_variant_unref (_tmp5_);
	_tmp6_ = g_variant_iter_next_value (&_arguments_iter);
	w = g_variant_get_int32 (_tmp6_);
	g_variant_unref (_tmp6_);
	_tmp7_ = g_variant_iter_next_value (&_arguments_iter);
	h = g_variant_get_int32 (_tmp7_);
	g_variant_unref (_tmp7_);
	caribou_keyboard_set_entry_location (self, x, y, w, h, &error);
	if (error) {
		g_dbus_method_invocation_return_gerror (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}


static void _dbus_caribou_keyboard_show (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GError* error = NULL;
	GVariantIter _arguments_iter;
	guint32 timestamp = 0U;
	GVariant* _tmp8_;
	GDBusMessage* _reply_message;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp8_ = g_variant_iter_next_value (&_arguments_iter);
	timestamp = g_variant_get_uint32 (_tmp8_);
	g_variant_unref (_tmp8_);
	caribou_keyboard_show (self, timestamp, &error);
	if (error) {
		g_dbus_method_invocation_return_gerror (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}


static void _dbus_caribou_keyboard_hide (CaribouKeyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GError* error = NULL;
	GVariantIter _arguments_iter;
	guint32 timestamp = 0U;
	GVariant* _tmp9_;
	GDBusMessage* _reply_message;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp9_ = g_variant_iter_next_value (&_arguments_iter);
	timestamp = g_variant_get_uint32 (_tmp9_);
	g_variant_unref (_tmp9_);
	caribou_keyboard_hide (self, timestamp, &error);
	if (error) {
		g_dbus_method_invocation_return_gerror (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}


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) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "SetCursorLocation") == 0) {
		_dbus_caribou_keyboard_set_cursor_location (object, parameters, invocation);
	} else if (strcmp (method_name, "SetEntryLocation") == 0) {
		_dbus_caribou_keyboard_set_entry_location (object, parameters, invocation);
	} else if (strcmp (method_name, "Show") == 0) {
		_dbus_caribou_keyboard_show (object, parameters, invocation);
	} else if (strcmp (method_name, "Hide") == 0) {
		_dbus_caribou_keyboard_hide (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}


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) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return NULL;
}


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) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return FALSE;
}


guint caribou_keyboard_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	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);
	if (!result) {
		return 0;
	}
	return result;
}


static void _caribou_keyboard_unregister_object (gpointer user_data) {
	gpointer* data;
	data = user_data;
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}


static void _g_object_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void _caribou_gtk_module_callback_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	caribou_gtk_module_callback ((CaribouGtkModule*) self, source_object, res);
	caribou_gtk_module_unref (self);
}


CaribouGtkModule* caribou_gtk_module_construct (GType object_type) {
	CaribouGtkModule* self = NULL;
	GHashTable* _tmp0_ = NULL;
	GdkDisplay* _tmp1_ = NULL;
	GdkDisplay* _tmp2_ = NULL;
	GError * _inner_error_ = NULL;
	self = (CaribouGtkModule*) g_type_create_instance (object_type);
	_tmp0_ = g_hash_table_new_full (NULL, NULL, _g_object_unref0_, NULL);
	_g_hash_table_unref0 (self->priv->windows);
	self->priv->windows = _tmp0_;
	_tmp1_ = gdk_display_get_default ();
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->priv->display);
	self->priv->display = _tmp2_;
	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);
	return self;
}


CaribouGtkModule* caribou_gtk_module_new (void) {
	return caribou_gtk_module_construct (CARIBOU_TYPE_GTK_MODULE);
}


static GdkFilterReturn _caribou_gtk_module_event_filter_gdk_filter_func (GdkXEvent* xevent, GdkEvent* event, gpointer self) {
	GdkFilterReturn result;
	result = caribou_gtk_module_event_filter ((CaribouGtkModule*) self, xevent, event);
	return result;
}


static void caribou_gtk_module_callback (CaribouGtkModule* self, GObject* obj, GAsyncResult* res) {
	GList* toplevels = NULL;
	GList* _tmp8_ = NULL;
	GList* _tmp9_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (res != NULL);
	{
		CaribouKeyboard* _tmp0_ = NULL;
		GAsyncResult* _tmp1_ = NULL;
		CaribouKeyboard* _tmp2_ = NULL;
		CaribouKeyboard* _tmp3_ = NULL;
		CaribouKeyboard* _tmp4_ = NULL;
		_tmp1_ = res;
		_tmp2_ = g_async_result_get_source_object (_tmp1_);
		_tmp3_ = g_async_initable_new_finish (_tmp2_, _tmp1_, &_inner_error_);
		g_object_unref (_tmp2_);
		_tmp0_ = (CaribouKeyboard*) _tmp3_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp4_ = _tmp0_;
		_tmp0_ = NULL;
		_g_object_unref0 (self->priv->keyboard);
		self->priv->keyboard = _tmp4_;
		_g_object_unref0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		FILE* _tmp5_ = NULL;
		GError* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = stderr;
		_tmp6_ = e;
		_tmp7_ = _tmp6_->message;
		fprintf (_tmp5_, "%s\n", _tmp7_);
		_g_error_free0 (e);
		return;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		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);
		g_clear_error (&_inner_error_);
		return;
	}
	gdk_window_add_filter (NULL, _caribou_gtk_module_event_filter_gdk_filter_func, self);
	_tmp8_ = gtk_window_list_toplevels ();
	toplevels = _tmp8_;
	_tmp9_ = toplevels;
	{
		GList* w_collection = NULL;
		GList* w_it = NULL;
		w_collection = _tmp9_;
		for (w_it = w_collection; w_it != NULL; w_it = w_it->next) {
			GtkWindow* w = NULL;
			w = (GtkWindow*) w_it->data;
			{
				GtkWindow* _tmp10_ = NULL;
				gboolean _tmp11_ = FALSE;
				gboolean _tmp12_ = FALSE;
				_tmp10_ = w;
				g_object_get (_tmp10_, "has-toplevel-focus", &_tmp11_, NULL);
				_tmp12_ = _tmp11_;
				if (_tmp12_) {
					GtkWindow* _tmp13_ = NULL;
					GtkWidget* _tmp14_ = NULL;
					_tmp13_ = w;
					_tmp14_ = gtk_window_get_focus (_tmp13_);
					caribou_gtk_module_do_focus_change (self, _tmp14_);
					break;
				}
			}
		}
	}
	_g_list_free0 (toplevels);
}


static Block1Data* block1_data_ref (Block1Data* _data1_) {
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}


static void block1_data_unref (void * _userdata_) {
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		CaribouGtkModule* self;
		self = _data1_->self;
		_g_object_unref0 (_data1_->window);
		_caribou_gtk_module_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}


static void _caribou_gtk_module_toplevel_focus_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	caribou_gtk_module_toplevel_focus_changed ((CaribouGtkModule*) self, _sender, pspec);
}


static void _caribou_gtk_module_window_focus_changed_gtk_window_set_focus (GtkWindow* _sender, GtkWidget* focus, gpointer self) {
	caribou_gtk_module_window_focus_changed ((CaribouGtkModule*) self, _sender, focus);
}


static void ___lambda4_ (Block1Data* _data1_) {
	CaribouGtkModule* self;
	GHashTable* _tmp0_ = NULL;
	GtkWindow* _tmp1_ = NULL;
	self = _data1_->self;
	_tmp0_ = self->priv->windows;
	_tmp1_ = _data1_->window;
	g_hash_table_remove (_tmp0_, _tmp1_);
}


static void ____lambda4__gtk_object_destroy (GtkObject* _sender, gpointer self) {
	___lambda4_ (self);
}


static GdkFilterReturn caribou_gtk_module_event_filter (CaribouGtkModule* self, GdkXEvent* xevent, GdkEvent* evt) {
	GdkFilterReturn result = 0;
	Block1Data* _data1_;
	GdkWindow* gdkwindow = NULL;
	void* data = NULL;
	void* pointer = NULL;
	XEvent* xev = NULL;
	void* _tmp0_ = NULL;
	GdkDisplay* _tmp1_ = NULL;
	XEvent* _tmp2_ = NULL;
	XAnyEvent _tmp3_ = {0};
	Window _tmp4_ = 0;
	void* _tmp5_ = NULL;
	GdkWindow* _tmp6_ = NULL;
	gboolean _tmp7_ = FALSE;
	GdkWindow* _tmp8_ = NULL;
	GdkWindow* _tmp11_ = NULL;
	void* _tmp12_ = NULL;
	gboolean _tmp13_ = FALSE;
	void* _tmp14_ = NULL;
	void* _tmp16_ = NULL;
	GtkWindow* _tmp17_ = NULL;
	GHashTable* _tmp18_ = NULL;
	GtkWindow* _tmp19_ = NULL;
	gconstpointer _tmp20_ = NULL;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (xevent != NULL, 0);
	g_return_val_if_fail (evt != NULL, 0);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = caribou_gtk_module_ref (self);
	pointer = xevent;
	_tmp0_ = pointer;
	xev = (XEvent*) _tmp0_;
	_tmp1_ = self->priv->display;
	_tmp2_ = xev;
	_tmp3_ = (*_tmp2_).xany;
	_tmp4_ = _tmp3_.window;
	_tmp5_ = gdk_xid_table_lookup_for_display (_tmp1_, (XID) _tmp4_);
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GDK_TYPE_WINDOW, GdkWindow));
	_g_object_unref0 (gdkwindow);
	gdkwindow = _tmp6_;
	_tmp8_ = gdkwindow;
	if (_tmp8_ == NULL) {
		_tmp7_ = TRUE;
	} else {
		GdkWindow* _tmp9_ = NULL;
		GdkWindowType _tmp10_ = 0;
		_tmp9_ = gdkwindow;
		_tmp10_ = gdk_window_get_window_type (_tmp9_);
		_tmp7_ = _tmp10_ != GDK_WINDOW_TOPLEVEL;
	}
	if (_tmp7_) {
		result = GDK_FILTER_CONTINUE;
		_g_object_unref0 (gdkwindow);
		block1_data_unref (_data1_);
		_data1_ = NULL;
		return result;
	}
	_tmp11_ = gdkwindow;
	gdk_window_get_user_data (_tmp11_, &_tmp12_);
	data = _tmp12_;
	_tmp14_ = data;
	if (_tmp14_ == NULL) {
		_tmp13_ = TRUE;
	} else {
		void* _tmp15_ = NULL;
		_tmp15_ = data;
		_tmp13_ = !G_TYPE_CHECK_INSTANCE_TYPE ((GObject*) _tmp15_, GTK_TYPE_WINDOW);
	}
	if (_tmp13_) {
		result = GDK_FILTER_CONTINUE;
		_g_object_unref0 (gdkwindow);
		block1_data_unref (_data1_);
		_data1_ = NULL;
		return result;
	}
	_tmp16_ = data;
	_tmp17_ = _g_object_ref0 ((GtkWindow*) _tmp16_);
	_g_object_unref0 (_data1_->window);
	_data1_->window = _tmp17_;
	_tmp18_ = self->priv->windows;
	_tmp19_ = _data1_->window;
	_tmp20_ = g_hash_table_lookup (_tmp18_, _tmp19_);
	if (!((gboolean) ((gintptr) _tmp20_))) {
		GHashTable* _tmp21_ = NULL;
		GtkWindow* _tmp22_ = NULL;
		GtkWindow* _tmp23_ = NULL;
		GtkWindow* _tmp24_ = NULL;
		GtkWindow* _tmp25_ = NULL;
		GtkWindow* _tmp26_ = NULL;
		_tmp21_ = self->priv->windows;
		_tmp22_ = _data1_->window;
		_tmp23_ = _g_object_ref0 (_tmp22_);
		g_hash_table_insert (_tmp21_, _tmp23_, (gpointer) ((gintptr) TRUE));
		_tmp24_ = _data1_->window;
		g_signal_connect ((GObject*) _tmp24_, "notify::has-toplevel-focus", (GCallback) _caribou_gtk_module_toplevel_focus_changed_g_object_notify, self);
		_tmp25_ = _data1_->window;
		g_signal_connect (_tmp25_, "set-focus", (GCallback) _caribou_gtk_module_window_focus_changed_gtk_window_set_focus, self);
		_tmp26_ = _data1_->window;
		g_signal_connect_data ((GtkObject*) _tmp26_, "destroy", (GCallback) ____lambda4__gtk_object_destroy, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	}
	result = GDK_FILTER_CONTINUE;
	_g_object_unref0 (gdkwindow);
	block1_data_unref (_data1_);
	_data1_ = NULL;
	return result;
}


static void caribou_gtk_module_toplevel_focus_changed (CaribouGtkModule* self, GObject* obj, GParamSpec* prop) {
	GtkWindow* window = NULL;
	GObject* _tmp0_ = NULL;
	GtkWindow* _tmp1_ = NULL;
	GtkWindow* _tmp2_ = NULL;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (obj != NULL);
	g_return_if_fail (prop != NULL);
	_tmp0_ = obj;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GTK_TYPE_WINDOW, GtkWindow));
	window = _tmp1_;
	_tmp2_ = window;
	g_object_get (_tmp2_, "has-toplevel-focus", &_tmp3_, NULL);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		GtkWindow* _tmp5_ = NULL;
		GtkWidget* _tmp6_ = NULL;
		_tmp5_ = window;
		_tmp6_ = gtk_window_get_focus (_tmp5_);
		caribou_gtk_module_do_focus_change (self, _tmp6_);
	}
	_g_object_unref0 (window);
}


static void caribou_gtk_module_window_focus_changed (CaribouGtkModule* self, GtkWindow* window, GtkWidget* widget) {
	GtkWidget* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	_tmp0_ = widget;
	caribou_gtk_module_do_focus_change (self, _tmp0_);
}


static void caribou_gtk_module_do_focus_change (CaribouGtkModule* self, GtkWidget* widget) {
	guint32 timestamp = 0U;
	GdkDisplay* _tmp0_ = NULL;
	guint32 _tmp1_ = 0U;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	GtkWidget* _tmp4_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->display;
	_tmp1_ = gdk_x11_display_get_user_time (_tmp0_);
	timestamp = _tmp1_;
	_tmp4_ = widget;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, GTK_TYPE_EDITABLE)) {
		GtkWidget* _tmp5_ = NULL;
		gboolean _tmp6_ = FALSE;
		_tmp5_ = widget;
		_tmp6_ = gtk_editable_get_editable (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GTK_TYPE_EDITABLE, GtkEditable));
		_tmp3_ = _tmp6_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		_tmp2_ = TRUE;
	} else {
		gboolean _tmp7_ = FALSE;
		GtkWidget* _tmp8_ = NULL;
		_tmp8_ = widget;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, GTK_TYPE_TEXT_VIEW)) {
			GtkWidget* _tmp9_ = NULL;
			gboolean _tmp10_ = FALSE;
			_tmp9_ = widget;
			_tmp10_ = gtk_text_view_get_editable (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, GTK_TYPE_TEXT_VIEW, GtkTextView));
			_tmp7_ = _tmp10_;
		} else {
			_tmp7_ = FALSE;
		}
		_tmp2_ = _tmp7_;
	}
	if (_tmp2_) {
		GdkWindow* current_window = NULL;
		GtkWidget* _tmp11_ = NULL;
		GdkWindow* _tmp12_ = NULL;
		GdkWindow* _tmp13_ = NULL;
		AtkObject* object = NULL;
		GtkWidget* _tmp14_ = NULL;
		AtkObject* _tmp15_ = NULL;
		AtkObject* _tmp16_ = NULL;
		gint x = 0;
		gint y = 0;
		gint w = 0;
		gint h = 0;
		gint caret_offset = 0;
		AtkObject* _tmp17_ = NULL;
		_tmp11_ = widget;
		_tmp12_ = gtk_widget_get_window (_tmp11_);
		_tmp13_ = _g_object_ref0 (_tmp12_);
		current_window = _tmp13_;
		_tmp14_ = widget;
		_tmp15_ = gtk_widget_get_accessible (_tmp14_);
		_tmp16_ = _g_object_ref0 (_tmp15_);
		object = _tmp16_;
		x = 0;
		y = 0;
		w = 0;
		h = 0;
		caret_offset = 0;
		_tmp17_ = object;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp17_, ATK_TYPE_TEXT)) {
			AtkObject* _tmp18_ = NULL;
			gint _tmp19_ = 0;
			AtkObject* _tmp20_ = NULL;
			gint _tmp21_ = 0;
			gint _tmp22_ = 0;
			gint _tmp23_ = 0;
			gint _tmp24_ = 0;
			gint _tmp25_ = 0;
			_tmp18_ = object;
			_tmp19_ = atk_text_get_caret_offset (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, ATK_TYPE_TEXT, AtkText));
			caret_offset = _tmp19_;
			_tmp20_ = object;
			_tmp21_ = caret_offset;
			atk_text_get_character_extents (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, ATK_TYPE_TEXT, AtkText), _tmp21_, &_tmp22_, &_tmp23_, &_tmp24_, &_tmp25_, ATK_XY_SCREEN);
			x = _tmp22_;
			y = _tmp23_;
			w = _tmp24_;
			h = _tmp25_;
		} else {
			GdkWindow* _tmp26_ = NULL;
			_tmp26_ = current_window;
			if (_tmp26_ != NULL) {
				GdkWindow* _tmp27_ = NULL;
				gint _tmp28_ = 0;
				gint _tmp29_ = 0;
				gint _tmp30_ = 0;
				gint _tmp31_ = 0;
				_tmp27_ = current_window;
				caribou_gtk_module_get_origin_geometry (self, _tmp27_, &_tmp28_, &_tmp29_, &_tmp30_, &_tmp31_);
				x = _tmp28_;
				y = _tmp29_;
				w = _tmp30_;
				h = _tmp31_;
			}
		}
		{
			CaribouKeyboard* _tmp32_ = NULL;
			guint32 _tmp33_ = 0U;
			CaribouKeyboard* _tmp34_ = NULL;
			gint _tmp35_ = 0;
			gint _tmp36_ = 0;
			gint _tmp37_ = 0;
			gint _tmp38_ = 0;
			_tmp32_ = self->priv->keyboard;
			_tmp33_ = timestamp;
			caribou_keyboard_show (_tmp32_, _tmp33_, &_inner_error_);
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				if (_inner_error_->domain == G_IO_ERROR) {
					goto __catch1_g_io_error;
				}
				_g_object_unref0 (object);
				_g_object_unref0 (current_window);
				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);
				g_clear_error (&_inner_error_);
				return;
			}
			_tmp34_ = self->priv->keyboard;
			_tmp35_ = x;
			_tmp36_ = y;
			_tmp37_ = w;
			_tmp38_ = h;
			caribou_keyboard_set_cursor_location (_tmp34_, _tmp35_, _tmp36_, _tmp37_, _tmp38_, &_inner_error_);
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				if (_inner_error_->domain == G_IO_ERROR) {
					goto __catch1_g_io_error;
				}
				_g_object_unref0 (object);
				_g_object_unref0 (current_window);
				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);
				g_clear_error (&_inner_error_);
				return;
			}
		}
		goto __finally1;
		__catch1_g_io_error:
		{
			GError* e = NULL;
			FILE* _tmp39_ = NULL;
			GError* _tmp40_ = NULL;
			const gchar* _tmp41_ = NULL;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp39_ = stderr;
			_tmp40_ = e;
			_tmp41_ = _tmp40_->message;
			fprintf (_tmp39_, "%s\n", _tmp41_);
			_g_error_free0 (e);
		}
		__finally1:
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_object_unref0 (object);
			_g_object_unref0 (current_window);
			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);
			g_clear_error (&_inner_error_);
			return;
		}
		_g_object_unref0 (object);
		_g_object_unref0 (current_window);
	} else {
		{
			CaribouKeyboard* _tmp42_ = NULL;
			guint32 _tmp43_ = 0U;
			_tmp42_ = self->priv->keyboard;
			_tmp43_ = timestamp;
			caribou_keyboard_hide (_tmp42_, _tmp43_, &_inner_error_);
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				if (_inner_error_->domain == G_IO_ERROR) {
					goto __catch2_g_io_error;
				}
				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);
				g_clear_error (&_inner_error_);
				return;
			}
		}
		goto __finally2;
		__catch2_g_io_error:
		{
			GError* e = NULL;
			FILE* _tmp44_ = NULL;
			GError* _tmp45_ = NULL;
			const gchar* _tmp46_ = NULL;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp44_ = stderr;
			_tmp45_ = e;
			_tmp46_ = _tmp45_->message;
			fprintf (_tmp44_, "%s\n", _tmp46_);
			_g_error_free0 (e);
		}
		__finally2:
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			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);
			g_clear_error (&_inner_error_);
			return;
		}
	}
}


static void caribou_gtk_module_get_origin_geometry (CaribouGtkModule* self, GdkWindow* window, gint* x, gint* y, gint* w, gint* h) {
	gint _vala_x = 0;
	gint _vala_y = 0;
	gint _vala_w = 0;
	gint _vala_h = 0;
	GdkWindow* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	GdkWindow* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	gint _tmp5_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	_tmp0_ = window;
	gdk_window_get_origin (_tmp0_, &_tmp1_, &_tmp2_);
	_vala_x = _tmp1_;
	_vala_y = _tmp2_;
	_tmp3_ = window;
	gdk_window_get_geometry (_tmp3_, NULL, NULL, &_tmp4_, &_tmp5_, NULL);
	_vala_w = _tmp4_;
	_vala_h = _tmp5_;
	if (x) {
		*x = _vala_x;
	}
	if (y) {
		*y = _vala_y;
	}
	if (w) {
		*w = _vala_w;
	}
	if (h) {
		*h = _vala_h;
	}
}


void caribou_gtk_module_unload (CaribouGtkModule* self) {
	GHashTable* _tmp0_ = NULL;
	GList* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	gdk_window_remove_filter (NULL, _caribou_gtk_module_event_filter_gdk_filter_func, self);
	_tmp0_ = self->priv->windows;
	_tmp1_ = g_hash_table_get_keys (_tmp0_);
	{
		GList* window_collection = NULL;
		GList* window_it = NULL;
		window_collection = _tmp1_;
		for (window_it = window_collection; window_it != NULL; window_it = window_it->next) {
			GtkWindow* _tmp2_ = NULL;
			GtkWindow* window = NULL;
			_tmp2_ = _g_object_ref0 ((GtkWindow*) window_it->data);
			window = _tmp2_;
			{
				GtkWindow* _tmp3_ = NULL;
				guint _tmp4_ = 0U;
				GQuark _tmp5_ = 0U;
				_tmp3_ = window;
				g_signal_parse_name ("notify::has-toplevel-focus", G_TYPE_OBJECT, &_tmp4_, &_tmp5_, TRUE);
				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);
				_g_object_unref0 (window);
			}
		}
		_g_list_free0 (window_collection);
	}
}


static void caribou_value_gtk_module_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void caribou_value_gtk_module_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		caribou_gtk_module_unref (value->data[0].v_pointer);
	}
}


static void caribou_value_gtk_module_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = caribou_gtk_module_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer caribou_value_gtk_module_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* caribou_value_gtk_module_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		CaribouGtkModule* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = caribou_gtk_module_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* caribou_value_gtk_module_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	CaribouGtkModule** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = caribou_gtk_module_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* caribou_param_spec_gtk_module (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	CaribouParamSpecGtkModule* spec;
	g_return_val_if_fail (g_type_is_a (object_type, CARIBOU_TYPE_GTK_MODULE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer caribou_value_get_gtk_module (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CARIBOU_TYPE_GTK_MODULE), NULL);
	return value->data[0].v_pointer;
}


void caribou_value_set_gtk_module (GValue* value, gpointer v_object) {
	CaribouGtkModule* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CARIBOU_TYPE_GTK_MODULE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, CARIBOU_TYPE_GTK_MODULE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		caribou_gtk_module_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		caribou_gtk_module_unref (old);
	}
}


void caribou_value_take_gtk_module (GValue* value, gpointer v_object) {
	CaribouGtkModule* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CARIBOU_TYPE_GTK_MODULE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, CARIBOU_TYPE_GTK_MODULE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		caribou_gtk_module_unref (old);
	}
}


static void caribou_gtk_module_class_init (CaribouGtkModuleClass * klass) {
	caribou_gtk_module_parent_class = g_type_class_peek_parent (klass);
	((CaribouGtkModuleClass *) klass)->finalize = caribou_gtk_module_finalize;
	g_type_class_add_private (klass, sizeof (CaribouGtkModulePrivate));
}


static void caribou_gtk_module_instance_init (CaribouGtkModule * self) {
	self->priv = CARIBOU_GTK_MODULE_GET_PRIVATE (self);
	self->ref_count = 1;
}


static void caribou_gtk_module_finalize (CaribouGtkModule* obj) {
	CaribouGtkModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CARIBOU_TYPE_GTK_MODULE, CaribouGtkModule);
	g_signal_handlers_destroy (self);
	_g_hash_table_unref0 (self->priv->windows);
	_g_object_unref0 (self->priv->keyboard);
	_g_object_unref0 (self->priv->display);
}


GType caribou_gtk_module_get_type (void) {
	static volatile gsize caribou_gtk_module_type_id__volatile = 0;
	if (g_once_init_enter (&caribou_gtk_module_type_id__volatile)) {
		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 };
		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 };
		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) };
		GType caribou_gtk_module_type_id;
		caribou_gtk_module_type_id = g_type_register_fundamental (g_type_fundamental_next (), "CaribouGtkModule", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&caribou_gtk_module_type_id__volatile, caribou_gtk_module_type_id);
	}
	return caribou_gtk_module_type_id__volatile;
}


gpointer caribou_gtk_module_ref (gpointer instance) {
	CaribouGtkModule* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void caribou_gtk_module_unref (gpointer instance) {
	CaribouGtkModule* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		CARIBOU_GTK_MODULE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



