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

David Fuhrmann git at videolan.org
Tue Jul 24 11:44:05 CEST 2012


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Tue Jul 24 11:32:55 2012 +0200| [41631564e91d928f762d0aa56417e93c32db0a52] | committer: David Fuhrmann

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.

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

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

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 223882b..c3addb5 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1800,23 +1800,27 @@ 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;
         }
 



More information about the vlc-commits mailing list