Make sure that IBusBus is connected when setting up DBus message filter.
This commit is contained in:
28
src/client.c
28
src/client.c
@ -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)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user