Special case the IME injecting text in on_key_input

This commit is contained in:
Kovid Goyal
2022-01-22 20:00:03 +05:30
parent 688a3eaef7
commit ff836a85aa

View File

@@ -152,6 +152,12 @@ on_key_input(GLFWkeyevent *ev) {
debug("invalid state, ignoring\n");
return;
}
if (!native_key && !key && text[0]) {
// key == 0 is sent by the glfw coca backend when text is inserted by the IME outside the key handlers
schedule_write_to_child(w->id, 1, text, strlen(text));
debug("sent key as text to child\n");
return;
}
PyObject *ke = NULL;
#define create_key_event() { ke = convert_glfw_key_event_to_python(ev); if (!ke) { PyErr_Print(); return; } }
if (global_state.in_sequence_mode) {
@@ -187,8 +193,7 @@ on_key_input(GLFWkeyevent *ev) {
}
}
if (!w) return;
} else if (w->last_special_key_pressed == key && key != 0) {
// key == 0 is sent by the glfw coca backend when text is inserted by the IME outside the key handlers
} else if (w->last_special_key_pressed == key) {
w->last_special_key_pressed = 0;
debug("ignoring release event for previous press that was handled as shortcut\n");
return;