This fix is based on `tests/ime.c` of shibukawa's fix: https://github.com/glfw/glfw/pull/658 d36a164423 I simplified and restructured it entirely.
d36a164423