Commit 0425b4e0 authored by Daiki Ueno's avatar Daiki Ueno
Browse files

Make sure that IBusBus is connected when setting up DBus message filter.

parent 15c0a9da
...@@ -616,18 +616,14 @@ focus_message_filter (GDBusConnection *connection, ...@@ -616,18 +616,14 @@ focus_message_filter (GDBusConnection *connection,
return message; return message;
} }
gboolean static void
eekboard_client_enable_ibus_focus (EekboardClient *client) _ibus_connect_focus_handlers (IBusBus *bus, gpointer user_data)
{ {
EekboardClient *client = user_data;
GDBusConnection *connection; GDBusConnection *connection;
GError *error; GError *error;
if (!client->ibus_bus) { connection = ibus_bus_get_connection (bus);
client->ibus_bus = ibus_bus_new ();
g_object_ref_sink (client->ibus_bus);
}
connection = ibus_bus_get_connection (client->ibus_bus);
add_match_rule (connection, add_match_rule (connection,
"type='method_call'," "type='method_call',"
"interface='" IBUS_INTERFACE_INPUT_CONTEXT "'," "interface='" IBUS_INTERFACE_INPUT_CONTEXT "',"
...@@ -641,6 +637,22 @@ eekboard_client_enable_ibus_focus (EekboardClient *client) ...@@ -641,6 +637,22 @@ eekboard_client_enable_ibus_focus (EekboardClient *client)
focus_message_filter, focus_message_filter,
client, client,
NULL); NULL);
}
gboolean
eekboard_client_enable_ibus_focus (EekboardClient *client)
{
if (!client->ibus_bus) {
client->ibus_bus = ibus_bus_new ();
g_object_ref (client->ibus_bus);
g_signal_connect (client->ibus_bus, "connected",
G_CALLBACK(_ibus_connect_focus_handlers),
client);
}
if (ibus_bus_is_connected (client->ibus_bus))
_ibus_connect_focus_handlers (client->ibus_bus, client);
client->follows_focus = TRUE; client->follows_focus = TRUE;
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment