diff --git a/src/ui/main-window/PreviewPanel.swift b/src/ui/main-window/PreviewPanel.swift index 20ece7fd..85b578f8 100644 --- a/src/ui/main-window/PreviewPanel.swift +++ b/src/ui/main-window/PreviewPanel.swift @@ -40,6 +40,12 @@ class PreviewPanel: NSPanel { } currentId = id order(.below, relativeTo: App.app.thumbnailsPanel.windowNumber) + // Despite using `previewPanel.order(.below)`, a z-ordering issue can occur in the following scenario: + // 1. Show a preview of a window that is on a different monitor than the thumbnails panel + // 2. Select a window in the switcher that is on the same monitor as the thumbnails panel, and whose position overlaps with the thumbnails panel + // 3. For a single frame, the preview of the newly selected window can appear above the thumbnails panel before going back underneath it + // Simply using order(.below) is not sufficient to prevent this brief flicker. We explicitly set the preview panel's window level to be one below the thumbnails panel + App.app.previewPanel.level = App.app.thumbnailsPanel.level - 1 } } }