Skip to content

armgit / cra

Public Imported from GitHub
0

The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.

Peek's open and close show the card's bar and page, not a navy block (#175)

Victor Kildahl5284c4845b1b
diff --git a/Sources/Cra/UI/Windows/PeekChrome.swift b/Sources/Cra/UI/Windows/PeekChrome.swift
index 7efd2fa..2fc2c6e 100644
--- a/Sources/Cra/UI/Windows/PeekChrome.swift
+++ b/Sources/Cra/UI/Windows/PeekChrome.swift
@@ -328,7 +328,9 @@ final class PeekTransition {
/// window), with `page` drawn over `pageRect` (the view's coordinates, y up) when given.
static func picture(of view: NSView, page: CGImage? = nil, pageRect: NSRect = .zero) -> CGImage? {
view.layoutSubtreeIfNeeded()
- view.displayIfNeeded()
+ // AppKit hangs the subviews' layers under the view's only when the window displays;
+ // before that render(in:) drew the card's navy background alone, without its bar or page.
+ if let window = view.window { window.display() } else { view.displayIfNeeded() }
guard let layer = view.layer else { return nil }
let scale = view.window?.backingScaleFactor ?? 2
let w = Int(view.bounds.width * scale), h = Int(view.bounds.height * scale)