From 9c48e4965c1c88be17a8c5b740e93d2c17083f5c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 10 Jul 2018 14:01:25 +0530 Subject: [PATCH] Send key events to ibus --- glfw/ibus_glfw.c | 3 ++- glfw/ibus_glfw.h | 2 +- glfw/xkb_glfw.c | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/glfw/ibus_glfw.c b/glfw/ibus_glfw.c index 66fa90244..4d4a3dad7 100644 --- a/glfw/ibus_glfw.c +++ b/glfw/ibus_glfw.c @@ -325,11 +325,12 @@ key_event_processed(DBusMessage *msg, const char* errmsg, void *data) { uint32_t handled; if (!glfw_dbus_get_args(msg, "Failed to get IBUS handled key from reply", DBUS_TYPE_BOOLEAN, &handled, DBUS_TYPE_INVALID)) return; KeyEvent *ev = (KeyEvent*)data; + debug("IBUS processed scancode: 0x%x release: %d handled: %u\n", ev->keycode, ev->action == GLFW_RELEASE, handled); free(ev); } GLFWbool -process_key(const KeyEvent *ev_) { +ibus_process_key(const KeyEvent *ev_) { if (!check_connection(ev_->ibus)) return GLFW_FALSE; KeyEvent *ev = malloc(sizeof(KeyEvent)); if (!ev) return GLFW_FALSE; diff --git a/glfw/ibus_glfw.h b/glfw/ibus_glfw.h index 04039b50b..c1a8510a9 100644 --- a/glfw/ibus_glfw.h +++ b/glfw/ibus_glfw.h @@ -49,4 +49,4 @@ void glfw_connect_to_ibus(_GLFWIBUSData *ibus); void glfw_ibus_terminate(_GLFWIBUSData *ibus); void glfw_ibus_set_focused(_GLFWIBUSData *ibus, GLFWbool focused); void glfw_ibus_dispatch(_GLFWIBUSData *ibus); -GLFWbool process_key(const KeyEvent *ev_); +GLFWbool ibus_process_key(const KeyEvent *ev_); diff --git a/glfw/xkb_glfw.c b/glfw/xkb_glfw.c index 727802730..5afb12b4a 100644 --- a/glfw/xkb_glfw.c +++ b/glfw/xkb_glfw.c @@ -428,7 +428,10 @@ glfw_xkb_handle_key_event(_GLFWwindow *window, _GLFWXKBData *xkb, xkb_keycode_t debug("clean_sym: %s ", glfw_xkb_keysym_name(clean_syms[0])); ev.action = action; ev.glfw_modifiers = xkb->modifiers; ev.keycode = scancode; ev.keysym = glfw_sym; ev.ibus = &xkb->ibus; - process_key(&ev); + if (ibus_process_key(&ev)) { + debug(" queued in IBUS\n"); + return; + } if (action == GLFW_PRESS || action == GLFW_REPEAT) { const char *text_type = "composed_text"; glfw_sym = compose_symbol(xkb, syms[0]);