Cleanup previous PR

This commit is contained in:
Kovid Goyal 2021-09-26 11:17:54 +05:30
parent b05e939e05
commit a038477ce0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 13 additions and 10 deletions

View File

@ -52,6 +52,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- When a :opt:`tab_bar_background` is specified it should extend to the edges - When a :opt:`tab_bar_background` is specified it should extend to the edges
of the OS window (:iss:`4054`) of the OS window (:iss:`4054`)
- Linux: Fix IME with fcitx5 not working after fcitx5 is restarted
(:pull:`4059`)
0.23.1 [2021-08-17] 0.23.1 [2021-08-17]

18
glfw/ibus_glfw.c vendored
View File

@ -147,15 +147,15 @@ message_handler(DBusConnection *conn UNUSED, DBusMessage *msg, void *user_data)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} }
static DBusHandlerResult static DBusHandlerResult
ibus_on_owner_change(DBusConnection* conn UNUSED, DBusMessage* msg, void* user_data) { ibus_on_owner_change(DBusConnection* conn UNUSED, DBusMessage* msg, void* user_data) {
if (dbus_message_is_signal(msg, "org.freedesktop.DBus", "NameOwnerChanged")) { if (dbus_message_is_signal(msg, "org.freedesktop.DBus", "NameOwnerChanged")) {
const char* name; const char* name;
const char* old_owner; const char* old_owner;
const char* new_owner; const char* new_owner;
if (!dbus_message_get_args(msg, NULL, if (!dbus_message_get_args(msg, NULL,
DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &old_owner, DBUS_TYPE_STRING, &old_owner,
DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_STRING, &new_owner,
DBUS_TYPE_INVALID DBUS_TYPE_INVALID
@ -168,7 +168,7 @@ ibus_on_owner_change(DBusConnection* conn UNUSED, DBusMessage* msg, void* user_d
} }
_GLFWIBUSData* ibus = (_GLFWIBUSData*) user_data; _GLFWIBUSData* ibus = (_GLFWIBUSData*) user_data;
ibus->ok = strcmp(new_owner, "") != 0; ibus->name_owner_changed = true;
return DBUS_HANDLER_RESULT_HANDLED; return DBUS_HANDLER_RESULT_HANDLED;
@ -317,6 +317,7 @@ glfw_connect_to_ibus(_GLFWIBUSData *ibus) {
if (ibus->inited) return; if (ibus->inited) return;
if (!test_env_var("GLFW_IM_MODULE", "ibus")) return; if (!test_env_var("GLFW_IM_MODULE", "ibus")) return;
ibus->inited = true; ibus->inited = true;
ibus->name_owner_changed = false;
setup_connection(ibus); setup_connection(ibus);
} }
@ -338,13 +339,12 @@ glfw_ibus_terminate(_GLFWIBUSData *ibus) {
static bool static bool
check_connection(_GLFWIBUSData *ibus) { check_connection(_GLFWIBUSData *ibus) {
if (!ibus->inited) return false; if (!ibus->inited) return false;
if (ibus->conn && dbus_connection_get_is_connected(ibus->conn) && ibus->ok) { if (ibus->conn && dbus_connection_get_is_connected(ibus->conn) && !ibus->name_owner_changed) return ibus->ok;
return ibus->ok;
}
struct stat s; struct stat s;
ibus->name_owner_changed = false;
if (stat(ibus->address_file_name, &s) != 0 || s.st_mtime != ibus->address_file_mtime) { if (stat(ibus->address_file_name, &s) != 0 || s.st_mtime != ibus->address_file_mtime) {
if (!read_ibus_address(ibus)) return false; if (!read_ibus_address(ibus)) return false;
setup_connection(ibus); return setup_connection(ibus);
} }
return false; return false;
} }

2
glfw/ibus_glfw.h vendored
View File

@ -32,7 +32,7 @@
#include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon.h>
typedef struct { typedef struct {
bool ok, inited; bool ok, inited, name_owner_changed;
time_t address_file_mtime; time_t address_file_mtime;
DBusConnection *conn; DBusConnection *conn;
const char *input_ctx_path, *address_file_name, *address; const char *input_ctx_path, *address_file_name, *address;