macOS: Explicitly cancel IME composition when losing the focus

This commit is contained in:
pagedown
2022-01-26 18:21:20 +08:00
parent d1531632a2
commit a3aaaa1efb

View File

@@ -709,6 +709,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputWindowFocus(window, false);
// IME is cancelled when losing the focus
if ([window->ns.view hasMarkedText]) {
[[window->ns.view inputContext] discardMarkedText];
[window->ns.view unmarkText];
GLFWkeyevent dummy = {.action = GLFW_RELEASE, .ime_state = GLFW_IME_PREEDIT_CHANGED};
_glfwInputKeyboard(window, &dummy);