[vlc-commits] macosx: fs panel: Ensure fs panel always stays inside the vout rect

David Fuhrmann git at videolan.org
Wed Jan 15 22:08:58 CET 2020


vlc/vlc-3.0 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Wed Jan 15 21:43:14 2020 +0100| [a164c91ccbbf1a49d28ce2e1fd956dec4ee0bf5c] | committer: David Fuhrmann

macosx: fs panel: Ensure fs panel always stays inside the vout rect

In very rare cases, it was possible to move the fs panel to another
monitor, and it was not recentered once fullscreen was started
on a different monitor again. This led to the fullscreen window
and the fs panel being shown on different screens.

To trigger the bug, the user needed to move a native fullscreen window
to another monitor using Expose, which was undetected by VLC and thus
invalidated the internal state.

This commit adds a second check to detect this case and also
ensure recentering of the panel here.

(cherry picked from commit f7855c3327d9a68fab8de125657b852ff7e9ceb2)
Signed-off-by: David Fuhrmann <dfuhrmann at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=a164c91ccbbf1a49d28ce2e1fd956dec4ee0bf5c
---

 modules/gui/macosx/VLCFSPanelController.m | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/gui/macosx/VLCFSPanelController.m b/modules/gui/macosx/VLCFSPanelController.m
index 2c79780264..db76397470 100644
--- a/modules/gui/macosx/VLCFSPanelController.m
+++ b/modules/gui/macosx/VLCFSPanelController.m
@@ -401,7 +401,14 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
     _associatedVoutWindow = voutWindow;
 
     NSRect voutRect = voutWindow.frame;
-    if (!NSEqualRects(_associatedVoutFrame, voutRect)) {
+
+    // In some cases, the FSPanel frame has moved outside of the
+    // vout view --> Also re-center in this case
+    NSRect currentFrame = [self.window frame];
+    NSRect constrainedFrame = [self contrainFrameToAssociatedVoutWindow: currentFrame];
+
+    if (!NSEqualRects(_associatedVoutFrame, voutRect) ||
+        !NSEqualRects(currentFrame, constrainedFrame)) {
         _associatedVoutFrame = voutRect;
         [[NSUserDefaults standardUserDefaults] setObject:NSStringFromRect(_associatedVoutFrame) forKey:kAssociatedFullscreenRect];
 



More information about the vlc-commits mailing list