Commit 92b48ad4 authored by David Fuhrmann's avatar David Fuhrmann

macosx: add own video view for each window

Note that this commit will break some stuff for non-embedded cases, for now.

refs #6814
parent b9dc8922
......@@ -21,6 +21,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -53,7 +54,7 @@
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<object class="NSView" key="NSWindowView" id="429932428">
<nil key="NSNextResponder"/>
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -191,6 +192,7 @@
</object>
<string key="NSFrame">{{1, 1}, {199, 272}}</string>
<reference key="NSSuperview" ref="979766179"/>
<reference key="NSNextKeyView" ref="1064884668"/>
<reference key="NSDocView" ref="1064884668"/>
<reference key="NSBGColor" ref="885475112"/>
<int key="NScvFlags">4</int>
......@@ -219,6 +221,7 @@
</object>
<string key="NSFrameSize">{201, 274}</string>
<reference key="NSSuperview" ref="824340487"/>
<reference key="NSNextKeyView" ref="18556274"/>
<int key="NSsFlags">133650</int>
<reference key="NSVScroller" ref="252983915"/>
<reference key="NSHScroller" ref="11557666"/>
......@@ -449,6 +452,7 @@
</object>
<string key="NSFrame">{{1, 17}, {402, 236}}</string>
<reference key="NSSuperview" ref="915491793"/>
<reference key="NSNextKeyView" ref="23448837"/>
<reference key="NSDocView" ref="23448837"/>
<reference key="NSBGColor" ref="885475112"/>
<int key="NScvFlags">4</int>
......@@ -483,6 +487,7 @@
</object>
<string key="NSFrame">{{1, 0}, {402, 17}}</string>
<reference key="NSSuperview" ref="915491793"/>
<reference key="NSNextKeyView" ref="823165105"/>
<reference key="NSDocView" ref="823165105"/>
<reference key="NSBGColor" ref="885475112"/>
<int key="NScvFlags">4</int>
......@@ -490,6 +495,7 @@
</object>
<string key="NSFrameSize">{404, 254}</string>
<reference key="NSSuperview" ref="440594360"/>
<reference key="NSNextKeyView" ref="343242432"/>
<int key="NSsFlags">133682</int>
<reference key="NSVScroller" ref="573737110"/>
<reference key="NSHScroller" ref="297523533"/>
......@@ -1056,6 +1062,7 @@
</object>
</object>
<string key="NSFrameSize">{604, 310}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
......@@ -15118,7 +15125,6 @@ LCAuLi4</string>
<string>o_sidebar_scrollview</string>
<string>o_sidebar_view</string>
<string>o_split_view</string>
<string>o_video_view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -15151,7 +15157,6 @@ LCAuLi4</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
......@@ -15187,7 +15192,6 @@ LCAuLi4</string>
<string>o_sidebar_scrollview</string>
<string>o_sidebar_view</string>
<string>o_split_view</string>
<string>o_video_view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -15307,10 +15311,6 @@ LCAuLi4</string>
<string key="name">o_split_view</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">o_video_view</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
......@@ -15917,11 +15917,13 @@ LCAuLi4</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>o_controls_bar</string>
<string>o_titlebar_view</string>
<string>o_video_view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>VLCControlsBarCommon</string>
<string>id</string>
<string>VLCVoutView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
......@@ -15930,6 +15932,7 @@ LCAuLi4</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>o_controls_bar</string>
<string>o_titlebar_view</string>
<string>o_video_view</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -15941,6 +15944,10 @@ LCAuLi4</string>
<string key="name">o_titlebar_view</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">o_video_view</string>
<string key="candidateClassName">VLCVoutView</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="615738430">
......
......@@ -28,7 +28,10 @@
#import "CompatibilityFixes.h"
#import "PXSourceList.h"
#import "PXSourceListDataSource.h"
#import <vlc_input.h>
#import <vlc_vout_window.h>
#import "Windows.h"
#import "misc.h"
#import "fspanel.h"
......@@ -36,13 +39,13 @@
@class VLCDetachedVideoWindow;
@class VLCMainWindowControlsBar;
@class VLCVoutView;
@interface VLCMainWindow : VLCVideoWindowCommon <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate> {
IBOutlet id o_search_fld;
IBOutlet id o_playlist_table;
IBOutlet id o_video_view;
IBOutlet id o_split_view;
IBOutlet id o_left_split_view;
IBOutlet id o_right_split_view;
......@@ -104,7 +107,7 @@
VLCColorView * o_color_backdrop;
NSInteger i_originalLevel;
VLCWindow *o_extra_video_window;
VLCVideoWindowCommon *o_extra_video_window;
id o_current_video_window;
NSRect frameBeforePlayback;
......@@ -136,8 +139,7 @@
- (void)setPlay;
- (void)updateVolumeSlider;
- (id)videoView;
- (void)setupVideoView;
- (VLCVoutView *)setupVout:(vout_window_t *)p_wnd;
- (void)setVideoplayEnabled;
- (void)resizeWindow;
- (void)setNativeVideoSize:(NSSize)size;
......
......@@ -43,6 +43,7 @@
#import <vlc_aout_intf.h>
#import "ControlsBar.h"
#import "VideoView.h"
@interface VLCMainWindow ()
......@@ -142,6 +143,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
o_extra_video_window = nil;
}
if (o_detached_video_window) {
[o_detached_video_window release];
o_detached_video_window = nil;
}
[super dealloc];
}
......@@ -727,15 +733,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
#pragma mark -
#pragma mark Video Output handling
- (id)videoView
{
return o_video_view;
}
- (void)setupVideoView
- (VLCVoutView *)setupVout:(vout_window_t *)p_wnd
{
BOOL b_video_deco = var_InheritBool(VLCIntf, "video-deco");
BOOL b_video_wallpaper = var_InheritBool(VLCIntf, "video-wallpaper");
VLCVoutView *o_vout_view;
VLCVideoWindowCommon *o_new_video_window;
// TODO: make lion fullscreen compatible with video-wallpaper and !embedded-video
if ((b_video_wallpaper || !b_video_deco) && !b_nativeFullscreenMode) {
......@@ -769,17 +773,16 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_extra_video_window setBackgroundColor: [NSColor blackColor]];
[o_extra_video_window setCanBecomeKeyWindow: !b_video_wallpaper];
[o_extra_video_window setCanBecomeMainWindow: !b_video_wallpaper];
[o_extra_video_window setAcceptsMouseMovedEvents:!b_video_wallpaper];
[o_extra_video_window setAcceptsMouseMovedEvents: !b_video_wallpaper];
[o_extra_video_window setMovableByWindowBackground: !b_video_wallpaper];
[o_extra_video_window useOptimizedDrawing: YES];
[o_video_view retain];
if ([o_video_view superview] != NULL)
[o_video_view removeFromSuperviewWithoutNeedingDisplay];
window_rect.origin.x = window_rect.origin.y = 0;
[o_video_view setFrame: window_rect];
[[o_extra_video_window contentView] addSubview: o_video_view positioned:NSWindowAbove relativeTo:nil];
[o_video_view release];
o_vout_view = [[VLCVoutView alloc] initWithFrame:[[o_extra_video_window contentView] bounds]];
[o_vout_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[[o_extra_video_window contentView] addSubview:o_vout_view positioned:NSWindowAbove relativeTo:nil];
[o_extra_video_window setVideoView:o_vout_view];
o_new_video_window = o_extra_video_window;
if (b_video_wallpaper)
[o_extra_video_window orderBack:nil];
......@@ -792,20 +795,14 @@ static VLCMainWindow *_o_sharedInstance = nil;
b_nonembedded = YES;
} else {
if (var_InheritBool(VLCIntf, "embedded-video") || b_nativeFullscreenMode) {
if ([o_video_view window] != self) {
[o_video_view removeFromSuperviewWithoutNeedingDisplay];
[o_video_view setFrame: [o_split_view frame]];
[[self contentView] addSubview:o_video_view positioned:NSWindowAbove relativeTo:nil];
}
o_vout_view = [o_video_view retain];
o_new_video_window = self;
b_nonembedded = NO;
} else {
if ([o_video_view superview] != NULL)
[o_video_view removeFromSuperviewWithoutNeedingDisplay];
if (!o_detached_video_window) {
NSWindowController *o_controller = [[NSWindowController alloc] initWithWindowNibName:@"DetachedVideoWindow"];
[o_controller loadWindow];
o_detached_video_window = (VLCDetachedVideoWindow *)[o_controller window];
o_detached_video_window = [(VLCDetachedVideoWindow *)[o_controller window] retain];
[o_controller release];
// event occurs before window is created, so call again
......@@ -819,38 +816,31 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_detached_video_window setContentMinSize: NSMakeSize(363., f_min_video_height + [[[o_detached_video_window controlsBar] bottomBarView] frame].size.height)];
}
NSRect videoFrame;
videoFrame.size = [[o_detached_video_window contentView] frame].size;
videoFrame.size.height -= [[[o_detached_video_window controlsBar] bottomBarView] frame].size.height;
if (b_dark_interface)
videoFrame.size.height -= [o_titlebar_view frame].size.height;
videoFrame.origin.x = .0;
videoFrame.origin.y = [[[o_detached_video_window controlsBar] bottomBarView] frame].size.height;
[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_vout_view = [[o_detached_video_window videoView] retain];
o_new_video_window = o_detached_video_window;
b_nonembedded = YES;
}
}
if (!b_video_wallpaper) {
[[o_video_view window] makeKeyAndOrderFront: self];
[o_new_video_window makeKeyAndOrderFront: self];
vout_thread_t *p_vout = getVout();
if (p_vout) {
if (var_GetBool(p_vout, "video-on-top"))
[[o_video_view window] setLevel: NSStatusWindowLevel];
[o_new_video_window setLevel: NSStatusWindowLevel];
else
[[o_video_view window] setLevel: NSNormalWindowLevel];
[o_new_video_window setLevel: NSNormalWindowLevel];
vlc_object_release(p_vout);
}
}
[[o_video_view window] setAlphaValue: config_GetFloat(VLCIntf, "macosx-opaqueness")];
[o_new_video_window setAlphaValue: config_GetFloat(VLCIntf, "macosx-opaqueness")];
return [o_vout_view autorelease];
}
- (void)setVideoplayEnabled
......@@ -1886,8 +1876,15 @@ static VLCMainWindow *_o_sharedInstance = nil;
// native fs not supported with detached view yet
[o_titlebar_view setFullscreenButtonHidden: YES];
}
NSRect videoViewRect = [[self contentView] bounds];
if (b_dark_interface)
videoViewRect.size.height -= [o_titlebar_view frame].size.height;
CGFloat f_bottomBarHeight = [[[self controlsBar] bottomBarView] frame].size.height;
videoViewRect.size.height -= f_bottomBarHeight;
videoViewRect.origin.y = f_bottomBarHeight;
[o_video_view setFrame: videoViewRect];
}
@end
......@@ -55,12 +55,16 @@
[super dealloc];
}
- (void)awakeFromNib
-(id)initWithFrame:(NSRect)frameRect
{
[self registerForDraggedTypes:[NSArray arrayWithObject: NSFilenamesPboardType]];
if (self = [super initWithFrame:frameRect]) {
[self registerForDraggedTypes:[NSArray arrayWithObject: NSFilenamesPboardType]];
}
i_lastScrollWheelDirection = 0;
f_cumulated_magnification = 0.0;
return self;
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
......
......@@ -57,6 +57,7 @@
@end
@class VLCVoutView;
@class VLCControlsBarCommon;
/*****************************************************************************
......@@ -71,12 +72,15 @@
BOOL b_dark_interface;
IBOutlet id o_titlebar_view; // only set in main or detached window
IBOutlet VLCVoutView *o_video_view;
IBOutlet VLCControlsBarCommon* o_controls_bar;
IBOutlet VLCControlsBarCommon *o_controls_bar;
}
@property (nonatomic, assign) VLCVoutView* videoView;
@property (readonly) VLCControlsBarCommon* controlsBar;
- (void)setTitle:(NSString *)title;
@end
\ No newline at end of file
......@@ -219,6 +219,7 @@
@implementation VLCVideoWindowCommon
@synthesize videoView=o_video_view;
@synthesize controlsBar=o_controls_bar;
#pragma mark -
......
......@@ -34,6 +34,7 @@
#import <vlc_vout.h>
#import <vlc_aout.h>
#import <vlc_input.h>
#import <vlc_vout_window.h>
#import <Cocoa/Cocoa.h>
#import "CompatibilityFixes.h"
......@@ -157,7 +158,7 @@ struct intf_sys_t
- (id)playlist;
- (id)info;
- (id)wizard;
- (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height;
- (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height forWindow:(vout_window_t *)p_wnd;
- (void)setNativeVideoSize:(NSSize)size;
- (id)coreDialogProvider;
- (id)eyeTVController;
......
......@@ -41,7 +41,6 @@
#include <vlc_modules.h>
#include <vlc_plugin.h>
#include <vlc_aout_intf.h>
#include <vlc_vout_window.h>
#include <vlc_vout_display.h>
#include <unistd.h> /* execl() */
......@@ -142,7 +141,7 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
int i_y = cfg->y;
unsigned i_width = cfg->width;
unsigned i_height = cfg->height;
p_wnd->handle.nsobject = [[VLCMain sharedInstance] getVideoViewAtPositionX: &i_x Y: &i_y withWidth: &i_width andHeight: &i_height];
p_wnd->handle.nsobject = [[VLCMain sharedInstance] getVideoViewAtPositionX: &i_x Y: &i_y withWidth: &i_width andHeight: &i_height forWindow: p_wnd];
if (!p_wnd->handle.nsobject) {
msg_Err(p_wnd, "got no video view from the interface");
......@@ -1499,10 +1498,20 @@ static VLCMain *_o_sharedMainInstance = nil;
return o_wizard;
}
- (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height
- (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height forWindow:(vout_window_t *)p_wnd
{
[o_mainwindow performSelectorOnMainThread:@selector(setupVideoView) withObject:nil waitUntilDone:YES];
id videoView = [o_mainwindow videoView];
SEL sel = @selector(setupVout:);
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[o_mainwindow methodSignatureForSelector:sel]];
[inv setTarget:o_mainwindow];
[inv setSelector:sel];
[inv setArgument:&p_wnd atIndex:2]; // starting at 2!
[inv performSelectorOnMainThread:@selector(invoke) withObject:nil
waitUntilDone:YES];
VLCVoutView *videoView;
[inv getReturnValue:&videoView];
NSRect videoRect = [videoView frame];
int i_x = (int)videoRect.origin.x;
int i_y = (int)videoRect.origin.y;
......
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