diff --git a/docs/changelog.rst b/docs/changelog.rst index 02383f151..2773b581f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -79,6 +79,10 @@ Detailed list of changes - macOS: Allow opening text files, images and directories with kitty when launched using "Open with" in Finder (:iss:`4460`) +- macOS: Persist "Secure Keyboard Entry" across restarts to match the behavior + of Terminal.app (:iss:`4471`) + + 0.24.1 [2022-01-06] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index f9a27e60c..44ef1692e 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -1586,6 +1586,8 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) { if (self != nil) { glfw_window = initWindow; self.tabbingMode = NSWindowTabbingModeDisallowed; + SecureKeyboardEntryController *k = [SecureKeyboardEntryController sharedInstance]; + if (!k.isDesired && [[NSUserDefaults standardUserDefaults] boolForKey:@"SecureKeyboardEntry"]) [k toggle]; } return self; } @@ -1612,7 +1614,9 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) { - (void)toggleSecureInput:(id)sender { (void)sender; - [[SecureKeyboardEntryController sharedInstance] toggle]; + SecureKeyboardEntryController *k = [SecureKeyboardEntryController sharedInstance]; + [k toggle]; + [[NSUserDefaults standardUserDefaults] setBool:k.isDesired forKey:@"SecureKeyboardEntry"]; } - (BOOL)canBecomeKeyWindow