mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-26 02:41:54 +00:00
macOS: Ignore Tahoe zombie windows when cycling through windows with cmd+`. Fixes #9215
This commit is contained in:
parent
a4a7f77ef1
commit
301dc8a736
1 changed files with 13 additions and 7 deletions
|
|
@ -926,14 +926,20 @@ cocoa_toggle_secure_keyboard_entry(void) {
|
|||
|
||||
void
|
||||
cocoa_cycle_through_os_windows(void) {
|
||||
NSArray *windows = [NSApp orderedWindows];
|
||||
if (windows.count < 2) return;
|
||||
|
||||
NSArray *allWindows = [NSApp orderedWindows];
|
||||
if (allWindows.count < 2) return;
|
||||
NSMutableArray<NSWindow *> *filteredWindows = [NSMutableArray array];
|
||||
for (NSWindow *window in allWindows) {
|
||||
NSRect windowFrame = [window frame];
|
||||
// Exclude zero size windows which are likely zombie windows from the Tahoe bug
|
||||
if (windowFrame.size.width > 0 && windowFrame.size.height > 0) [filteredWindows addObject:window];
|
||||
}
|
||||
if (filteredWindows.count < 2) return;
|
||||
NSWindow *keyWindow = [NSApp keyWindow];
|
||||
NSUInteger index = [windows indexOfObject:keyWindow];
|
||||
NSUInteger nextIndex = (index + 1) % windows.count;
|
||||
|
||||
NSWindow *nextWindow = windows[nextIndex];
|
||||
NSUInteger index = [filteredWindows indexOfObject:keyWindow];
|
||||
if (index < 0) return;
|
||||
NSUInteger nextIndex = (index + 1) % filteredWindows.count;
|
||||
NSWindow *nextWindow = filteredWindows[nextIndex];
|
||||
[nextWindow makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue