Update IME status when window lost focus

This commit is contained in:
pagedown 2021-11-28 23:09:35 +08:00
parent 6a8aeb2501
commit 088b7cde4f
No known key found for this signature in database
GPG Key ID: E921CF18AC8FF6EB

View File

@ -864,6 +864,12 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
showCursor(window);
_glfwInputWindowFocus(window, false);
// IME is cancelled when losing the focus
if ([window->ns.view hasMarkedText]) {
[window->ns.view unmarkText];
GLFWkeyevent dummy = {.action = GLFW_RELEASE, .ime_state = GLFW_IME_PREEDIT_CHANGED};
_glfwInputKeyboard(window, &dummy);
}
}
- (void)windowDidChangeScreen:(NSNotification *)notification