Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/insidegui/WWDC
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jun 11, 2024
2 parents 7613f71 + b167b4f commit fa66ca9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions PlayerUI/Views/PUIPlayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1372,14 +1372,23 @@ public final class PUIPlayerView: NSView {
return window.styleMask.contains(.fullScreen)
}

private var isTransitioningFromFullScreenPlayback = false

@objc private func windowWillEnterFullScreen() {
guard window is PUIPlayerWindow else { return }

appearanceDelegate?.presentDetachedStatus(.fullScreen.snapshot(using: snapshotClosure), for: self)

fullScreenButton.isHidden = true
updateTopTrailingMenuPosition()
}

@objc private func windowWillExitFullScreen() {
guard window is PUIPlayerWindow else { return }

/// Set this because it's not safe to check for our window's class in `windowDidExitFullScreen`.
isTransitioningFromFullScreenPlayback = true

/// The transition looks nicer if there's no background color, otherwise the player looks like it attaches
/// to the whole shelf area with black bars depending on the aspect ratio.
backgroundColor = .clear
Expand All @@ -1392,6 +1401,10 @@ public final class PUIPlayerView: NSView {
}

@objc private func windowDidExitFullScreen() {
guard isTransitioningFromFullScreenPlayback else { return }

isTransitioningFromFullScreenPlayback = false

/// Restore solid black background after finishing exit full screen transition.
backgroundColor = .black

Expand Down

0 comments on commit fa66ca9

Please sign in to comment.