GNOME: Workaround for GNOME's text input system going into an infinite loop if cursor position is updated in response to a done event

Fixes #5105
This commit is contained in:
Kovid Goyal
2022-05-23 10:36:58 +05:30
parent ea8bed2a71
commit e7da874b82
5 changed files with 16 additions and 4 deletions

3
kitty/glfw-wrapper.h generated
View File

@@ -954,7 +954,8 @@ typedef enum {
typedef enum {
GLFW_IME_NONE,
GLFW_IME_PREEDIT_CHANGED,
GLFW_IME_COMMIT_TEXT
GLFW_IME_COMMIT_TEXT,
GLFW_IME_WAYLAND_DONE_EVENT,
} GLFWIMEState;
typedef enum {

View File

@@ -136,6 +136,12 @@ on_key_input(GLFWkeyevent *ev) {
id_type active_window_id = w->id;
switch(ev->ime_state) {
case GLFW_IME_WAYLAND_DONE_EVENT:
// If we update IME position here it sends GNOME's text input system into
// an infinite loop. See https://github.com/kovidgoyal/kitty/issues/5105
screen_draw_overlay_text(screen, NULL);
debug("handled wayland IME done event");
return;
case GLFW_IME_PREEDIT_CHANGED:
update_ime_position(w, screen);
screen_draw_overlay_text(screen, text);