From 87a2b219a55e1598a7ffd2113e319199638d317b Mon Sep 17 00:00:00 2001 From: Ben Delaney Date: Sun, 15 Dec 2024 17:50:55 +1100 Subject: [PATCH] fix: enabling previews with multiple screens could lead to flickering --- src/ui/main-window/PreviewPanel.swift | 6 ++++++ 1 file changed, 6 insertions(+) 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 } } }