Fix macOS player window blink when playing a new video

The separate player window's show() restore branch reset alphaValue to 0
and faded back in even when the window was already on screen, so every
Play Now while playing made the window flash. Only run the fade when the
window was actually hidden (PiP restore); otherwise just bring it forward.
This commit is contained in:
Arkadiusz Fal
2026-06-03 22:27:38 +02:00
parent 5c8c55f41c
commit 31151df169

View File

@@ -49,6 +49,13 @@ final class ExpandedPlayerWindowManager: NSObject {
func show(with appEnvironment: AppEnvironment, animated: Bool = true) {
// If window already exists (hidden for PiP), restore it instead of creating new one
if let existingWindow = playerWindow {
// Already on screen (e.g. "Play Now" while playing) just bring it
// forward; resetting alphaValue here would make the window blink.
if existingWindow.isVisible {
LoggingService.shared.debug("ExpandedPlayerWindowManager: show() - window already visible, bringing to front", category: .player)
existingWindow.makeKeyAndOrderFront(nil)
return
}
LoggingService.shared.debug("ExpandedPlayerWindowManager: show() - restoring existing window (was hidden for PiP)", category: .player)
if animated {
existingWindow.alphaValue = 0