macOS: Persist "Secure Keyboard Entry" across restarts to match the behavior of Terminal.app

Fixes #4471
This commit is contained in:
Kovid Goyal 2022-01-08 14:13:14 +05:30
parent ac0c10c170
commit 356897a32d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 1 deletions

View File

@ -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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -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