mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
fix: main window would sometimes appear after a delay (closes #1096)
This commit is contained in:
@@ -100,9 +100,13 @@ class Windows {
|
||||
|
||||
static func voiceOverFocusedWindow() {
|
||||
guard App.app.appIsBeingUsed && App.app.thumbnailsPanel.isKeyWindow else { return }
|
||||
let window = ThumbnailsView.recycledViews[focusedWindowIndex]
|
||||
if window.window_ != nil && window.window != nil {
|
||||
App.app.thumbnailsPanel.makeFirstResponder(window)
|
||||
// it seems that sometimes makeFirstResponder is called before the view is visible
|
||||
// and it creates a delay in showing the main window; calling it with some delay seems to work around this
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(10)) {
|
||||
let window = ThumbnailsView.recycledViews[focusedWindowIndex]
|
||||
if window.window_ != nil && window.window != nil {
|
||||
App.app.thumbnailsPanel.makeFirstResponder(window)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -217,10 +217,10 @@ class App: AppCenterApplication, NSApplicationDelegate {
|
||||
thumbnailsPanel.thumbnailsView.updateItemsAndLayout(currentScreen)
|
||||
guard appIsBeingUsed else { return }
|
||||
thumbnailsPanel.setContentSize(thumbnailsPanel.thumbnailsView.frame.size)
|
||||
Windows.voiceOverFocusedWindow() // at this point ThumbnailViews are assigned to the window, and ready
|
||||
thumbnailsPanel.display()
|
||||
guard appIsBeingUsed else { return }
|
||||
currentScreen.repositionPanel(thumbnailsPanel, .appleCentered)
|
||||
Windows.voiceOverFocusedWindow() // at this point ThumbnailViews are assigned to the window, and ready
|
||||
}
|
||||
|
||||
private func refreshSpecificWindows(_ windowsToUpdate: [Window]?, _ currentScreen: NSScreen) -> ()? {
|
||||
|
||||
Reference in New Issue
Block a user