Send key events to ibus

This commit is contained in:
Kovid Goyal 2018-07-10 14:01:25 +05:30
parent 8675659fcb
commit 9c48e4965c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 7 additions and 3 deletions

3
glfw/ibus_glfw.c vendored
View File

@ -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;

2
glfw/ibus_glfw.h vendored
View File

@ -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_);

5
glfw/xkb_glfw.c vendored
View File

@ -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]);