Closed
Description
System and IINA version:
- macOS 14.1
- IINA 1.3.3
Expected behavior:
Black windows on the other screens disappear when IINA exits full screen.
Actual behavior:
Black windows did not disappear.
Steps to reproduce:
- Turn on “Black out other monitors while in full screen”.
- With a dual-monitor setup, play a video in full screen.
- Let the computer go to sleep.
- Wake up the computer but do not unlock.
- Wait for the other monitor to reconnect.
- Unlock the computer.
- Try to exit full screen and observe the black window not being removed.
Applying the following patch before reproducing the problem results in these log entries:
Patch
diff --git a/iina/MainWindowController.swift b/iina/MainWindowController.swift
index de1ac6e..367cdc7 100644
--- a/iina/MainWindowController.swift
+++ b/iina/MainWindowController.swift
@@ -618,6 +618,7 @@ class MainWindowController: PlayerWindowController {
// This observer handles a situation that the user connected a new screen or removed a screen
let screenCount = NSScreen.screens.count
if self.fsState.isFullscreen && Preference.bool(for: .blackOutMonitor) && self.cachedScreenCount != screenCount {
+ Logger.log("didChangeScreenParametersNotification, cachedScreenCount: \(self.cachedScreenCount), newCount = \(screenCount)")
self.removeBlackWindow()
self.blackOutOtherMonitors()
}
@@ -1341,6 +1342,7 @@ class MainWindowController: PlayerWindowController {
videoView.videoLayer.resume()
if Preference.bool(for: .blackOutMonitor) {
+ Logger.log("windowDidEnterFullScreen")
blackOutOtherMonitors()
}
@@ -1425,6 +1427,7 @@ class MainWindowController: PlayerWindowController {
fsState.finishAnimating()
if Preference.bool(for: .blackOutMonitor) {
+ Logger.log("windowDidExitFullScreen")
removeBlackWindow()
}
@@ -1730,6 +1733,7 @@ class MainWindowController: PlayerWindowController {
super.windowDidBecomeMain(notification)
if fsState.isFullscreen && Preference.bool(for: .blackOutMonitor) {
+ Logger.log("windowDidBecomeMain")
blackOutOtherMonitors()
}
player.events.emit(.windowMainStatusChanged, data: true)
@@ -1738,6 +1742,7 @@ class MainWindowController: PlayerWindowController {
override func windowDidResignMain(_ notification: Notification) {
super.windowDidResignMain(notification)
if Preference.bool(for: .blackOutMonitor) {
+ Logger.log("windowDidResignMain")
removeBlackWindow()
}
player.events.emit(.windowMainStatusChanged, data: false)
@@ -2562,8 +2567,10 @@ class MainWindowController: PlayerWindowController {
// MARK: - UI: Others
private func blackOutOtherMonitors() {
+ Logger.log("blackOutOtherMonitors")
screens = NSScreen.screens.filter { $0 != window?.screen }
+ Logger.log("blackWindows.count: \(blackWindows.count)")
blackWindows = []
for screen in screens {
@@ -2579,6 +2586,7 @@ class MainWindowController: PlayerWindowController {
}
private func removeBlackWindow() {
+ Logger.log("removeBlackWindow")
for window in blackWindows {
window.orderOut(self)
}
It appears that these events happened in sequence:
- The monitor reconnected.
- Black windows were recreated.
- The user unlocked the computer and IINA’s
MainWindow
became main. - Black windows were recreated again but without the previously created ones removed.