[vlc-commits] macosx: set video frame to detached window frame, instead of vice versa

David Fuhrmann git at videolan.org
Sat Jul 28 17:03:05 CEST 2012


vlc/vlc-2.0 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sat Jul 28 12:01:57 2012 -0300| [1ea27b12e6cf18d85532cc7db35d106aebb7e71e] | committer: Felix Paul Kühne

macosx: set video frame to detached window frame, instead of vice versa

Now, the detached window position is restored on relaunch. Furthermore, this fixes some positioning issue when switching from macosx-background to detached video view.

Manual backport of 41631564e91d928f762d0aa56417e93c32db0a52

Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=1ea27b12e6cf18d85532cc7db35d106aebb7e71e
---

 modules/gui/macosx/MainWindow.m |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 84bb18c..1805e7e 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1556,23 +1556,26 @@ static VLCMainWindow *_o_sharedInstance = nil;
         if ([o_video_view superview] != NULL)
             [o_video_view removeFromSuperviewWithoutNeedingDisplay];
 
-        NSRect frame = [o_detached_video_window frame];
-        NSRect videoFrame = [o_video_view frame];
-        frame.size.width = videoFrame.size.width;
+        NSRect videoFrame;
+        videoFrame.size = [[o_detached_video_window contentView] frame].size;
         if (b_video_deco)
-            frame.size.height = videoFrame.size.height + [o_detached_bottombar_view frame].size.height + [o_titlebar_view frame].size.height;
+        {
+            videoFrame.size.height -= [o_detached_bottombar_view frame].size.height;
+            if( b_dark_interface )
+                videoFrame.size.height -= [o_detached_titlebar_view frame].size.height;
+
+            videoFrame.origin.x = .0;
+            videoFrame.origin.y = [o_detached_bottombar_view frame].size.height;
+        }
         else
         {
-            frame.size.height = videoFrame.size.height;
             videoFrame.origin.y = .0;
             videoFrame.origin.x = .0;
-            [o_video_view setFrame: videoFrame];
         }
-        [o_detached_video_window setFrame: frame display: NO];
+        [o_video_view setFrame: videoFrame];
         [[o_detached_video_window contentView] addSubview: o_video_view positioned:NSWindowAbove relativeTo:nil];
         [o_detached_video_window setLevel:NSNormalWindowLevel];
         [o_detached_video_window useOptimizedDrawing: YES];
-        [o_detached_video_window center];
         b_nonembedded = YES;
     }
     [[o_video_view window] makeKeyAndOrderFront: self];



More information about the vlc-commits mailing list