[vlc-commits] macosx: cascade multiple vout window positions, fix initial window positions

David Fuhrmann git at videolan.org
Thu Dec 27 11:49:17 CET 2012


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Thu Dec 27 11:41:25 2012 +0100| [5cb80582492b465c0a8ed58971a1de482689c8bd] | committer: David Fuhrmann

macosx: cascade multiple vout window positions, fix initial window positions

close #7873

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

 .../English.lproj/DetachedVideoWindow.xib          |   10 +++----
 modules/gui/macosx/VLCVoutWindowController.h       |    2 ++
 modules/gui/macosx/VLCVoutWindowController.m       |   29 ++++++++++++++++++--
 3 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/extras/package/macosx/Resources/English.lproj/DetachedVideoWindow.xib b/extras/package/macosx/Resources/English.lproj/DetachedVideoWindow.xib
index c305d25..99f865c 100644
--- a/extras/package/macosx/Resources/English.lproj/DetachedVideoWindow.xib
+++ b/extras/package/macosx/Resources/English.lproj/DetachedVideoWindow.xib
@@ -37,8 +37,8 @@
       <object class="NSWindowTemplate" id="951447013">
         <int key="NSWindowStyleMask">15</int>
         <int key="NSWindowBacking">2</int>
-        <string key="NSWindowRect">{{131, 97}, {363, 239}}</string>
-        <int key="NSWTFlags">1954022400</int>
+        <string key="NSWindowRect">{{91, 467}, {363, 239}}</string>
+        <int key="NSWTFlags">1948779520</int>
         <string key="NSWindowTitle">VLC media player</string>
         <string key="NSWindowClass">VLCDetachedVideoWindow</string>
         <nil key="NSViewClass"/>
@@ -331,7 +331,7 @@
           <reference key="NSSuperview"/>
           <string key="NSReuseIdentifierKey">_NS:122</string>
         </object>
-        <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
+        <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
         <string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
         <string key="NSFrameAutosaveName">detachedvideowindow</string>
         <bool key="NSWindowIsRestorable">NO</bool>
@@ -1120,9 +1120,9 @@
           <object class="NSAffineTransform">
             <bytes key="NSTransformStruct">AULCAABBMAAAA</bytes>
           </object>
-          <string>{{558, 677}, {363, 239}}</string>
+          <string>{{558, 517}, {363, 239}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-          <string>{{558, 677}, {363, 239}}</string>
+          <string>{{558, 517}, {363, 239}}</string>
           <boolean value="NO"/>
           <boolean value="NO"/>
           <string>{363, 203}</string>
diff --git a/modules/gui/macosx/VLCVoutWindowController.h b/modules/gui/macosx/VLCVoutWindowController.h
index 8a81822..69577fc 100644
--- a/modules/gui/macosx/VLCVoutWindowController.h
+++ b/modules/gui/macosx/VLCVoutWindowController.h
@@ -33,6 +33,8 @@
 @interface VLCVoutWindowController : NSObject
 {
     NSMutableDictionary *o_vout_dict;
+
+    NSPoint top_left_point;
 }
 
 - (VLCVoutView *)setupVoutForWindow:(vout_window_t *)p_wnd withProposedVideoViewPosition:(NSRect)videoViewPosition;
diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index 840b02e..93b7d89 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -102,8 +102,13 @@
         if (b_video_wallpaper)
             [o_new_video_window orderBack:nil];
         else {
-            [o_new_video_window center];
-            [o_new_video_window setFrameAutosaveName:@"extra-videowindow"];
+            // no frame autosave for additional vout windows
+            if (!b_multiple_vout_windows) {
+                // initial window position
+                [o_new_video_window center];
+                [o_new_video_window setFrameAutosaveName:@"extra-videowindow"];
+            }
+            
             [o_new_video_window setContentMinSize: NSMakeSize(f_min_video_height, f_min_video_height)];
         }
 
@@ -111,15 +116,21 @@
         b_nonembedded = YES;
     } else {
         if ((var_InheritBool(VLCIntf, "embedded-video") && !b_multiple_vout_windows) || b_nativeFullscreenMode) {
+            // setup embedded video
             o_vout_view = [[[VLCMainWindow sharedInstance] videoView] retain];
             o_new_video_window = [[VLCMainWindow sharedInstance] retain];
             b_nonembedded = NO;
         } else {
+            // setup detached window with controls
             NSWindowController *o_controller = [[NSWindowController alloc] initWithWindowNibName:@"DetachedVideoWindow"];
             [o_controller loadWindow];
             o_new_video_window = [(VLCDetachedVideoWindow *)[o_controller window] retain];
             [o_controller release];
 
+            // no frame autosave for additional vout windows
+            if (b_multiple_vout_windows)
+                [o_new_video_window setFrameAutosaveName:@""];
+
             [o_new_video_window setDelegate: o_new_video_window];
             [o_new_video_window setLevel:NSNormalWindowLevel];
             [o_new_video_window useOptimizedDrawing: YES];
@@ -136,6 +147,20 @@
             NSRect window_rect = [o_new_video_window getWindowRectForProposedVideoViewSize:videoViewSize];
             [o_new_video_window setFrame:window_rect display:YES];
         }
+
+        // cascade windows if we have more than one vout
+        if (b_multiple_vout_windows) {
+            if ([o_vout_dict count] == 1) {
+                NSWindow * o_first_window = [o_vout_dict objectForKey: [[o_vout_dict allKeys] objectAtIndex: 0]];
+
+                NSPoint topleftbase = NSMakePoint(0, [o_first_window frame].size.height);
+                top_left_point = [o_first_window convertBaseToScreen: topleftbase];
+            }
+
+            top_left_point = [o_new_video_window cascadeTopLeftFromPoint: top_left_point];
+            [o_new_video_window setFrameTopLeftPoint: top_left_point];
+        }
+        
         [o_new_video_window setNativeVideoSize:videoViewSize];
 
         [o_new_video_window makeKeyAndOrderFront: self];



More information about the vlc-commits mailing list