mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
fix: prevent flickering when switching to a previewed window
(closes #2432)
This commit is contained in:
@@ -178,6 +178,7 @@ class Window {
|
||||
} else if let bundleID = application.runningApplication.bundleIdentifier, bundleID == App.id {
|
||||
App.shared.activate(ignoringOtherApps: true)
|
||||
App.app.window(withWindowNumber: Int(cgWindowId!))?.makeKeyAndOrderFront(nil)
|
||||
Windows.previewFocusedWindowIfNeeded()
|
||||
} else {
|
||||
// macOS bug: when switching to a System Preferences window in another space, it switches to that space,
|
||||
// but quickly switches back to another window in that space
|
||||
@@ -189,6 +190,9 @@ class Window {
|
||||
_SLPSSetFrontProcessWithOptions(&psn, self.cgWindowId!, SLPSMode.userGenerated.rawValue)
|
||||
self.makeKeyWindow(psn)
|
||||
self.axUiElement.focusWindow()
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(50)) {
|
||||
Windows.previewFocusedWindowIfNeeded()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-3
@@ -109,13 +109,15 @@ class App: AppCenterApplication, NSApplicationDelegate {
|
||||
App.shared.terminate(self)
|
||||
}
|
||||
|
||||
func hideUi() {
|
||||
func hideUi(_ keepPreview: Bool = false) {
|
||||
debugPrint("hideUi")
|
||||
appIsBeingUsed = false
|
||||
isFirstSummon = true
|
||||
MouseEvents.toggle(false)
|
||||
hideThumbnailPanelWithoutChangingKeyWindow()
|
||||
previewPanel.orderOut(nil)
|
||||
if !keepPreview {
|
||||
previewPanel.orderOut(nil)
|
||||
}
|
||||
hideAllTooltips()
|
||||
}
|
||||
|
||||
@@ -205,12 +207,14 @@ class App: AppCenterApplication, NSApplicationDelegate {
|
||||
}
|
||||
|
||||
func focusSelectedWindow(_ selectedWindow: Window?) {
|
||||
hideUi()
|
||||
hideUi(true)
|
||||
if let window = selectedWindow, !MissionControl.isActive() {
|
||||
window.focus()
|
||||
if Preferences.cursorFollowFocusEnabled {
|
||||
moveCursorToSelectedWindow(window)
|
||||
}
|
||||
} else {
|
||||
previewPanel.orderOut(nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user