Commit 5cb80582 authored by David Fuhrmann's avatar David Fuhrmann

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

close #7873
parent 25f233cf
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
<object class="NSWindowTemplate" id="951447013"> <object class="NSWindowTemplate" id="951447013">
<int key="NSWindowStyleMask">15</int> <int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int> <int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{131, 97}, {363, 239}}</string> <string key="NSWindowRect">{{91, 467}, {363, 239}}</string>
<int key="NSWTFlags">1954022400</int> <int key="NSWTFlags">1948779520</int>
<string key="NSWindowTitle">VLC media player</string> <string key="NSWindowTitle">VLC media player</string>
<string key="NSWindowClass">VLCDetachedVideoWindow</string> <string key="NSWindowClass">VLCDetachedVideoWindow</string>
<nil key="NSViewClass"/> <nil key="NSViewClass"/>
...@@ -331,7 +331,7 @@ ...@@ -331,7 +331,7 @@
<reference key="NSSuperview"/> <reference key="NSSuperview"/>
<string key="NSReuseIdentifierKey">_NS:122</string> <string key="NSReuseIdentifierKey">_NS:122</string>
</object> </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="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<string key="NSFrameAutosaveName">detachedvideowindow</string> <string key="NSFrameAutosaveName">detachedvideowindow</string>
<bool key="NSWindowIsRestorable">NO</bool> <bool key="NSWindowIsRestorable">NO</bool>
...@@ -1120,9 +1120,9 @@ ...@@ -1120,9 +1120,9 @@
<object class="NSAffineTransform"> <object class="NSAffineTransform">
<bytes key="NSTransformStruct">AULCAABBMAAAA</bytes> <bytes key="NSTransformStruct">AULCAABBMAAAA</bytes>
</object> </object>
<string>{{558, 677}, {363, 239}}</string> <string>{{558, 517}, {363, 239}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</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"/>
<boolean value="NO"/> <boolean value="NO"/>
<string>{363, 203}</string> <string>{363, 203}</string>
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
@interface VLCVoutWindowController : NSObject @interface VLCVoutWindowController : NSObject
{ {
NSMutableDictionary *o_vout_dict; NSMutableDictionary *o_vout_dict;
NSPoint top_left_point;
} }
- (VLCVoutView *)setupVoutForWindow:(vout_window_t *)p_wnd withProposedVideoViewPosition:(NSRect)videoViewPosition; - (VLCVoutView *)setupVoutForWindow:(vout_window_t *)p_wnd withProposedVideoViewPosition:(NSRect)videoViewPosition;
......
...@@ -102,8 +102,13 @@ ...@@ -102,8 +102,13 @@
if (b_video_wallpaper) if (b_video_wallpaper)
[o_new_video_window orderBack:nil]; [o_new_video_window orderBack:nil];
else { else {
[o_new_video_window center]; // no frame autosave for additional vout windows
[o_new_video_window setFrameAutosaveName:@"extra-videowindow"]; 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)]; [o_new_video_window setContentMinSize: NSMakeSize(f_min_video_height, f_min_video_height)];
} }
...@@ -111,15 +116,21 @@ ...@@ -111,15 +116,21 @@
b_nonembedded = YES; b_nonembedded = YES;
} else { } else {
if ((var_InheritBool(VLCIntf, "embedded-video") && !b_multiple_vout_windows) || b_nativeFullscreenMode) { if ((var_InheritBool(VLCIntf, "embedded-video") && !b_multiple_vout_windows) || b_nativeFullscreenMode) {
// setup embedded video
o_vout_view = [[[VLCMainWindow sharedInstance] videoView] retain]; o_vout_view = [[[VLCMainWindow sharedInstance] videoView] retain];
o_new_video_window = [[VLCMainWindow sharedInstance] retain]; o_new_video_window = [[VLCMainWindow sharedInstance] retain];
b_nonembedded = NO; b_nonembedded = NO;
} else { } else {
// setup detached window with controls
NSWindowController *o_controller = [[NSWindowController alloc] initWithWindowNibName:@"DetachedVideoWindow"]; NSWindowController *o_controller = [[NSWindowController alloc] initWithWindowNibName:@"DetachedVideoWindow"];
[o_controller loadWindow]; [o_controller loadWindow];
o_new_video_window = [(VLCDetachedVideoWindow *)[o_controller window] retain]; o_new_video_window = [(VLCDetachedVideoWindow *)[o_controller window] retain];
[o_controller release]; [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 setDelegate: o_new_video_window];
[o_new_video_window setLevel:NSNormalWindowLevel]; [o_new_video_window setLevel:NSNormalWindowLevel];
[o_new_video_window useOptimizedDrawing: YES]; [o_new_video_window useOptimizedDrawing: YES];
...@@ -136,6 +147,20 @@ ...@@ -136,6 +147,20 @@
NSRect window_rect = [o_new_video_window getWindowRectForProposedVideoViewSize:videoViewSize]; NSRect window_rect = [o_new_video_window getWindowRectForProposedVideoViewSize:videoViewSize];
[o_new_video_window setFrame:window_rect display:YES]; [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 setNativeVideoSize:videoViewSize];
[o_new_video_window makeKeyAndOrderFront: self]; [o_new_video_window makeKeyAndOrderFront: self];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment