Ensure no ibus comms take place till the connection is fully setup

This commit is contained in:
Kovid Goyal 2018-07-10 09:25:10 +05:30
parent 6879a492dc
commit 3b226618ad
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

6
glfw/ibus_glfw.c vendored
View File

@ -166,10 +166,10 @@ input_context_created(DBusMessage *msg, const char* errmsg, void *data) {
ibus->input_ctx_path = strdup(path);
enum Capabilities caps = IBUS_CAP_FOCUS | IBUS_CAP_PREEDIT_TEXT;
if (!glfw_dbus_call_void_method(ibus->conn, IBUS_SERVICE, ibus->input_ctx_path, IBUS_INPUT_INTERFACE, "SetCapabilities", DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID)) return;
ibus->ok = GLFW_TRUE;
glfw_ibus_set_focused(ibus, GLFW_FALSE);
set_cursor_geometry(ibus, 0, 0, 0, 0);
debug("Connected to IBUS daemon for IME input management\n");
ibus->ok = GLFW_TRUE;
}
GLFWbool
@ -230,12 +230,12 @@ static GLFWbool
check_connection(_GLFWIBUSData *ibus) {
if (!ibus->inited) return GLFW_FALSE;
if (ibus->conn && dbus_connection_get_is_connected(ibus->conn)) {
return GLFW_TRUE;
return ibus->ok;
}
struct stat s;
if (stat(ibus->address_file_name, &s) != 0 || s.st_mtime != ibus->address_file_mtime) {
if (!read_ibus_address(ibus)) return GLFW_FALSE;
return setup_connection(ibus);
setup_connection(ibus);
}
return GLFW_FALSE;
}