macOS: Fix keyboard input not working after toggling traditional fullscreen till the window is clicked in

This commit is contained in:
Kovid Goyal 2021-11-13 14:20:18 +05:30
parent 181178b0ea
commit 0965fc45f2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 6 additions and 4 deletions

View File

@ -143,6 +143,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- When remembering OS window sizes for full screen windows use the size before
the window became fullscreen (:iss:`4221`)
- macOS: Fix keyboard input not working after toggling traditional fullscreen
till the window is clicked in
0.23.1 [2021-08-17]
----------------------

View File

@ -470,7 +470,7 @@ is_modified_tab(NSEvent *event, NSEventModifierFlags modifierFlags) {
// ctrl+whatever+tab, option+cmd+tab
if (
(
(modifierFlags & NSEventModifierFlagControl) ||
(modifierFlags & NSEventModifierFlagControl) ||
modifierFlags == (NSEventModifierFlagOption | NSEventModifierFlagCommand)
) && [event.charactersIgnoringModifiers isEqualToString:@"\t"]
) return true;

View File

@ -2464,9 +2464,6 @@ bool _glfwPlatformToggleFullscreen(_GLFWwindow* w, unsigned int flags) {
[[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationDefault];
w->ns.in_traditional_fullscreen = false;
}
// At this point keyboard input does not work even though isKeyWindow returns true
// Calling makeKeyAndOrderFront also has no effect. Neither does calling becomeKeyWindow
// Calling them after an interval with performSelector also has no effect
} else {
bool in_fullscreen = sm & NSWindowStyleMaskFullScreen;
if (!(in_fullscreen)) {
@ -2479,6 +2476,8 @@ bool _glfwPlatformToggleFullscreen(_GLFWwindow* w, unsigned int flags) {
}
[window setStyleMask: sm];
}
// Changing the style mask causes the first responder to be cleared
[window makeFirstResponder:w->ns.view];
// If the dock and menubar are hidden going from maximized to fullscreen doesnt change the window size
// and macOS forgets to trigger windowDidResize, so call it ourselves
NSNotification *notification = [NSNotification notificationWithName:NSWindowDidResizeNotification object:window];