| 1 |
/* daemon.c generated by valac 0.32.0.49-00a57, the Vala compiler |
| 2 |
* generated from daemon.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 <atspi/atspi.h> |
| 10 |
#include <gdk/gdk.h> |
| 11 |
#include <stdlib.h> |
| 12 |
#include <gdk/gdkx.h> |
| 13 |
#include <locale.h> |
| 14 |
#include <glib/gi18n-lib.h> |
| 15 |
#include <stdio.h> |
| 16 |
#include <glib-unix.h> |
| 17 |
#include <signal.h> |
| 18 |
|
| 19 |
|
| 20 |
#define CARIBOU_TYPE__KEYBOARD (caribou__keyboard_get_type ()) |
| 21 |
#define CARIBOU__KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE__KEYBOARD, Caribou_Keyboard)) |
| 22 |
#define CARIBOU_IS__KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE__KEYBOARD)) |
| 23 |
#define CARIBOU__KEYBOARD_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CARIBOU_TYPE__KEYBOARD, Caribou_KeyboardIface)) |
| 24 |
|
| 25 |
typedef struct _Caribou_Keyboard Caribou_Keyboard; |
| 26 |
typedef struct _Caribou_KeyboardIface Caribou_KeyboardIface; |
| 27 |
|
| 28 |
#define CARIBOU_TYPE__KEYBOARD_PROXY (caribou__keyboard_proxy_get_type ()) |
| 29 |
typedef GDBusProxy Caribou_KeyboardProxy; |
| 30 |
typedef GDBusProxyClass Caribou_KeyboardProxyClass; |
| 31 |
|
| 32 |
#define CARIBOU_TYPE_DAEMON (caribou_daemon_get_type ()) |
| 33 |
#define CARIBOU_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_DAEMON, CaribouDaemon)) |
| 34 |
#define CARIBOU_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_DAEMON, CaribouDaemonClass)) |
| 35 |
#define CARIBOU_IS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_DAEMON)) |
| 36 |
#define CARIBOU_IS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_DAEMON)) |
| 37 |
#define CARIBOU_DAEMON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_DAEMON, CaribouDaemonClass)) |
| 38 |
|
| 39 |
typedef struct _CaribouDaemon CaribouDaemon; |
| 40 |
typedef struct _CaribouDaemonClass CaribouDaemonClass; |
| 41 |
typedef struct _CaribouDaemonPrivate CaribouDaemonPrivate; |
| 42 |
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) |
| 43 |
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) |
| 44 |
#define _g_free0(var) (var = (g_free (var), NULL)) |
| 45 |
#define __vala_AtspiRect_free0(var) ((var == NULL) ? NULL : (var = (_vala_AtspiRect_free (var), NULL))) |
| 46 |
#define __vala_AtspiEvent_free0(var) ((var == NULL) ? NULL : (var = (_vala_AtspiEvent_free (var), NULL))) |
| 47 |
typedef struct _Block1Data Block1Data; |
| 48 |
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL))) |
| 49 |
|
| 50 |
struct _Caribou_KeyboardIface { |
| 51 |
GTypeInterface parent_iface; |
| 52 |
void (*set_cursor_location) (Caribou_Keyboard* self, gint x, gint y, gint w, gint h, GError** error); |
| 53 |
void (*set_entry_location) (Caribou_Keyboard* self, gint x, gint y, gint w, gint h, GError** error); |
| 54 |
void (*show) (Caribou_Keyboard* self, guint32 timestamp, GError** error); |
| 55 |
void (*hide) (Caribou_Keyboard* self, guint32 timestamp, GError** error); |
| 56 |
}; |
| 57 |
|
| 58 |
struct _CaribouDaemon { |
| 59 |
GObject parent_instance; |
| 60 |
CaribouDaemonPrivate * priv; |
| 61 |
}; |
| 62 |
|
| 63 |
struct _CaribouDaemonClass { |
| 64 |
GObjectClass parent_class; |
| 65 |
}; |
| 66 |
|
| 67 |
struct _CaribouDaemonPrivate { |
| 68 |
Caribou_Keyboard* keyboard; |
| 69 |
AtspiAccessible* current_acc; |
| 70 |
GdkDisplay* display; |
| 71 |
guint name_id; |
| 72 |
}; |
| 73 |
|
| 74 |
struct _Block1Data { |
| 75 |
int _ref_count_; |
| 76 |
CaribouDaemon* daemon; |
| 77 |
}; |
| 78 |
|
| 79 |
|
| 80 |
static gpointer caribou_daemon_parent_class = NULL; |
| 81 |
|
| 82 |
GType caribou__keyboard_proxy_get_type (void) G_GNUC_CONST; |
| 83 |
guint caribou__keyboard_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); |
| 84 |
GType caribou__keyboard_get_type (void) G_GNUC_CONST; |
| 85 |
void caribou__keyboard_set_cursor_location (Caribou_Keyboard* self, gint x, gint y, gint w, gint h, GError** error); |
| 86 |
void caribou__keyboard_set_entry_location (Caribou_Keyboard* self, gint x, gint y, gint w, gint h, GError** error); |
| 87 |
void caribou__keyboard_show (Caribou_Keyboard* self, guint32 timestamp, GError** error); |
| 88 |
void caribou__keyboard_hide (Caribou_Keyboard* self, guint32 timestamp, GError** error); |
| 89 |
static void caribou__keyboard_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters); |
| 90 |
static void caribou__keyboard_proxy_set_cursor_location (Caribou_Keyboard* self, gint x, gint y, gint w, gint h, GError** error); |
| 91 |
static void caribou__keyboard_proxy_set_entry_location (Caribou_Keyboard* self, gint x, gint y, gint w, gint h, GError** error); |
| 92 |
static void caribou__keyboard_proxy_show (Caribou_Keyboard* self, guint32 timestamp, GError** error); |
| 93 |
static void caribou__keyboard_proxy_hide (Caribou_Keyboard* self, guint32 timestamp, GError** error); |
| 94 |
static void caribou__keyboard_proxy_caribou__keyboard_interface_init (Caribou_KeyboardIface* iface); |
| 95 |
static void _dbus_caribou__keyboard_set_cursor_location (Caribou_Keyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); |
| 96 |
static void _dbus_caribou__keyboard_set_entry_location (Caribou_Keyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); |
| 97 |
static void _dbus_caribou__keyboard_show (Caribou_Keyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); |
| 98 |
static void _dbus_caribou__keyboard_hide (Caribou_Keyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); |
| 99 |
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); |
| 100 |
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); |
| 101 |
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); |
| 102 |
static void _caribou__keyboard_unregister_object (gpointer user_data); |
| 103 |
GType caribou_daemon_get_type (void) G_GNUC_CONST; |
| 104 |
guint caribou_daemon_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); |
| 105 |
#define CARIBOU_DAEMON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CARIBOU_TYPE_DAEMON, CaribouDaemonPrivate)) |
| 106 |
enum { |
| 107 |
CARIBOU_DAEMON_DUMMY_PROPERTY |
| 108 |
}; |
| 109 |
CaribouDaemon* caribou_daemon_new (void); |
| 110 |
CaribouDaemon* caribou_daemon_construct (GType object_type); |
| 111 |
static void caribou_daemon_on_bus_acquired (CaribouDaemon* self, GDBusConnection* conn); |
| 112 |
static void _caribou_daemon_on_bus_acquired_gbus_acquired_callback (GDBusConnection* connection, const gchar* name, gpointer self); |
| 113 |
void caribou_daemon_quit (CaribouDaemon* self); |
| 114 |
static void _caribou_daemon_quit_gbus_name_lost_callback (GDBusConnection* connection, const gchar* name, gpointer self); |
| 115 |
static void caribou_daemon_on_get_proxy_ready (CaribouDaemon* self, GObject* obj, GAsyncResult* res); |
| 116 |
static void caribou_daemon_register_event_listeners (CaribouDaemon* self, GError** error); |
| 117 |
static guint32 caribou_daemon_get_timestamp (CaribouDaemon* self); |
| 118 |
static void caribou_daemon_set_entry_location (CaribouDaemon* self, AtspiAccessible* acc, GError** error); |
| 119 |
static void _vala_AtspiRect_free (AtspiRect* self); |
| 120 |
static AtspiRect* _vala_AtspiRect_copy (AtspiRect* self); |
| 121 |
static void caribou_daemon_on_focus (CaribouDaemon* self, AtspiEvent* event, GError** error); |
| 122 |
static void _vala_AtspiEvent_free (AtspiEvent* self); |
| 123 |
static void caribou_daemon_on_focus_ignore_error (CaribouDaemon* self, AtspiEvent* event); |
| 124 |
static AtspiEvent* _vala_AtspiEvent_copy (AtspiEvent* self); |
| 125 |
static void caribou_daemon_on_text_caret_moved (CaribouDaemon* self, AtspiEvent* event, GError** error); |
| 126 |
static void caribou_daemon_on_text_caret_moved_ignore_error (CaribouDaemon* self, AtspiEvent* event); |
| 127 |
static void _caribou_daemon_on_focus_ignore_error_atspi_event_listener_cb (AtspiEvent* event, gpointer self); |
| 128 |
static void _caribou_daemon_on_text_caret_moved_ignore_error_atspi_event_listener_cb (AtspiEvent* event, gpointer self); |
| 129 |
static void caribou_daemon_deregister_event_listeners (CaribouDaemon* self, GError** error); |
| 130 |
void caribou_daemon_ping (CaribouDaemon* self); |
| 131 |
void caribou_daemon_run (CaribouDaemon* self); |
| 132 |
static void _caribou_daemon_on_get_proxy_ready_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self); |
| 133 |
static void caribou_daemon_finalize (GObject* obj); |
| 134 |
static void _dbus_caribou_daemon_ping (CaribouDaemon* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); |
| 135 |
static void _dbus_caribou_daemon_quit (CaribouDaemon* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); |
| 136 |
static void caribou_daemon_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); |
| 137 |
static GVariant* caribou_daemon_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); |
| 138 |
static gboolean caribou_daemon_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); |
| 139 |
static void _caribou_daemon_unregister_object (gpointer user_data); |
| 140 |
gint _vala_main (gchar** args, int args_length1); |
| 141 |
static Block1Data* block1_data_ref (Block1Data* _data1_); |
| 142 |
static void block1_data_unref (void * _userdata_); |
| 143 |
static gboolean __lambda4_ (Block1Data* _data1_); |
| 144 |
static gboolean ___lambda4__gsource_func (gpointer self); |
| 145 |
|
| 146 |
static const GDBusArgInfo _caribou__keyboard_dbus_arg_info_set_cursor_location_x = {-1, "x", "i"}; |
| 147 |
static const GDBusArgInfo _caribou__keyboard_dbus_arg_info_set_cursor_location_y = {-1, "y", "i"}; |
| 148 |
static const GDBusArgInfo _caribou__keyboard_dbus_arg_info_set_cursor_location_w = {-1, "w", "i"}; |
| 149 |
static const GDBusArgInfo _caribou__keyboard_dbus_arg_info_set_cursor_location_h = {-1, "h", "i"}; |
| 150 |
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}; |
| 151 |
static const GDBusArgInfo * const _caribou__keyboard_dbus_arg_info_set_cursor_location_out[] = {NULL}; |
| 152 |
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)}; |
| 153 |
static const GDBusArgInfo _caribou__keyboard_dbus_arg_info_set_entry_location_x = {-1, "x", "i"}; |
| 154 |
static const GDBusArgInfo _caribou__keyboard_dbus_arg_info_set_entry_location_y = {-1, "y", "i"}; |
| 155 |
static const GDBusArgInfo _caribou__keyboard_dbus_arg_info_set_entry_location_w = {-1, "w", "i"}; |
| 156 |
static const GDBusArgInfo _caribou__keyboard_dbus_arg_info_set_entry_location_h = {-1, "h", "i"}; |
| 157 |
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}; |
| 158 |
static const GDBusArgInfo * const _caribou__keyboard_dbus_arg_info_set_entry_location_out[] = {NULL}; |
| 159 |
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)}; |
| 160 |
static const GDBusArgInfo _caribou__keyboard_dbus_arg_info_show_timestamp = {-1, "timestamp", "u"}; |
| 161 |
static const GDBusArgInfo * const _caribou__keyboard_dbus_arg_info_show_in[] = {&_caribou__keyboard_dbus_arg_info_show_timestamp, NULL}; |
| 162 |
static const GDBusArgInfo * const _caribou__keyboard_dbus_arg_info_show_out[] = {NULL}; |
| 163 |
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)}; |
| 164 |
static const GDBusArgInfo _caribou__keyboard_dbus_arg_info_hide_timestamp = {-1, "timestamp", "u"}; |
| 165 |
static const GDBusArgInfo * const _caribou__keyboard_dbus_arg_info_hide_in[] = {&_caribou__keyboard_dbus_arg_info_hide_timestamp, NULL}; |
| 166 |
static const GDBusArgInfo * const _caribou__keyboard_dbus_arg_info_hide_out[] = {NULL}; |
| 167 |
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)}; |
| 168 |
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}; |
| 169 |
static const GDBusSignalInfo * const _caribou__keyboard_dbus_signal_info[] = {NULL}; |
| 170 |
static const GDBusPropertyInfo * const _caribou__keyboard_dbus_property_info[] = {NULL}; |
| 171 |
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)}; |
| 172 |
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}; |
| 173 |
static const GDBusArgInfo * const _caribou_daemon_dbus_arg_info_ping_in[] = {NULL}; |
| 174 |
static const GDBusArgInfo * const _caribou_daemon_dbus_arg_info_ping_out[] = {NULL}; |
| 175 |
static const GDBusMethodInfo _caribou_daemon_dbus_method_info_ping = {-1, "Run", (GDBusArgInfo **) (&_caribou_daemon_dbus_arg_info_ping_in), (GDBusArgInfo **) (&_caribou_daemon_dbus_arg_info_ping_out)}; |
| 176 |
static const GDBusArgInfo * const _caribou_daemon_dbus_arg_info_quit_in[] = {NULL}; |
| 177 |
static const GDBusArgInfo * const _caribou_daemon_dbus_arg_info_quit_out[] = {NULL}; |
| 178 |
static const GDBusMethodInfo _caribou_daemon_dbus_method_info_quit = {-1, "Quit", (GDBusArgInfo **) (&_caribou_daemon_dbus_arg_info_quit_in), (GDBusArgInfo **) (&_caribou_daemon_dbus_arg_info_quit_out)}; |
| 179 |
static const GDBusMethodInfo * const _caribou_daemon_dbus_method_info[] = {&_caribou_daemon_dbus_method_info_ping, &_caribou_daemon_dbus_method_info_quit, NULL}; |
| 180 |
static const GDBusSignalInfo * const _caribou_daemon_dbus_signal_info[] = {NULL}; |
| 181 |
static const GDBusPropertyInfo * const _caribou_daemon_dbus_property_info[] = {NULL}; |
| 182 |
static const GDBusInterfaceInfo _caribou_daemon_dbus_interface_info = {-1, "org.gnome.Caribou.Daemon", (GDBusMethodInfo **) (&_caribou_daemon_dbus_method_info), (GDBusSignalInfo **) (&_caribou_daemon_dbus_signal_info), (GDBusPropertyInfo **) (&_caribou_daemon_dbus_property_info)}; |
| 183 |
static const GDBusInterfaceVTable _caribou_daemon_dbus_interface_vtable = {caribou_daemon_dbus_interface_method_call, caribou_daemon_dbus_interface_get_property, caribou_daemon_dbus_interface_set_property}; |
| 184 |
const GOptionEntry options[1] = {{NULL}}; |
| 185 |
|
| 186 |
void caribou__keyboard_set_cursor_location (Caribou_Keyboard* self, gint x, gint y, gint w, gint h, GError** error) { |
| 187 |
g_return_if_fail (self != NULL); |
| 188 |
CARIBOU__KEYBOARD_GET_INTERFACE (self)->set_cursor_location (self, x, y, w, h, error); |
| 189 |
} |
| 190 |
|
| 191 |
|
| 192 |
void caribou__keyboard_set_entry_location (Caribou_Keyboard* self, gint x, gint y, gint w, gint h, GError** error) { |
| 193 |
g_return_if_fail (self != NULL); |
| 194 |
CARIBOU__KEYBOARD_GET_INTERFACE (self)->set_entry_location (self, x, y, w, h, error); |
| 195 |
} |
| 196 |
|
| 197 |
|
| 198 |
void caribou__keyboard_show (Caribou_Keyboard* self, guint32 timestamp, GError** error) { |
| 199 |
g_return_if_fail (self != NULL); |
| 200 |
CARIBOU__KEYBOARD_GET_INTERFACE (self)->show (self, timestamp, error); |
| 201 |
} |
| 202 |
|
| 203 |
|
| 204 |
void caribou__keyboard_hide (Caribou_Keyboard* self, guint32 timestamp, GError** error) { |
| 205 |
g_return_if_fail (self != NULL); |
| 206 |
CARIBOU__KEYBOARD_GET_INTERFACE (self)->hide (self, timestamp, error); |
| 207 |
} |
| 208 |
|
| 209 |
|
| 210 |
static void caribou__keyboard_base_init (Caribou_KeyboardIface * iface) { |
| 211 |
static gboolean initialized = FALSE; |
| 212 |
if (!initialized) { |
| 213 |
initialized = TRUE; |
| 214 |
} |
| 215 |
} |
| 216 |
|
| 217 |
|
| 218 |
GType caribou__keyboard_get_type (void) { |
| 219 |
static volatile gsize caribou__keyboard_type_id__volatile = 0; |
| 220 |
if (g_once_init_enter (&caribou__keyboard_type_id__volatile)) { |
| 221 |
static const GTypeInfo g_define_type_info = { sizeof (Caribou_KeyboardIface), (GBaseInitFunc) caribou__keyboard_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; |
| 222 |
GType caribou__keyboard_type_id; |
| 223 |
caribou__keyboard_type_id = g_type_register_static (G_TYPE_INTERFACE, "Caribou_Keyboard", &g_define_type_info, 0); |
| 224 |
g_type_interface_add_prerequisite (caribou__keyboard_type_id, G_TYPE_OBJECT); |
| 225 |
g_type_set_qdata (caribou__keyboard_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) caribou__keyboard_proxy_get_type); |
| 226 |
g_type_set_qdata (caribou__keyboard_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.gnome.Caribou.Keyboard"); |
| 227 |
g_type_set_qdata (caribou__keyboard_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_caribou__keyboard_dbus_interface_info)); |
| 228 |
g_type_set_qdata (caribou__keyboard_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) caribou__keyboard_register_object); |
| 229 |
g_once_init_leave (&caribou__keyboard_type_id__volatile, caribou__keyboard_type_id); |
| 230 |
} |
| 231 |
return caribou__keyboard_type_id__volatile; |
| 232 |
} |
| 233 |
|
| 234 |
|
| 235 |
G_DEFINE_TYPE_EXTENDED (Caribou_KeyboardProxy, caribou__keyboard_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (CARIBOU_TYPE__KEYBOARD, caribou__keyboard_proxy_caribou__keyboard_interface_init) ) |
| 236 |
static void caribou__keyboard_proxy_class_init (Caribou_KeyboardProxyClass* klass) { |
| 237 |
G_DBUS_PROXY_CLASS (klass)->g_signal = caribou__keyboard_proxy_g_signal; |
| 238 |
} |
| 239 |
|
| 240 |
|
| 241 |
static void caribou__keyboard_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) { |
| 242 |
} |
| 243 |
|
| 244 |
|
| 245 |
static void caribou__keyboard_proxy_init (Caribou_KeyboardProxy* self) { |
| 246 |
} |
| 247 |
|
| 248 |
|
| 249 |
static void caribou__keyboard_proxy_set_cursor_location (Caribou_Keyboard* self, gint x, gint y, gint w, gint h, GError** error) { |
| 250 |
GDBusMessage *_message; |
| 251 |
GVariant *_arguments; |
| 252 |
GVariantBuilder _arguments_builder; |
| 253 |
GDBusMessage *_reply_message; |
| 254 |
G_IO_ERROR; |
| 255 |
_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"); |
| 256 |
g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); |
| 257 |
g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (x)); |
| 258 |
g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (y)); |
| 259 |
g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (w)); |
| 260 |
g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (h)); |
| 261 |
_arguments = g_variant_builder_end (&_arguments_builder); |
| 262 |
g_dbus_message_set_body (_message, _arguments); |
| 263 |
_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); |
| 264 |
g_object_unref (_message); |
| 265 |
if (!_reply_message) { |
| 266 |
return; |
| 267 |
} |
| 268 |
if (g_dbus_message_to_gerror (_reply_message, error)) { |
| 269 |
g_object_unref (_reply_message); |
| 270 |
return; |
| 271 |
} |
| 272 |
g_object_unref (_reply_message); |
| 273 |
} |
| 274 |
|
| 275 |
|
| 276 |
static void caribou__keyboard_proxy_set_entry_location (Caribou_Keyboard* self, gint x, gint y, gint w, gint h, GError** error) { |
| 277 |
GDBusMessage *_message; |
| 278 |
GVariant *_arguments; |
| 279 |
GVariantBuilder _arguments_builder; |
| 280 |
GDBusMessage *_reply_message; |
| 281 |
G_IO_ERROR; |
| 282 |
_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"); |
| 283 |
g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); |
| 284 |
g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (x)); |
| 285 |
g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (y)); |
| 286 |
g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (w)); |
| 287 |
g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (h)); |
| 288 |
_arguments = g_variant_builder_end (&_arguments_builder); |
| 289 |
g_dbus_message_set_body (_message, _arguments); |
| 290 |
_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); |
| 291 |
g_object_unref (_message); |
| 292 |
if (!_reply_message) { |
| 293 |
return; |
| 294 |
} |
| 295 |
if (g_dbus_message_to_gerror (_reply_message, error)) { |
| 296 |
g_object_unref (_reply_message); |
| 297 |
return; |
| 298 |
} |
| 299 |
g_object_unref (_reply_message); |
| 300 |
} |
| 301 |
|
| 302 |
|
| 303 |
static void caribou__keyboard_proxy_show (Caribou_Keyboard* self, guint32 timestamp, GError** error) { |
| 304 |
GDBusMessage *_message; |
| 305 |
GVariant *_arguments; |
| 306 |
GVariantBuilder _arguments_builder; |
| 307 |
GDBusMessage *_reply_message; |
| 308 |
G_IO_ERROR; |
| 309 |
_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"); |
| 310 |
g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); |
| 311 |
g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (timestamp)); |
| 312 |
_arguments = g_variant_builder_end (&_arguments_builder); |
| 313 |
g_dbus_message_set_body (_message, _arguments); |
| 314 |
_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); |
| 315 |
g_object_unref (_message); |
| 316 |
if (!_reply_message) { |
| 317 |
return; |
| 318 |
} |
| 319 |
if (g_dbus_message_to_gerror (_reply_message, error)) { |
| 320 |
g_object_unref (_reply_message); |
| 321 |
return; |
| 322 |
} |
| 323 |
g_object_unref (_reply_message); |
| 324 |
} |
| 325 |
|
| 326 |
|
| 327 |
static void caribou__keyboard_proxy_hide (Caribou_Keyboard* self, guint32 timestamp, GError** error) { |
| 328 |
GDBusMessage *_message; |
| 329 |
GVariant *_arguments; |
| 330 |
GVariantBuilder _arguments_builder; |
| 331 |
GDBusMessage *_reply_message; |
| 332 |
G_IO_ERROR; |
| 333 |
_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"); |
| 334 |
g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); |
| 335 |
g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (timestamp)); |
| 336 |
_arguments = g_variant_builder_end (&_arguments_builder); |
| 337 |
g_dbus_message_set_body (_message, _arguments); |
| 338 |
_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); |
| 339 |
g_object_unref (_message); |
| 340 |
if (!_reply_message) { |
| 341 |
return; |
| 342 |
} |
| 343 |
if (g_dbus_message_to_gerror (_reply_message, error)) { |
| 344 |
g_object_unref (_reply_message); |
| 345 |
return; |
| 346 |
} |
| 347 |
g_object_unref (_reply_message); |
| 348 |
} |
| 349 |
|
| 350 |
|
| 351 |
static void caribou__keyboard_proxy_caribou__keyboard_interface_init (Caribou_KeyboardIface* iface) { |
| 352 |
iface->set_cursor_location = caribou__keyboard_proxy_set_cursor_location; |
| 353 |
iface->set_entry_location = caribou__keyboard_proxy_set_entry_location; |
| 354 |
iface->show = caribou__keyboard_proxy_show; |
| 355 |
iface->hide = caribou__keyboard_proxy_hide; |
| 356 |
} |
| 357 |
|
| 358 |
|
| 359 |
static void _dbus_caribou__keyboard_set_cursor_location (Caribou_Keyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { |
| 360 |
GError* error = NULL; |
| 361 |
GVariantIter _arguments_iter; |
| 362 |
gint x = 0; |
| 363 |
GVariant* _tmp0_; |
| 364 |
gint y = 0; |
| 365 |
GVariant* _tmp1_; |
| 366 |
gint w = 0; |
| 367 |
GVariant* _tmp2_; |
| 368 |
gint h = 0; |
| 369 |
GVariant* _tmp3_; |
| 370 |
GDBusMessage* _reply_message; |
| 371 |
GVariant* _reply; |
| 372 |
GVariantBuilder _reply_builder; |
| 373 |
g_variant_iter_init (&_arguments_iter, _parameters_); |
| 374 |
_tmp0_ = g_variant_iter_next_value (&_arguments_iter); |
| 375 |
x = g_variant_get_int32 (_tmp0_); |
| 376 |
g_variant_unref (_tmp0_); |
| 377 |
_tmp1_ = g_variant_iter_next_value (&_arguments_iter); |
| 378 |
y = g_variant_get_int32 (_tmp1_); |
| 379 |
g_variant_unref (_tmp1_); |
| 380 |
_tmp2_ = g_variant_iter_next_value (&_arguments_iter); |
| 381 |
w = g_variant_get_int32 (_tmp2_); |
| 382 |
g_variant_unref (_tmp2_); |
| 383 |
_tmp3_ = g_variant_iter_next_value (&_arguments_iter); |
| 384 |
h = g_variant_get_int32 (_tmp3_); |
| 385 |
g_variant_unref (_tmp3_); |
| 386 |
caribou__keyboard_set_cursor_location (self, x, y, w, h, &error); |
| 387 |
if (error) { |
| 388 |
g_dbus_method_invocation_return_gerror (invocation, error); |
| 389 |
return; |
| 390 |
} |
| 391 |
_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); |
| 392 |
g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); |
| 393 |
_reply = g_variant_builder_end (&_reply_builder); |
| 394 |
g_dbus_message_set_body (_reply_message, _reply); |
| 395 |
g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); |
| 396 |
g_object_unref (invocation); |
| 397 |
g_object_unref (_reply_message); |
| 398 |
} |
| 399 |
|
| 400 |
|
| 401 |
static void _dbus_caribou__keyboard_set_entry_location (Caribou_Keyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { |
| 402 |
GError* error = NULL; |
| 403 |
GVariantIter _arguments_iter; |
| 404 |
gint x = 0; |
| 405 |
GVariant* _tmp4_; |
| 406 |
gint y = 0; |
| 407 |
GVariant* _tmp5_; |
| 408 |
gint w = 0; |
| 409 |
GVariant* _tmp6_; |
| 410 |
gint h = 0; |
| 411 |
GVariant* _tmp7_; |
| 412 |
GDBusMessage* _reply_message; |
| 413 |
GVariant* _reply; |
| 414 |
GVariantBuilder _reply_builder; |
| 415 |
g_variant_iter_init (&_arguments_iter, _parameters_); |
| 416 |
_tmp4_ = g_variant_iter_next_value (&_arguments_iter); |
| 417 |
x = g_variant_get_int32 (_tmp4_); |
| 418 |
g_variant_unref (_tmp4_); |
| 419 |
_tmp5_ = g_variant_iter_next_value (&_arguments_iter); |
| 420 |
y = g_variant_get_int32 (_tmp5_); |
| 421 |
g_variant_unref (_tmp5_); |
| 422 |
_tmp6_ = g_variant_iter_next_value (&_arguments_iter); |
| 423 |
w = g_variant_get_int32 (_tmp6_); |
| 424 |
g_variant_unref (_tmp6_); |
| 425 |
_tmp7_ = g_variant_iter_next_value (&_arguments_iter); |
| 426 |
h = g_variant_get_int32 (_tmp7_); |
| 427 |
g_variant_unref (_tmp7_); |
| 428 |
caribou__keyboard_set_entry_location (self, x, y, w, h, &error); |
| 429 |
if (error) { |
| 430 |
g_dbus_method_invocation_return_gerror (invocation, error); |
| 431 |
return; |
| 432 |
} |
| 433 |
_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); |
| 434 |
g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); |
| 435 |
_reply = g_variant_builder_end (&_reply_builder); |
| 436 |
g_dbus_message_set_body (_reply_message, _reply); |
| 437 |
g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); |
| 438 |
g_object_unref (invocation); |
| 439 |
g_object_unref (_reply_message); |
| 440 |
} |
| 441 |
|
| 442 |
|
| 443 |
static void _dbus_caribou__keyboard_show (Caribou_Keyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { |
| 444 |
GError* error = NULL; |
| 445 |
GVariantIter _arguments_iter; |
| 446 |
guint32 timestamp = 0U; |
| 447 |
GVariant* _tmp8_; |
| 448 |
GDBusMessage* _reply_message; |
| 449 |
GVariant* _reply; |
| 450 |
GVariantBuilder _reply_builder; |
| 451 |
g_variant_iter_init (&_arguments_iter, _parameters_); |
| 452 |
_tmp8_ = g_variant_iter_next_value (&_arguments_iter); |
| 453 |
timestamp = g_variant_get_uint32 (_tmp8_); |
| 454 |
g_variant_unref (_tmp8_); |
| 455 |
caribou__keyboard_show (self, timestamp, &error); |
| 456 |
if (error) { |
| 457 |
g_dbus_method_invocation_return_gerror (invocation, error); |
| 458 |
return; |
| 459 |
} |
| 460 |
_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); |
| 461 |
g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); |
| 462 |
_reply = g_variant_builder_end (&_reply_builder); |
| 463 |
g_dbus_message_set_body (_reply_message, _reply); |
| 464 |
g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); |
| 465 |
g_object_unref (invocation); |
| 466 |
g_object_unref (_reply_message); |
| 467 |
} |
| 468 |
|
| 469 |
|
| 470 |
static void _dbus_caribou__keyboard_hide (Caribou_Keyboard* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { |
| 471 |
GError* error = NULL; |
| 472 |
GVariantIter _arguments_iter; |
| 473 |
guint32 timestamp = 0U; |
| 474 |
GVariant* _tmp9_; |
| 475 |
GDBusMessage* _reply_message; |
| 476 |
GVariant* _reply; |
| 477 |
GVariantBuilder _reply_builder; |
| 478 |
g_variant_iter_init (&_arguments_iter, _parameters_); |
| 479 |
_tmp9_ = g_variant_iter_next_value (&_arguments_iter); |
| 480 |
timestamp = g_variant_get_uint32 (_tmp9_); |
| 481 |
g_variant_unref (_tmp9_); |
| 482 |
caribou__keyboard_hide (self, timestamp, &error); |
| 483 |
if (error) { |
| 484 |
g_dbus_method_invocation_return_gerror (invocation, error); |
| 485 |
return; |
| 486 |
} |
| 487 |
_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); |
| 488 |
g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); |
| 489 |
_reply = g_variant_builder_end (&_reply_builder); |
| 490 |
g_dbus_message_set_body (_reply_message, _reply); |
| 491 |
g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); |
| 492 |
g_object_unref (invocation); |
| 493 |
g_object_unref (_reply_message); |
| 494 |
} |
| 495 |
|
| 496 |
|
| 497 |
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) { |
| 498 |
gpointer* data; |
| 499 |
gpointer object; |
| 500 |
data = user_data; |
| 501 |
object = data[0]; |
| 502 |
if (strcmp (method_name, "SetCursorLocation") == 0) { |
| 503 |
_dbus_caribou__keyboard_set_cursor_location (object, parameters, invocation); |
| 504 |
} else if (strcmp (method_name, "SetEntryLocation") == 0) { |
| 505 |
_dbus_caribou__keyboard_set_entry_location (object, parameters, invocation); |
| 506 |
} else if (strcmp (method_name, "Show") == 0) { |
| 507 |
_dbus_caribou__keyboard_show (object, parameters, invocation); |
| 508 |
} else if (strcmp (method_name, "Hide") == 0) { |
| 509 |
_dbus_caribou__keyboard_hide (object, parameters, invocation); |
| 510 |
} else { |
| 511 |
g_object_unref (invocation); |
| 512 |
} |
| 513 |
} |
| 514 |
|
| 515 |
|
| 516 |
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) { |
| 517 |
gpointer* data; |
| 518 |
gpointer object; |
| 519 |
data = user_data; |
| 520 |
object = data[0]; |
| 521 |
return NULL; |
| 522 |
} |
| 523 |
|
| 524 |
|
| 525 |
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) { |
| 526 |
gpointer* data; |
| 527 |
gpointer object; |
| 528 |
data = user_data; |
| 529 |
object = data[0]; |
| 530 |
return FALSE; |
| 531 |
} |
| 532 |
|
| 533 |
|
| 534 |
guint caribou__keyboard_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) { |
| 535 |
guint result; |
| 536 |
gpointer *data; |
| 537 |
data = g_new (gpointer, 3); |
| 538 |
data[0] = g_object_ref (object); |
| 539 |
data[1] = g_object_ref (connection); |
| 540 |
data[2] = g_strdup (path); |
| 541 |
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); |
| 542 |
if (!result) { |
| 543 |
return 0; |
| 544 |
} |
| 545 |
return result; |
| 546 |
} |
| 547 |
|
| 548 |
|
| 549 |
static void _caribou__keyboard_unregister_object (gpointer user_data) { |
| 550 |
gpointer* data; |
| 551 |
data = user_data; |
| 552 |
g_object_unref (data[0]); |
| 553 |
g_object_unref (data[1]); |
| 554 |
g_free (data[2]); |
| 555 |
g_free (data); |
| 556 |
} |
| 557 |
|
| 558 |
|
| 559 |
static void _caribou_daemon_on_bus_acquired_gbus_acquired_callback (GDBusConnection* connection, const gchar* name, gpointer self) { |
| 560 |
caribou_daemon_on_bus_acquired ((CaribouDaemon*) self, connection); |
| 561 |
} |
| 562 |
|
| 563 |
|
| 564 |
static void _caribou_daemon_quit_gbus_name_lost_callback (GDBusConnection* connection, const gchar* name, gpointer self) { |
| 565 |
caribou_daemon_quit ((CaribouDaemon*) self); |
| 566 |
} |
| 567 |
|
| 568 |
|
| 569 |
CaribouDaemon* caribou_daemon_construct (GType object_type) { |
| 570 |
CaribouDaemon * self = NULL; |
| 571 |
GdkDisplay* _tmp0_ = NULL; |
| 572 |
guint _tmp1_ = 0U; |
| 573 |
self = (CaribouDaemon*) g_object_new (object_type, NULL); |
| 574 |
_tmp0_ = gdk_display_get_default (); |
| 575 |
self->priv->display = _tmp0_; |
| 576 |
_tmp1_ = g_bus_own_name_with_closures (G_BUS_TYPE_SESSION, "org.gnome.Caribou.Daemon", G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | G_BUS_NAME_OWNER_FLAGS_REPLACE, (GClosure*) ((_caribou_daemon_on_bus_acquired_gbus_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _caribou_daemon_on_bus_acquired_gbus_acquired_callback, g_object_ref (self), g_object_unref)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((_caribou_daemon_quit_gbus_name_lost_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _caribou_daemon_quit_gbus_name_lost_callback, g_object_ref (self), g_object_unref))); |
| 577 |
self->priv->name_id = _tmp1_; |
| 578 |
return self; |
| 579 |
} |
| 580 |
|
| 581 |
|
| 582 |
CaribouDaemon* caribou_daemon_new (void) { |
| 583 |
return caribou_daemon_construct (CARIBOU_TYPE_DAEMON); |
| 584 |
} |
| 585 |
|
| 586 |
|
| 587 |
static void caribou_daemon_on_bus_acquired (CaribouDaemon* self, GDBusConnection* conn) { |
| 588 |
GError * _inner_error_ = NULL; |
| 589 |
g_return_if_fail (self != NULL); |
| 590 |
g_return_if_fail (conn != NULL); |
| 591 |
{ |
| 592 |
GDBusConnection* _tmp0_ = NULL; |
| 593 |
_tmp0_ = conn; |
| 594 |
caribou_daemon_register_object (self, _tmp0_, "/org/gnome/Caribou/Daemon", &_inner_error_); |
| 595 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 596 |
if (_inner_error_->domain == G_IO_ERROR) { |
| 597 |
goto __catch0_g_io_error; |
| 598 |
} |
| 599 |
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); |
| 600 |
g_clear_error (&_inner_error_); |
| 601 |
return; |
| 602 |
} |
| 603 |
} |
| 604 |
goto __finally0; |
| 605 |
__catch0_g_io_error: |
| 606 |
{ |
| 607 |
GError* e = NULL; |
| 608 |
const gchar* _tmp1_ = NULL; |
| 609 |
e = _inner_error_; |
| 610 |
_inner_error_ = NULL; |
| 611 |
_tmp1_ = e->message; |
| 612 |
g_error ("daemon.vala:38: Could not register D-Bus service: %s", _tmp1_); |
| 613 |
_g_error_free0 (e); |
| 614 |
} |
| 615 |
__finally0: |
| 616 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 617 |
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); |
| 618 |
g_clear_error (&_inner_error_); |
| 619 |
return; |
| 620 |
} |
| 621 |
} |
| 622 |
|
| 623 |
|
| 624 |
static void caribou_daemon_on_get_proxy_ready (CaribouDaemon* self, GObject* obj, GAsyncResult* res) { |
| 625 |
GError * _inner_error_ = NULL; |
| 626 |
g_return_if_fail (self != NULL); |
| 627 |
g_return_if_fail (res != NULL); |
| 628 |
{ |
| 629 |
Caribou_Keyboard* _tmp0_ = NULL; |
| 630 |
GAsyncResult* _tmp1_ = NULL; |
| 631 |
Caribou_Keyboard* _tmp2_ = NULL; |
| 632 |
Caribou_Keyboard* _tmp3_ = NULL; |
| 633 |
Caribou_Keyboard* _tmp4_ = NULL; |
| 634 |
_tmp1_ = res; |
| 635 |
_tmp2_ = g_async_result_get_source_object (_tmp1_); |
| 636 |
_tmp3_ = g_async_initable_new_finish (_tmp2_, _tmp1_, &_inner_error_); |
| 637 |
g_object_unref (_tmp2_); |
| 638 |
_tmp0_ = (Caribou_Keyboard*) _tmp3_; |
| 639 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 640 |
goto __catch1_g_error; |
| 641 |
} |
| 642 |
_tmp4_ = _tmp0_; |
| 643 |
_tmp0_ = NULL; |
| 644 |
_g_object_unref0 (self->priv->keyboard); |
| 645 |
self->priv->keyboard = _tmp4_; |
| 646 |
_g_object_unref0 (_tmp0_); |
| 647 |
} |
| 648 |
goto __finally1; |
| 649 |
__catch1_g_error: |
| 650 |
{ |
| 651 |
GError* e = NULL; |
| 652 |
const gchar* _tmp5_ = NULL; |
| 653 |
gchar* _tmp6_ = NULL; |
| 654 |
gchar* _tmp7_ = NULL; |
| 655 |
e = _inner_error_; |
| 656 |
_inner_error_ = NULL; |
| 657 |
_tmp5_ = e->message; |
| 658 |
_tmp6_ = g_strdup_printf ("%s\n", _tmp5_); |
| 659 |
_tmp7_ = _tmp6_; |
| 660 |
g_error ("daemon.vala:46: %s", _tmp7_); |
| 661 |
_g_free0 (_tmp7_); |
| 662 |
_g_error_free0 (e); |
| 663 |
} |
| 664 |
__finally1: |
| 665 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 666 |
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); |
| 667 |
g_clear_error (&_inner_error_); |
| 668 |
return; |
| 669 |
} |
| 670 |
{ |
| 671 |
caribou_daemon_register_event_listeners (self, &_inner_error_); |
| 672 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 673 |
goto __catch2_g_error; |
| 674 |
} |
| 675 |
} |
| 676 |
goto __finally2; |
| 677 |
__catch2_g_error: |
| 678 |
{ |
| 679 |
GError* e = NULL; |
| 680 |
GError* _tmp8_ = NULL; |
| 681 |
const gchar* _tmp9_ = NULL; |
| 682 |
e = _inner_error_; |
| 683 |
_inner_error_ = NULL; |
| 684 |
_tmp8_ = e; |
| 685 |
_tmp9_ = _tmp8_->message; |
| 686 |
g_warning ("daemon.vala:52: can't register event listeners: %s", _tmp9_); |
| 687 |
_g_error_free0 (e); |
| 688 |
} |
| 689 |
__finally2: |
| 690 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 691 |
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); |
| 692 |
g_clear_error (&_inner_error_); |
| 693 |
return; |
| 694 |
} |
| 695 |
} |
| 696 |
|
| 697 |
|
| 698 |
static guint32 caribou_daemon_get_timestamp (CaribouDaemon* self) { |
| 699 |
guint32 result = 0U; |
| 700 |
GdkDisplay* _tmp0_ = NULL; |
| 701 |
g_return_val_if_fail (self != NULL, 0U); |
| 702 |
_tmp0_ = self->priv->display; |
| 703 |
if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GDK_TYPE_X11_DISPLAY)) { |
| 704 |
GdkDisplay* _tmp1_ = NULL; |
| 705 |
guint32 _tmp2_ = 0U; |
| 706 |
_tmp1_ = self->priv->display; |
| 707 |
_tmp2_ = gdk_x11_display_get_user_time (_tmp1_); |
| 708 |
result = _tmp2_; |
| 709 |
return result; |
| 710 |
} else { |
| 711 |
result = (guint32) 0; |
| 712 |
return result; |
| 713 |
} |
| 714 |
} |
| 715 |
|
| 716 |
|
| 717 |
static void _vala_AtspiRect_free (AtspiRect* self) { |
| 718 |
g_boxed_free (atspi_rect_get_type (), self); |
| 719 |
} |
| 720 |
|
| 721 |
|
| 722 |
static AtspiRect* _vala_AtspiRect_copy (AtspiRect* self) { |
| 723 |
return g_boxed_copy (atspi_rect_get_type (), self); |
| 724 |
} |
| 725 |
|
| 726 |
|
| 727 |
static gpointer __vala_AtspiRect_copy0 (gpointer self) { |
| 728 |
return self ? _vala_AtspiRect_copy (self) : NULL; |
| 729 |
} |
| 730 |
|
| 731 |
|
| 732 |
static void caribou_daemon_set_entry_location (CaribouDaemon* self, AtspiAccessible* acc, GError** error) { |
| 733 |
AtspiText* text = NULL; |
| 734 |
AtspiAccessible* _tmp0_ = NULL; |
| 735 |
AtspiText* _tmp1_ = NULL; |
| 736 |
gint _tmp2_ = 0; |
| 737 |
AtspiText* _tmp3_ = NULL; |
| 738 |
gint _tmp4_ = 0; |
| 739 |
AtspiRect* rect = NULL; |
| 740 |
AtspiText* _tmp5_ = NULL; |
| 741 |
AtspiRect* _tmp6_ = NULL; |
| 742 |
AtspiComponent* component = NULL; |
| 743 |
AtspiAccessible* _tmp7_ = NULL; |
| 744 |
AtspiComponent* _tmp8_ = NULL; |
| 745 |
AtspiRect* entry_rect = NULL; |
| 746 |
AtspiComponent* _tmp9_ = NULL; |
| 747 |
AtspiRect* _tmp10_ = NULL; |
| 748 |
gboolean _tmp11_ = FALSE; |
| 749 |
gboolean _tmp12_ = FALSE; |
| 750 |
gboolean _tmp13_ = FALSE; |
| 751 |
AtspiRect* _tmp14_ = NULL; |
| 752 |
gint _tmp15_ = 0; |
| 753 |
Caribou_Keyboard* _tmp24_ = NULL; |
| 754 |
AtspiRect* _tmp25_ = NULL; |
| 755 |
gint _tmp26_ = 0; |
| 756 |
AtspiRect* _tmp27_ = NULL; |
| 757 |
gint _tmp28_ = 0; |
| 758 |
AtspiRect* _tmp29_ = NULL; |
| 759 |
gint _tmp30_ = 0; |
| 760 |
AtspiRect* _tmp31_ = NULL; |
| 761 |
gint _tmp32_ = 0; |
| 762 |
Caribou_Keyboard* _tmp33_ = NULL; |
| 763 |
AtspiRect* _tmp34_ = NULL; |
| 764 |
gint _tmp35_ = 0; |
| 765 |
AtspiRect* _tmp36_ = NULL; |
| 766 |
gint _tmp37_ = 0; |
| 767 |
AtspiRect* _tmp38_ = NULL; |
| 768 |
gint _tmp39_ = 0; |
| 769 |
AtspiRect* _tmp40_ = NULL; |
| 770 |
gint _tmp41_ = 0; |
| 771 |
Caribou_Keyboard* _tmp42_ = NULL; |
| 772 |
guint32 _tmp43_ = 0U; |
| 773 |
GError * _inner_error_ = NULL; |
| 774 |
g_return_if_fail (self != NULL); |
| 775 |
g_return_if_fail (acc != NULL); |
| 776 |
_tmp0_ = acc; |
| 777 |
_tmp1_ = atspi_accessible_get_text (_tmp0_); |
| 778 |
text = _tmp1_; |
| 779 |
_tmp3_ = text; |
| 780 |
_tmp4_ = atspi_text_get_caret_offset (_tmp3_, &_inner_error_); |
| 781 |
_tmp2_ = _tmp4_; |
| 782 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 783 |
g_propagate_error (error, _inner_error_); |
| 784 |
_g_object_unref0 (text); |
| 785 |
return; |
| 786 |
} |
| 787 |
_tmp5_ = text; |
| 788 |
_tmp6_ = atspi_text_get_character_extents (_tmp5_, _tmp2_, ATSPI_COORD_TYPE_SCREEN, &_inner_error_); |
| 789 |
rect = _tmp6_; |
| 790 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 791 |
g_propagate_error (error, _inner_error_); |
| 792 |
_g_object_unref0 (text); |
| 793 |
return; |
| 794 |
} |
| 795 |
_tmp7_ = acc; |
| 796 |
_tmp8_ = atspi_accessible_get_component (_tmp7_); |
| 797 |
component = _tmp8_; |
| 798 |
_tmp9_ = component; |
| 799 |
_tmp10_ = atspi_component_get_extents (_tmp9_, ATSPI_COORD_TYPE_SCREEN, &_inner_error_); |
| 800 |
entry_rect = _tmp10_; |
| 801 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 802 |
g_propagate_error (error, _inner_error_); |
| 803 |
_g_object_unref0 (component); |
| 804 |
__vala_AtspiRect_free0 (rect); |
| 805 |
_g_object_unref0 (text); |
| 806 |
return; |
| 807 |
} |
| 808 |
_tmp14_ = rect; |
| 809 |
_tmp15_ = _tmp14_->x; |
| 810 |
if (_tmp15_ == 0) { |
| 811 |
AtspiRect* _tmp16_ = NULL; |
| 812 |
gint _tmp17_ = 0; |
| 813 |
_tmp16_ = rect; |
| 814 |
_tmp17_ = _tmp16_->y; |
| 815 |
_tmp13_ = _tmp17_ == 0; |
| 816 |
} else { |
| 817 |
_tmp13_ = FALSE; |
| 818 |
} |
| 819 |
if (_tmp13_) { |
| 820 |
AtspiRect* _tmp18_ = NULL; |
| 821 |
gint _tmp19_ = 0; |
| 822 |
_tmp18_ = rect; |
| 823 |
_tmp19_ = _tmp18_->width; |
| 824 |
_tmp12_ = _tmp19_ == 0; |
| 825 |
} else { |
| 826 |
_tmp12_ = FALSE; |
| 827 |
} |
| 828 |
if (_tmp12_) { |
| 829 |
AtspiRect* _tmp20_ = NULL; |
| 830 |
gint _tmp21_ = 0; |
| 831 |
_tmp20_ = rect; |
| 832 |
_tmp21_ = _tmp20_->height; |
| 833 |
_tmp11_ = _tmp21_ == 0; |
| 834 |
} else { |
| 835 |
_tmp11_ = FALSE; |
| 836 |
} |
| 837 |
if (_tmp11_) { |
| 838 |
AtspiRect* _tmp22_ = NULL; |
| 839 |
AtspiRect* _tmp23_ = NULL; |
| 840 |
_tmp22_ = entry_rect; |
| 841 |
_tmp23_ = __vala_AtspiRect_copy0 (_tmp22_); |
| 842 |
__vala_AtspiRect_free0 (rect); |
| 843 |
rect = _tmp23_; |
| 844 |
} |
| 845 |
_tmp24_ = self->priv->keyboard; |
| 846 |
_tmp25_ = rect; |
| 847 |
_tmp26_ = _tmp25_->x; |
| 848 |
_tmp27_ = rect; |
| 849 |
_tmp28_ = _tmp27_->y; |
| 850 |
_tmp29_ = rect; |
| 851 |
_tmp30_ = _tmp29_->width; |
| 852 |
_tmp31_ = rect; |
| 853 |
_tmp32_ = _tmp31_->height; |
| 854 |
caribou__keyboard_set_cursor_location (_tmp24_, _tmp26_, _tmp28_, _tmp30_, _tmp32_, &_inner_error_); |
| 855 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 856 |
g_propagate_error (error, _inner_error_); |
| 857 |
__vala_AtspiRect_free0 (entry_rect); |
| 858 |
_g_object_unref0 (component); |
| 859 |
__vala_AtspiRect_free0 (rect); |
| 860 |
_g_object_unref0 (text); |
| 861 |
return; |
| 862 |
} |
| 863 |
_tmp33_ = self->priv->keyboard; |
| 864 |
_tmp34_ = entry_rect; |
| 865 |
_tmp35_ = _tmp34_->x; |
| 866 |
_tmp36_ = entry_rect; |
| 867 |
_tmp37_ = _tmp36_->y; |
| 868 |
_tmp38_ = entry_rect; |
| 869 |
_tmp39_ = _tmp38_->width; |
| 870 |
_tmp40_ = entry_rect; |
| 871 |
_tmp41_ = _tmp40_->height; |
| 872 |
caribou__keyboard_set_entry_location (_tmp33_, _tmp35_, _tmp37_, _tmp39_, _tmp41_, &_inner_error_); |
| 873 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 874 |
g_propagate_error (error, _inner_error_); |
| 875 |
__vala_AtspiRect_free0 (entry_rect); |
| 876 |
_g_object_unref0 (component); |
| 877 |
__vala_AtspiRect_free0 (rect); |
| 878 |
_g_object_unref0 (text); |
| 879 |
return; |
| 880 |
} |
| 881 |
_tmp42_ = self->priv->keyboard; |
| 882 |
_tmp43_ = caribou_daemon_get_timestamp (self); |
| 883 |
caribou__keyboard_show (_tmp42_, _tmp43_, &_inner_error_); |
| 884 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 885 |
g_propagate_error (error, _inner_error_); |
| 886 |
__vala_AtspiRect_free0 (entry_rect); |
| 887 |
_g_object_unref0 (component); |
| 888 |
__vala_AtspiRect_free0 (rect); |
| 889 |
_g_object_unref0 (text); |
| 890 |
return; |
| 891 |
} |
| 892 |
__vala_AtspiRect_free0 (entry_rect); |
| 893 |
_g_object_unref0 (component); |
| 894 |
__vala_AtspiRect_free0 (rect); |
| 895 |
_g_object_unref0 (text); |
| 896 |
} |
| 897 |
|
| 898 |
|
| 899 |
static gpointer _g_object_ref0 (gpointer self) { |
| 900 |
return self ? g_object_ref (self) : NULL; |
| 901 |
} |
| 902 |
|
| 903 |
|
| 904 |
static void _vala_AtspiEvent_free (AtspiEvent* self) { |
| 905 |
g_boxed_free (atspi_event_get_type (), self); |
| 906 |
} |
| 907 |
|
| 908 |
|
| 909 |
static void caribou_daemon_on_focus (CaribouDaemon* self, AtspiEvent* event, GError** error) { |
| 910 |
AtspiAccessible* acc = NULL; |
| 911 |
AtspiEvent* _tmp0_ = NULL; |
| 912 |
AtspiAccessible* _tmp1_ = NULL; |
| 913 |
AtspiAccessible* _tmp2_ = NULL; |
| 914 |
AtspiRole source_role = 0; |
| 915 |
AtspiAccessible* _tmp3_ = NULL; |
| 916 |
AtspiRole _tmp4_ = 0; |
| 917 |
gboolean _tmp5_ = FALSE; |
| 918 |
AtspiAccessible* _tmp6_ = NULL; |
| 919 |
AtspiStateSet* _tmp7_ = NULL; |
| 920 |
AtspiStateSet* _tmp8_ = NULL; |
| 921 |
gboolean _tmp9_ = FALSE; |
| 922 |
gboolean _tmp10_ = FALSE; |
| 923 |
GError * _inner_error_ = NULL; |
| 924 |
g_return_if_fail (self != NULL); |
| 925 |
g_return_if_fail (event != NULL); |
| 926 |
_tmp0_ = event; |
| 927 |
_tmp1_ = _tmp0_->source; |
| 928 |
_tmp2_ = _g_object_ref0 (_tmp1_); |
| 929 |
acc = _tmp2_; |
| 930 |
_tmp3_ = acc; |
| 931 |
_tmp4_ = atspi_accessible_get_role (_tmp3_, &_inner_error_); |
| 932 |
source_role = _tmp4_; |
| 933 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 934 |
g_propagate_error (error, _inner_error_); |
| 935 |
_g_object_unref0 (acc); |
| 936 |
__vala_AtspiEvent_free0 (event); |
| 937 |
return; |
| 938 |
} |
| 939 |
_tmp6_ = acc; |
| 940 |
_tmp7_ = atspi_accessible_get_state_set (_tmp6_); |
| 941 |
_tmp8_ = _tmp7_; |
| 942 |
_tmp9_ = atspi_state_set_contains (_tmp8_, ATSPI_STATE_EDITABLE); |
| 943 |
_tmp10_ = _tmp9_; |
| 944 |
_g_object_unref0 (_tmp8_); |
| 945 |
if (_tmp10_) { |
| 946 |
_tmp5_ = TRUE; |
| 947 |
} else { |
| 948 |
AtspiRole _tmp11_ = 0; |
| 949 |
_tmp11_ = source_role; |
| 950 |
_tmp5_ = _tmp11_ == ATSPI_ROLE_TERMINAL; |
| 951 |
} |
| 952 |
if (_tmp5_) { |
| 953 |
AtspiRole _tmp12_ = 0; |
| 954 |
_tmp12_ = source_role; |
| 955 |
switch (_tmp12_) { |
| 956 |
case ATSPI_ROLE_TEXT: |
| 957 |
case ATSPI_ROLE_PARAGRAPH: |
| 958 |
case ATSPI_ROLE_PASSWORD_TEXT: |
| 959 |
case ATSPI_ROLE_TERMINAL: |
| 960 |
case ATSPI_ROLE_ENTRY: |
| 961 |
{ |
| 962 |
AtspiEvent* _tmp13_ = NULL; |
| 963 |
const gchar* _tmp14_ = NULL; |
| 964 |
_tmp13_ = event; |
| 965 |
_tmp14_ = _tmp13_->type; |
| 966 |
if (g_strcmp0 (_tmp14_, "object:state-changed:focused") == 0) { |
| 967 |
AtspiEvent* _tmp15_ = NULL; |
| 968 |
gint _tmp16_ = 0; |
| 969 |
_tmp15_ = event; |
| 970 |
_tmp16_ = _tmp15_->detail1; |
| 971 |
if (_tmp16_ == 1) { |
| 972 |
AtspiAccessible* _tmp17_ = NULL; |
| 973 |
AtspiEvent* _tmp18_ = NULL; |
| 974 |
AtspiAccessible* _tmp19_ = NULL; |
| 975 |
AtspiAccessible* _tmp20_ = NULL; |
| 976 |
AtspiAccessible* _tmp21_ = NULL; |
| 977 |
AtspiEvent* _tmp22_ = NULL; |
| 978 |
AtspiAccessible* _tmp23_ = NULL; |
| 979 |
AtspiAccessible* _tmp24_ = NULL; |
| 980 |
AtspiAccessible* _tmp25_ = NULL; |
| 981 |
AtspiAccessible* _tmp26_ = NULL; |
| 982 |
const gchar* _tmp27_ = NULL; |
| 983 |
_tmp17_ = acc; |
| 984 |
caribou_daemon_set_entry_location (self, _tmp17_, &_inner_error_); |
| 985 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 986 |
g_propagate_error (error, _inner_error_); |
| 987 |
_g_object_unref0 (acc); |
| 988 |
__vala_AtspiEvent_free0 (event); |
| 989 |
return; |
| 990 |
} |
| 991 |
_tmp18_ = event; |
| 992 |
_tmp19_ = _tmp18_->source; |
| 993 |
_tmp20_ = _g_object_ref0 (_tmp19_); |
| 994 |
_g_object_unref0 (self->priv->current_acc); |
| 995 |
self->priv->current_acc = _tmp20_; |
| 996 |
_tmp22_ = event; |
| 997 |
_tmp23_ = _tmp22_->source; |
| 998 |
_tmp24_ = atspi_accessible_get_application (_tmp23_, &_inner_error_); |
| 999 |
_tmp21_ = _tmp24_; |
| 1000 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1001 |
g_propagate_error (error, _inner_error_); |
| 1002 |
_g_object_unref0 (acc); |
| 1003 |
__vala_AtspiEvent_free0 (event); |
| 1004 |
return; |
| 1005 |
} |
| 1006 |
_tmp25_ = _tmp21_; |
| 1007 |
_tmp21_ = NULL; |
| 1008 |
_tmp26_ = _tmp25_; |
| 1009 |
_tmp27_ = _tmp26_->name; |
| 1010 |
g_debug ("daemon.vala:98: enter text widget in %s", _tmp27_); |
| 1011 |
_g_object_unref0 (_tmp26_); |
| 1012 |
_g_object_unref0 (_tmp21_); |
| 1013 |
} else { |
| 1014 |
AtspiAccessible* _tmp28_ = NULL; |
| 1015 |
AtspiAccessible* _tmp29_ = NULL; |
| 1016 |
_tmp28_ = acc; |
| 1017 |
_tmp29_ = self->priv->current_acc; |
| 1018 |
if (_tmp28_ == _tmp29_) { |
| 1019 |
Caribou_Keyboard* _tmp30_ = NULL; |
| 1020 |
guint32 _tmp31_ = 0U; |
| 1021 |
AtspiAccessible* _tmp32_ = NULL; |
| 1022 |
AtspiEvent* _tmp33_ = NULL; |
| 1023 |
AtspiAccessible* _tmp34_ = NULL; |
| 1024 |
AtspiAccessible* _tmp35_ = NULL; |
| 1025 |
AtspiAccessible* _tmp36_ = NULL; |
| 1026 |
AtspiAccessible* _tmp37_ = NULL; |
| 1027 |
const gchar* _tmp38_ = NULL; |
| 1028 |
_tmp30_ = self->priv->keyboard; |
| 1029 |
_tmp31_ = caribou_daemon_get_timestamp (self); |
| 1030 |
caribou__keyboard_hide (_tmp30_, _tmp31_, &_inner_error_); |
| 1031 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1032 |
g_propagate_error (error, _inner_error_); |
| 1033 |
_g_object_unref0 (acc); |
| 1034 |
__vala_AtspiEvent_free0 (event); |
| 1035 |
return; |
| 1036 |
} |
| 1037 |
_g_object_unref0 (self->priv->current_acc); |
| 1038 |
self->priv->current_acc = NULL; |
| 1039 |
_tmp33_ = event; |
| 1040 |
_tmp34_ = _tmp33_->source; |
| 1041 |
_tmp35_ = atspi_accessible_get_application (_tmp34_, &_inner_error_); |
| 1042 |
_tmp32_ = _tmp35_; |
| 1043 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1044 |
g_propagate_error (error, _inner_error_); |
| 1045 |
_g_object_unref0 (acc); |
| 1046 |
__vala_AtspiEvent_free0 (event); |
| 1047 |
return; |
| 1048 |
} |
| 1049 |
_tmp36_ = _tmp32_; |
| 1050 |
_tmp32_ = NULL; |
| 1051 |
_tmp37_ = _tmp36_; |
| 1052 |
_tmp38_ = _tmp37_->name; |
| 1053 |
g_debug ("daemon.vala:103: leave text widget in %s", _tmp38_); |
| 1054 |
_g_object_unref0 (_tmp37_); |
| 1055 |
_g_object_unref0 (_tmp32_); |
| 1056 |
} |
| 1057 |
} |
| 1058 |
} else { |
| 1059 |
AtspiEvent* _tmp39_ = NULL; |
| 1060 |
const gchar* _tmp40_ = NULL; |
| 1061 |
_tmp39_ = event; |
| 1062 |
_tmp40_ = _tmp39_->type; |
| 1063 |
g_warning ("daemon.vala:107: unknown focus event: %s", _tmp40_); |
| 1064 |
} |
| 1065 |
break; |
| 1066 |
} |
| 1067 |
default: |
| 1068 |
{ |
| 1069 |
break; |
| 1070 |
} |
| 1071 |
} |
| 1072 |
} |
| 1073 |
_g_object_unref0 (acc); |
| 1074 |
__vala_AtspiEvent_free0 (event); |
| 1075 |
} |
| 1076 |
|
| 1077 |
|
| 1078 |
static AtspiEvent* _vala_AtspiEvent_copy (AtspiEvent* self) { |
| 1079 |
return g_boxed_copy (atspi_event_get_type (), self); |
| 1080 |
} |
| 1081 |
|
| 1082 |
|
| 1083 |
static gpointer __vala_AtspiEvent_copy0 (gpointer self) { |
| 1084 |
return self ? _vala_AtspiEvent_copy (self) : NULL; |
| 1085 |
} |
| 1086 |
|
| 1087 |
|
| 1088 |
static void caribou_daemon_on_focus_ignore_error (CaribouDaemon* self, AtspiEvent* event) { |
| 1089 |
GError * _inner_error_ = NULL; |
| 1090 |
g_return_if_fail (self != NULL); |
| 1091 |
g_return_if_fail (event != NULL); |
| 1092 |
{ |
| 1093 |
AtspiEvent* _tmp0_ = NULL; |
| 1094 |
AtspiEvent* _tmp1_ = NULL; |
| 1095 |
_tmp0_ = event; |
| 1096 |
_tmp1_ = __vala_AtspiEvent_copy0 (_tmp0_); |
| 1097 |
caribou_daemon_on_focus (self, _tmp1_, &_inner_error_); |
| 1098 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1099 |
goto __catch3_g_error; |
| 1100 |
} |
| 1101 |
} |
| 1102 |
goto __finally3; |
| 1103 |
__catch3_g_error: |
| 1104 |
{ |
| 1105 |
GError* e = NULL; |
| 1106 |
GError* _tmp2_ = NULL; |
| 1107 |
const gchar* _tmp3_ = NULL; |
| 1108 |
e = _inner_error_; |
| 1109 |
_inner_error_ = NULL; |
| 1110 |
_tmp2_ = e; |
| 1111 |
_tmp3_ = _tmp2_->message; |
| 1112 |
g_warning ("daemon.vala:120: error in focus handler: %s", _tmp3_); |
| 1113 |
_g_error_free0 (e); |
| 1114 |
} |
| 1115 |
__finally3: |
| 1116 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1117 |
__vala_AtspiEvent_free0 (event); |
| 1118 |
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); |
| 1119 |
g_clear_error (&_inner_error_); |
| 1120 |
return; |
| 1121 |
} |
| 1122 |
__vala_AtspiEvent_free0 (event); |
| 1123 |
} |
| 1124 |
|
| 1125 |
|
| 1126 |
static void caribou_daemon_on_text_caret_moved (CaribouDaemon* self, AtspiEvent* event, GError** error) { |
| 1127 |
AtspiAccessible* _tmp0_ = NULL; |
| 1128 |
AtspiEvent* _tmp1_ = NULL; |
| 1129 |
AtspiAccessible* _tmp2_ = NULL; |
| 1130 |
GError * _inner_error_ = NULL; |
| 1131 |
g_return_if_fail (self != NULL); |
| 1132 |
g_return_if_fail (event != NULL); |
| 1133 |
_tmp0_ = self->priv->current_acc; |
| 1134 |
_tmp1_ = event; |
| 1135 |
_tmp2_ = _tmp1_->source; |
| 1136 |
if (_tmp0_ == _tmp2_) { |
| 1137 |
AtspiText* text = NULL; |
| 1138 |
AtspiAccessible* _tmp3_ = NULL; |
| 1139 |
AtspiText* _tmp4_ = NULL; |
| 1140 |
gint _tmp5_ = 0; |
| 1141 |
AtspiText* _tmp6_ = NULL; |
| 1142 |
gint _tmp7_ = 0; |
| 1143 |
AtspiRect* rect = NULL; |
| 1144 |
AtspiText* _tmp8_ = NULL; |
| 1145 |
AtspiRect* _tmp9_ = NULL; |
| 1146 |
gboolean _tmp10_ = FALSE; |
| 1147 |
gboolean _tmp11_ = FALSE; |
| 1148 |
gboolean _tmp12_ = FALSE; |
| 1149 |
AtspiRect* _tmp13_ = NULL; |
| 1150 |
gint _tmp14_ = 0; |
| 1151 |
Caribou_Keyboard* _tmp27_ = NULL; |
| 1152 |
AtspiRect* _tmp28_ = NULL; |
| 1153 |
gint _tmp29_ = 0; |
| 1154 |
AtspiRect* _tmp30_ = NULL; |
| 1155 |
gint _tmp31_ = 0; |
| 1156 |
AtspiRect* _tmp32_ = NULL; |
| 1157 |
gint _tmp33_ = 0; |
| 1158 |
AtspiRect* _tmp34_ = NULL; |
| 1159 |
gint _tmp35_ = 0; |
| 1160 |
AtspiAccessible* _tmp36_ = NULL; |
| 1161 |
AtspiEvent* _tmp37_ = NULL; |
| 1162 |
AtspiAccessible* _tmp38_ = NULL; |
| 1163 |
AtspiAccessible* _tmp39_ = NULL; |
| 1164 |
AtspiAccessible* _tmp40_ = NULL; |
| 1165 |
AtspiAccessible* _tmp41_ = NULL; |
| 1166 |
const gchar* _tmp42_ = NULL; |
| 1167 |
AtspiEvent* _tmp43_ = NULL; |
| 1168 |
gint _tmp44_ = 0; |
| 1169 |
AtspiEvent* _tmp45_ = NULL; |
| 1170 |
AtspiAccessible* _tmp46_ = NULL; |
| 1171 |
const gchar* _tmp47_ = NULL; |
| 1172 |
_tmp3_ = self->priv->current_acc; |
| 1173 |
_tmp4_ = atspi_accessible_get_text (_tmp3_); |
| 1174 |
text = _tmp4_; |
| 1175 |
_tmp6_ = text; |
| 1176 |
_tmp7_ = atspi_text_get_caret_offset (_tmp6_, &_inner_error_); |
| 1177 |
_tmp5_ = _tmp7_; |
| 1178 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1179 |
g_propagate_error (error, _inner_error_); |
| 1180 |
_g_object_unref0 (text); |
| 1181 |
__vala_AtspiEvent_free0 (event); |
| 1182 |
return; |
| 1183 |
} |
| 1184 |
_tmp8_ = text; |
| 1185 |
_tmp9_ = atspi_text_get_character_extents (_tmp8_, _tmp5_, ATSPI_COORD_TYPE_SCREEN, &_inner_error_); |
| 1186 |
rect = _tmp9_; |
| 1187 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1188 |
g_propagate_error (error, _inner_error_); |
| 1189 |
_g_object_unref0 (text); |
| 1190 |
__vala_AtspiEvent_free0 (event); |
| 1191 |
return; |
| 1192 |
} |
| 1193 |
_tmp13_ = rect; |
| 1194 |
_tmp14_ = _tmp13_->x; |
| 1195 |
if (_tmp14_ == 0) { |
| 1196 |
AtspiRect* _tmp15_ = NULL; |
| 1197 |
gint _tmp16_ = 0; |
| 1198 |
_tmp15_ = rect; |
| 1199 |
_tmp16_ = _tmp15_->y; |
| 1200 |
_tmp12_ = _tmp16_ == 0; |
| 1201 |
} else { |
| 1202 |
_tmp12_ = FALSE; |
| 1203 |
} |
| 1204 |
if (_tmp12_) { |
| 1205 |
AtspiRect* _tmp17_ = NULL; |
| 1206 |
gint _tmp18_ = 0; |
| 1207 |
_tmp17_ = rect; |
| 1208 |
_tmp18_ = _tmp17_->width; |
| 1209 |
_tmp11_ = _tmp18_ == 0; |
| 1210 |
} else { |
| 1211 |
_tmp11_ = FALSE; |
| 1212 |
} |
| 1213 |
if (_tmp11_) { |
| 1214 |
AtspiRect* _tmp19_ = NULL; |
| 1215 |
gint _tmp20_ = 0; |
| 1216 |
_tmp19_ = rect; |
| 1217 |
_tmp20_ = _tmp19_->height; |
| 1218 |
_tmp10_ = _tmp20_ == 0; |
| 1219 |
} else { |
| 1220 |
_tmp10_ = FALSE; |
| 1221 |
} |
| 1222 |
if (_tmp10_) { |
| 1223 |
AtspiComponent* component = NULL; |
| 1224 |
AtspiAccessible* _tmp21_ = NULL; |
| 1225 |
AtspiComponent* _tmp22_ = NULL; |
| 1226 |
AtspiRect* _tmp23_ = NULL; |
| 1227 |
AtspiComponent* _tmp24_ = NULL; |
| 1228 |
AtspiRect* _tmp25_ = NULL; |
| 1229 |
AtspiRect* _tmp26_ = NULL; |
| 1230 |
_tmp21_ = self->priv->current_acc; |
| 1231 |
_tmp22_ = atspi_accessible_get_component (_tmp21_); |
| 1232 |
component = _tmp22_; |
| 1233 |
_tmp24_ = component; |
| 1234 |
_tmp25_ = atspi_component_get_extents (_tmp24_, ATSPI_COORD_TYPE_SCREEN, &_inner_error_); |
| 1235 |
_tmp23_ = _tmp25_; |
| 1236 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1237 |
g_propagate_error (error, _inner_error_); |
| 1238 |
_g_object_unref0 (component); |
| 1239 |
__vala_AtspiRect_free0 (rect); |
| 1240 |
_g_object_unref0 (text); |
| 1241 |
__vala_AtspiEvent_free0 (event); |
| 1242 |
return; |
| 1243 |
} |
| 1244 |
_tmp26_ = _tmp23_; |
| 1245 |
_tmp23_ = NULL; |
| 1246 |
__vala_AtspiRect_free0 (rect); |
| 1247 |
rect = _tmp26_; |
| 1248 |
__vala_AtspiRect_free0 (_tmp23_); |
| 1249 |
_g_object_unref0 (component); |
| 1250 |
} |
| 1251 |
_tmp27_ = self->priv->keyboard; |
| 1252 |
_tmp28_ = rect; |
| 1253 |
_tmp29_ = _tmp28_->x; |
| 1254 |
_tmp30_ = rect; |
| 1255 |
_tmp31_ = _tmp30_->y; |
| 1256 |
_tmp32_ = rect; |
| 1257 |
_tmp33_ = _tmp32_->width; |
| 1258 |
_tmp34_ = rect; |
| 1259 |
_tmp35_ = _tmp34_->height; |
| 1260 |
caribou__keyboard_set_cursor_location (_tmp27_, _tmp29_, _tmp31_, _tmp33_, _tmp35_, &_inner_error_); |
| 1261 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1262 |
g_propagate_error (error, _inner_error_); |
| 1263 |
__vala_AtspiRect_free0 (rect); |
| 1264 |
_g_object_unref0 (text); |
| 1265 |
__vala_AtspiEvent_free0 (event); |
| 1266 |
return; |
| 1267 |
} |
| 1268 |
_tmp37_ = event; |
| 1269 |
_tmp38_ = _tmp37_->source; |
| 1270 |
_tmp39_ = atspi_accessible_get_application (_tmp38_, &_inner_error_); |
| 1271 |
_tmp36_ = _tmp39_; |
| 1272 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1273 |
g_propagate_error (error, _inner_error_); |
| 1274 |
__vala_AtspiRect_free0 (rect); |
| 1275 |
_g_object_unref0 (text); |
| 1276 |
__vala_AtspiEvent_free0 (event); |
| 1277 |
return; |
| 1278 |
} |
| 1279 |
_tmp40_ = _tmp36_; |
| 1280 |
_tmp36_ = NULL; |
| 1281 |
_tmp41_ = _tmp40_; |
| 1282 |
_tmp42_ = _tmp41_->name; |
| 1283 |
_tmp43_ = event; |
| 1284 |
_tmp44_ = _tmp43_->detail1; |
| 1285 |
_tmp45_ = event; |
| 1286 |
_tmp46_ = _tmp45_->source; |
| 1287 |
_tmp47_ = _tmp46_->description; |
| 1288 |
g_debug ("daemon.vala:137: object:text-caret-moved in %s: %d %s", _tmp42_, _tmp44_, _tmp47_); |
| 1289 |
_g_object_unref0 (_tmp41_); |
| 1290 |
_g_object_unref0 (_tmp36_); |
| 1291 |
__vala_AtspiRect_free0 (rect); |
| 1292 |
_g_object_unref0 (text); |
| 1293 |
} |
| 1294 |
__vala_AtspiEvent_free0 (event); |
| 1295 |
} |
| 1296 |
|
| 1297 |
|
| 1298 |
static void caribou_daemon_on_text_caret_moved_ignore_error (CaribouDaemon* self, AtspiEvent* event) { |
| 1299 |
GError * _inner_error_ = NULL; |
| 1300 |
g_return_if_fail (self != NULL); |
| 1301 |
g_return_if_fail (event != NULL); |
| 1302 |
{ |
| 1303 |
AtspiEvent* _tmp0_ = NULL; |
| 1304 |
AtspiEvent* _tmp1_ = NULL; |
| 1305 |
_tmp0_ = event; |
| 1306 |
_tmp1_ = __vala_AtspiEvent_copy0 (_tmp0_); |
| 1307 |
caribou_daemon_on_text_caret_moved (self, _tmp1_, &_inner_error_); |
| 1308 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1309 |
goto __catch4_g_error; |
| 1310 |
} |
| 1311 |
} |
| 1312 |
goto __finally4; |
| 1313 |
__catch4_g_error: |
| 1314 |
{ |
| 1315 |
GError* e = NULL; |
| 1316 |
GError* _tmp2_ = NULL; |
| 1317 |
const gchar* _tmp3_ = NULL; |
| 1318 |
e = _inner_error_; |
| 1319 |
_inner_error_ = NULL; |
| 1320 |
_tmp2_ = e; |
| 1321 |
_tmp3_ = _tmp2_->message; |
| 1322 |
g_warning ("daemon.vala:147: error in text caret movement handler: %s", _tmp3_); |
| 1323 |
_g_error_free0 (e); |
| 1324 |
} |
| 1325 |
__finally4: |
| 1326 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1327 |
__vala_AtspiEvent_free0 (event); |
| 1328 |
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); |
| 1329 |
g_clear_error (&_inner_error_); |
| 1330 |
return; |
| 1331 |
} |
| 1332 |
__vala_AtspiEvent_free0 (event); |
| 1333 |
} |
| 1334 |
|
| 1335 |
|
| 1336 |
static void _caribou_daemon_on_focus_ignore_error_atspi_event_listener_cb (AtspiEvent* event, gpointer self) { |
| 1337 |
caribou_daemon_on_focus_ignore_error ((CaribouDaemon*) self, event); |
| 1338 |
} |
| 1339 |
|
| 1340 |
|
| 1341 |
static void _caribou_daemon_on_text_caret_moved_ignore_error_atspi_event_listener_cb (AtspiEvent* event, gpointer self) { |
| 1342 |
caribou_daemon_on_text_caret_moved_ignore_error ((CaribouDaemon*) self, event); |
| 1343 |
} |
| 1344 |
|
| 1345 |
|
| 1346 |
static void caribou_daemon_register_event_listeners (CaribouDaemon* self, GError** error) { |
| 1347 |
GError * _inner_error_ = NULL; |
| 1348 |
g_return_if_fail (self != NULL); |
| 1349 |
atspi_event_listener_register_from_callback (_caribou_daemon_on_focus_ignore_error_atspi_event_listener_cb, g_object_ref (self), g_object_unref, "object:state-changed:focused", &_inner_error_); |
| 1350 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1351 |
g_propagate_error (error, _inner_error_); |
| 1352 |
return; |
| 1353 |
} |
| 1354 |
atspi_event_listener_register_from_callback (_caribou_daemon_on_text_caret_moved_ignore_error_atspi_event_listener_cb, g_object_ref (self), g_object_unref, "object:text-caret-moved", &_inner_error_); |
| 1355 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1356 |
g_propagate_error (error, _inner_error_); |
| 1357 |
return; |
| 1358 |
} |
| 1359 |
} |
| 1360 |
|
| 1361 |
|
| 1362 |
static void caribou_daemon_deregister_event_listeners (CaribouDaemon* self, GError** error) { |
| 1363 |
GError * _inner_error_ = NULL; |
| 1364 |
g_return_if_fail (self != NULL); |
| 1365 |
atspi_event_listener_deregister_from_callback (_caribou_daemon_on_focus_ignore_error_atspi_event_listener_cb, self, "object:state-changed:focused", &_inner_error_); |
| 1366 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1367 |
g_propagate_error (error, _inner_error_); |
| 1368 |
return; |
| 1369 |
} |
| 1370 |
atspi_event_listener_deregister_from_callback (_caribou_daemon_on_text_caret_moved_ignore_error_atspi_event_listener_cb, self, "object:text-caret-moved", &_inner_error_); |
| 1371 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1372 |
g_propagate_error (error, _inner_error_); |
| 1373 |
return; |
| 1374 |
} |
| 1375 |
} |
| 1376 |
|
| 1377 |
|
| 1378 |
void caribou_daemon_ping (CaribouDaemon* self) { |
| 1379 |
g_return_if_fail (self != NULL); |
| 1380 |
} |
| 1381 |
|
| 1382 |
|
| 1383 |
static void _caribou_daemon_on_get_proxy_ready_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) { |
| 1384 |
caribou_daemon_on_get_proxy_ready ((CaribouDaemon*) self, source_object, res); |
| 1385 |
g_object_unref (self); |
| 1386 |
} |
| 1387 |
|
| 1388 |
|
| 1389 |
void caribou_daemon_run (CaribouDaemon* self) { |
| 1390 |
GError * _inner_error_ = NULL; |
| 1391 |
g_return_if_fail (self != NULL); |
| 1392 |
g_async_initable_new_async (CARIBOU_TYPE__KEYBOARD_PROXY, 0, NULL, _caribou_daemon_on_get_proxy_ready_gasync_ready_callback, g_object_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); |
| 1393 |
atspi_event_main (); |
| 1394 |
} |
| 1395 |
|
| 1396 |
|
| 1397 |
void caribou_daemon_quit (CaribouDaemon* self) { |
| 1398 |
Caribou_Keyboard* _tmp0_ = NULL; |
| 1399 |
GError * _inner_error_ = NULL; |
| 1400 |
g_return_if_fail (self != NULL); |
| 1401 |
_tmp0_ = self->priv->keyboard; |
| 1402 |
if (_tmp0_ != NULL) { |
| 1403 |
{ |
| 1404 |
Caribou_Keyboard* _tmp1_ = NULL; |
| 1405 |
guint32 _tmp2_ = 0U; |
| 1406 |
_tmp1_ = self->priv->keyboard; |
| 1407 |
_tmp2_ = caribou_daemon_get_timestamp (self); |
| 1408 |
caribou__keyboard_hide (_tmp1_, _tmp2_, &_inner_error_); |
| 1409 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1410 |
if (_inner_error_->domain == G_IO_ERROR) { |
| 1411 |
goto __catch5_g_io_error; |
| 1412 |
} |
| 1413 |
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); |
| 1414 |
g_clear_error (&_inner_error_); |
| 1415 |
return; |
| 1416 |
} |
| 1417 |
} |
| 1418 |
goto __finally5; |
| 1419 |
__catch5_g_io_error: |
| 1420 |
{ |
| 1421 |
GError* e = NULL; |
| 1422 |
GError* _tmp3_ = NULL; |
| 1423 |
const gchar* _tmp4_ = NULL; |
| 1424 |
e = _inner_error_; |
| 1425 |
_inner_error_ = NULL; |
| 1426 |
_tmp3_ = e; |
| 1427 |
_tmp4_ = _tmp3_->message; |
| 1428 |
g_warning ("daemon.vala:188: can't hide keyboard: %s", _tmp4_); |
| 1429 |
_g_error_free0 (e); |
| 1430 |
} |
| 1431 |
__finally5: |
| 1432 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1433 |
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); |
| 1434 |
g_clear_error (&_inner_error_); |
| 1435 |
return; |
| 1436 |
} |
| 1437 |
{ |
| 1438 |
caribou_daemon_deregister_event_listeners (self, &_inner_error_); |
| 1439 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1440 |
goto __catch6_g_error; |
| 1441 |
} |
| 1442 |
} |
| 1443 |
goto __finally6; |
| 1444 |
__catch6_g_error: |
| 1445 |
{ |
| 1446 |
GError* e = NULL; |
| 1447 |
GError* _tmp5_ = NULL; |
| 1448 |
const gchar* _tmp6_ = NULL; |
| 1449 |
e = _inner_error_; |
| 1450 |
_inner_error_ = NULL; |
| 1451 |
_tmp5_ = e; |
| 1452 |
_tmp6_ = _tmp5_->message; |
| 1453 |
g_warning ("daemon.vala:194: can't deregister event listeners: %s", _tmp6_); |
| 1454 |
_g_error_free0 (e); |
| 1455 |
} |
| 1456 |
__finally6: |
| 1457 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1458 |
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); |
| 1459 |
g_clear_error (&_inner_error_); |
| 1460 |
return; |
| 1461 |
} |
| 1462 |
_g_object_unref0 (self->priv->keyboard); |
| 1463 |
self->priv->keyboard = NULL; |
| 1464 |
} |
| 1465 |
atspi_event_quit (); |
| 1466 |
} |
| 1467 |
|
| 1468 |
|
| 1469 |
static void caribou_daemon_class_init (CaribouDaemonClass * klass) { |
| 1470 |
caribou_daemon_parent_class = g_type_class_peek_parent (klass); |
| 1471 |
g_type_class_add_private (klass, sizeof (CaribouDaemonPrivate)); |
| 1472 |
G_OBJECT_CLASS (klass)->finalize = caribou_daemon_finalize; |
| 1473 |
} |
| 1474 |
|
| 1475 |
|
| 1476 |
static void caribou_daemon_instance_init (CaribouDaemon * self) { |
| 1477 |
self->priv = CARIBOU_DAEMON_GET_PRIVATE (self); |
| 1478 |
} |
| 1479 |
|
| 1480 |
|
| 1481 |
static void caribou_daemon_finalize (GObject* obj) { |
| 1482 |
CaribouDaemon * self; |
| 1483 |
guint _tmp0_ = 0U; |
| 1484 |
self = G_TYPE_CHECK_INSTANCE_CAST (obj, CARIBOU_TYPE_DAEMON, CaribouDaemon); |
| 1485 |
_tmp0_ = self->priv->name_id; |
| 1486 |
g_bus_unown_name (_tmp0_); |
| 1487 |
_g_object_unref0 (self->priv->keyboard); |
| 1488 |
_g_object_unref0 (self->priv->current_acc); |
| 1489 |
G_OBJECT_CLASS (caribou_daemon_parent_class)->finalize (obj); |
| 1490 |
} |
| 1491 |
|
| 1492 |
|
| 1493 |
GType caribou_daemon_get_type (void) { |
| 1494 |
static volatile gsize caribou_daemon_type_id__volatile = 0; |
| 1495 |
if (g_once_init_enter (&caribou_daemon_type_id__volatile)) { |
| 1496 |
static const GTypeInfo g_define_type_info = { sizeof (CaribouDaemonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) caribou_daemon_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CaribouDaemon), 0, (GInstanceInitFunc) caribou_daemon_instance_init, NULL }; |
| 1497 |
GType caribou_daemon_type_id; |
| 1498 |
caribou_daemon_type_id = g_type_register_static (G_TYPE_OBJECT, "CaribouDaemon", &g_define_type_info, 0); |
| 1499 |
g_type_set_qdata (caribou_daemon_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) caribou_daemon_register_object); |
| 1500 |
g_once_init_leave (&caribou_daemon_type_id__volatile, caribou_daemon_type_id); |
| 1501 |
} |
| 1502 |
return caribou_daemon_type_id__volatile; |
| 1503 |
} |
| 1504 |
|
| 1505 |
|
| 1506 |
static void _dbus_caribou_daemon_ping (CaribouDaemon* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { |
| 1507 |
GError* error = NULL; |
| 1508 |
GVariantIter _arguments_iter; |
| 1509 |
GDBusMessage* _reply_message; |
| 1510 |
GVariant* _reply; |
| 1511 |
GVariantBuilder _reply_builder; |
| 1512 |
g_variant_iter_init (&_arguments_iter, _parameters_); |
| 1513 |
caribou_daemon_ping (self); |
| 1514 |
_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); |
| 1515 |
g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); |
| 1516 |
_reply = g_variant_builder_end (&_reply_builder); |
| 1517 |
g_dbus_message_set_body (_reply_message, _reply); |
| 1518 |
g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); |
| 1519 |
g_object_unref (invocation); |
| 1520 |
g_object_unref (_reply_message); |
| 1521 |
} |
| 1522 |
|
| 1523 |
|
| 1524 |
static void _dbus_caribou_daemon_quit (CaribouDaemon* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { |
| 1525 |
GError* error = NULL; |
| 1526 |
GVariantIter _arguments_iter; |
| 1527 |
GDBusMessage* _reply_message; |
| 1528 |
GVariant* _reply; |
| 1529 |
GVariantBuilder _reply_builder; |
| 1530 |
g_variant_iter_init (&_arguments_iter, _parameters_); |
| 1531 |
caribou_daemon_quit (self); |
| 1532 |
_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); |
| 1533 |
g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); |
| 1534 |
_reply = g_variant_builder_end (&_reply_builder); |
| 1535 |
g_dbus_message_set_body (_reply_message, _reply); |
| 1536 |
g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); |
| 1537 |
g_object_unref (invocation); |
| 1538 |
g_object_unref (_reply_message); |
| 1539 |
} |
| 1540 |
|
| 1541 |
|
| 1542 |
static void caribou_daemon_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) { |
| 1543 |
gpointer* data; |
| 1544 |
gpointer object; |
| 1545 |
data = user_data; |
| 1546 |
object = data[0]; |
| 1547 |
if (strcmp (method_name, "Run") == 0) { |
| 1548 |
_dbus_caribou_daemon_ping (object, parameters, invocation); |
| 1549 |
} else if (strcmp (method_name, "Quit") == 0) { |
| 1550 |
_dbus_caribou_daemon_quit (object, parameters, invocation); |
| 1551 |
} else { |
| 1552 |
g_object_unref (invocation); |
| 1553 |
} |
| 1554 |
} |
| 1555 |
|
| 1556 |
|
| 1557 |
static GVariant* caribou_daemon_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) { |
| 1558 |
gpointer* data; |
| 1559 |
gpointer object; |
| 1560 |
data = user_data; |
| 1561 |
object = data[0]; |
| 1562 |
return NULL; |
| 1563 |
} |
| 1564 |
|
| 1565 |
|
| 1566 |
static gboolean caribou_daemon_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) { |
| 1567 |
gpointer* data; |
| 1568 |
gpointer object; |
| 1569 |
data = user_data; |
| 1570 |
object = data[0]; |
| 1571 |
return FALSE; |
| 1572 |
} |
| 1573 |
|
| 1574 |
|
| 1575 |
guint caribou_daemon_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) { |
| 1576 |
guint result; |
| 1577 |
gpointer *data; |
| 1578 |
data = g_new (gpointer, 3); |
| 1579 |
data[0] = g_object_ref (object); |
| 1580 |
data[1] = g_object_ref (connection); |
| 1581 |
data[2] = g_strdup (path); |
| 1582 |
result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_caribou_daemon_dbus_interface_info), &_caribou_daemon_dbus_interface_vtable, data, _caribou_daemon_unregister_object, error); |
| 1583 |
if (!result) { |
| 1584 |
return 0; |
| 1585 |
} |
| 1586 |
return result; |
| 1587 |
} |
| 1588 |
|
| 1589 |
|
| 1590 |
static void _caribou_daemon_unregister_object (gpointer user_data) { |
| 1591 |
gpointer* data; |
| 1592 |
data = user_data; |
| 1593 |
g_object_unref (data[0]); |
| 1594 |
g_object_unref (data[1]); |
| 1595 |
g_free (data[2]); |
| 1596 |
g_free (data); |
| 1597 |
} |
| 1598 |
|
| 1599 |
|
| 1600 |
static Block1Data* block1_data_ref (Block1Data* _data1_) { |
| 1601 |
g_atomic_int_inc (&_data1_->_ref_count_); |
| 1602 |
return _data1_; |
| 1603 |
} |
| 1604 |
|
| 1605 |
|
| 1606 |
static void block1_data_unref (void * _userdata_) { |
| 1607 |
Block1Data* _data1_; |
| 1608 |
_data1_ = (Block1Data*) _userdata_; |
| 1609 |
if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) { |
| 1610 |
_g_object_unref0 (_data1_->daemon); |
| 1611 |
g_slice_free (Block1Data, _data1_); |
| 1612 |
} |
| 1613 |
} |
| 1614 |
|
| 1615 |
|
| 1616 |
static gboolean __lambda4_ (Block1Data* _data1_) { |
| 1617 |
gboolean result = FALSE; |
| 1618 |
CaribouDaemon* _tmp0_ = NULL; |
| 1619 |
_tmp0_ = _data1_->daemon; |
| 1620 |
caribou_daemon_quit (_tmp0_); |
| 1621 |
result = FALSE; |
| 1622 |
return result; |
| 1623 |
} |
| 1624 |
|
| 1625 |
|
| 1626 |
static gboolean ___lambda4__gsource_func (gpointer self) { |
| 1627 |
gboolean result; |
| 1628 |
result = __lambda4_ (self); |
| 1629 |
return result; |
| 1630 |
} |
| 1631 |
|
| 1632 |
|
| 1633 |
gint _vala_main (gchar** args, int args_length1) { |
| 1634 |
gint result = 0; |
| 1635 |
Block1Data* _data1_; |
| 1636 |
GOptionContext* option_context = NULL; |
| 1637 |
const gchar* _tmp0_ = NULL; |
| 1638 |
GOptionContext* _tmp1_ = NULL; |
| 1639 |
GOptionContext* _tmp2_ = NULL; |
| 1640 |
gint retval = 0; |
| 1641 |
gint _tmp7_ = 0; |
| 1642 |
gint _tmp8_ = 0; |
| 1643 |
CaribouDaemon* _tmp9_ = NULL; |
| 1644 |
CaribouDaemon* _tmp10_ = NULL; |
| 1645 |
GError * _inner_error_ = NULL; |
| 1646 |
_data1_ = g_slice_new0 (Block1Data); |
| 1647 |
_data1_->_ref_count_ = 1; |
| 1648 |
gdk_init (&args_length1, &args); |
| 1649 |
setlocale (LC_ALL, ""); |
| 1650 |
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); |
| 1651 |
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
| 1652 |
textdomain (GETTEXT_PACKAGE); |
| 1653 |
_tmp0_ = _ ("- accessibility event monitoring daemon for screen keyboard"); |
| 1654 |
_tmp1_ = g_option_context_new (_tmp0_); |
| 1655 |
option_context = _tmp1_; |
| 1656 |
_tmp2_ = option_context; |
| 1657 |
g_option_context_add_main_entries (_tmp2_, options, "caribou"); |
| 1658 |
{ |
| 1659 |
GOptionContext* _tmp3_ = NULL; |
| 1660 |
_tmp3_ = option_context; |
| 1661 |
g_option_context_parse (_tmp3_, &args_length1, &args, &_inner_error_); |
| 1662 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1663 |
if (_inner_error_->domain == G_OPTION_ERROR) { |
| 1664 |
goto __catch7_g_option_error; |
| 1665 |
} |
| 1666 |
_g_option_context_free0 (option_context); |
| 1667 |
block1_data_unref (_data1_); |
| 1668 |
_data1_ = NULL; |
| 1669 |
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); |
| 1670 |
g_clear_error (&_inner_error_); |
| 1671 |
return 0; |
| 1672 |
} |
| 1673 |
} |
| 1674 |
goto __finally7; |
| 1675 |
__catch7_g_option_error: |
| 1676 |
{ |
| 1677 |
GError* e = NULL; |
| 1678 |
FILE* _tmp4_ = NULL; |
| 1679 |
GError* _tmp5_ = NULL; |
| 1680 |
const gchar* _tmp6_ = NULL; |
| 1681 |
e = _inner_error_; |
| 1682 |
_inner_error_ = NULL; |
| 1683 |
_tmp4_ = stderr; |
| 1684 |
_tmp5_ = e; |
| 1685 |
_tmp6_ = _tmp5_->message; |
| 1686 |
fprintf (_tmp4_, "%s\n", _tmp6_); |
| 1687 |
result = 1; |
| 1688 |
_g_error_free0 (e); |
| 1689 |
_g_option_context_free0 (option_context); |
| 1690 |
block1_data_unref (_data1_); |
| 1691 |
_data1_ = NULL; |
| 1692 |
return result; |
| 1693 |
} |
| 1694 |
__finally7: |
| 1695 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
| 1696 |
_g_option_context_free0 (option_context); |
| 1697 |
block1_data_unref (_data1_); |
| 1698 |
_data1_ = NULL; |
| 1699 |
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); |
| 1700 |
g_clear_error (&_inner_error_); |
| 1701 |
return 0; |
| 1702 |
} |
| 1703 |
_tmp7_ = atspi_init (); |
| 1704 |
retval = _tmp7_; |
| 1705 |
_tmp8_ = retval; |
| 1706 |
if (_tmp8_ != 0) { |
| 1707 |
g_printerr ("can't initialize atspi\n"); |
| 1708 |
result = 1; |
| 1709 |
_g_option_context_free0 (option_context); |
| 1710 |
block1_data_unref (_data1_); |
| 1711 |
_data1_ = NULL; |
| 1712 |
return result; |
| 1713 |
} |
| 1714 |
_tmp9_ = caribou_daemon_new (); |
| 1715 |
_data1_->daemon = _tmp9_; |
| 1716 |
g_unix_signal_add_full (G_PRIORITY_DEFAULT, SIGINT, ___lambda4__gsource_func, block1_data_ref (_data1_), block1_data_unref); |
| 1717 |
_tmp10_ = _data1_->daemon; |
| 1718 |
caribou_daemon_run (_tmp10_); |
| 1719 |
result = 0; |
| 1720 |
_g_option_context_free0 (option_context); |
| 1721 |
block1_data_unref (_data1_); |
| 1722 |
_data1_ = NULL; |
| 1723 |
return result; |
| 1724 |
} |
| 1725 |
|
| 1726 |
|
| 1727 |
int main (int argc, char ** argv) { |
| 1728 |
#if !GLIB_CHECK_VERSION (2,35,0) |
| 1729 |
g_type_init (); |
| 1730 |
#endif |
| 1731 |
return _vala_main (argv, argc); |
| 1732 |
} |
| 1733 |
|
| 1734 |
|
| 1735 |
|