8000 Black windows on the other screens won’t disappear when exiting full screen · Issue #4683 · iina/iina · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Black windows on the other screens won’t disappear when exiting full screen #4683
Closed
@coin3x

Description

@coin3x

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:

  1. Turn on “Black out other monitors while in full screen”.
  2. With a dual-monitor setup, play a video in full screen.
  3. Let the computer go to sleep.
  4. Wake up the computer but do not unlock.
  5. Wait for the other monitor to reconnect.
  6. Unlock the computer.
  7. 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)
     }

image

It appears that these events happened in sequence:

  1. The monitor reconnected.
  2. Black windows were recreated.
  3. The user unlocked the computer and IINA’s MainWindow became main.
  4. Black windows were recreated again but without the previously created ones removed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0