Commit 4777cf0d authored by Daksh Shah's avatar Daksh Shah

draggablePanel for multiple Vout Windows

parent f287ebb1
...@@ -63,11 +63,10 @@ ...@@ -63,11 +63,10 @@
- (void)setActive; - (void)setActive;
- (void)setNonActive; - (void)setNonActive;
- (void)setVoutWasUpdated:(VLCWindow *)voutWindow; - (void)setVoutWasUpdated:(VLCWindow *)voutWindow;
- (void)centerPanel; //Have to find a better alternative than to centering each time on resize/drag
- (void)fixTitleBar; - (void)fixTitleBar;
- (void)unFixTitleBar; - (void)unFixTitleBar;
- (void)showTitleBar;
- (void)hideTitleBar;
- (void)setSeekable:(BOOL)seekable; - (void)setSeekable:(BOOL)seekable;
- (void)setVolumeLevel:(int)value; - (void)setVolumeLevel:(int)value;
......
...@@ -238,7 +238,7 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect ...@@ -238,7 +238,7 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
//Issue-3, the titleBar should be shown/hidden only for the respective window of FSPanel... //Issue-3, the titleBar should be shown/hidden only for the respective window of FSPanel...
_associatedVoutWindow.styleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask _associatedVoutWindow.styleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask
| NSMiniaturizableWindowMask; | NSMiniaturizableWindowMask;
[self showTitleBar]; // [self showTitleBar];
//[_associatedVoutWindow showControlsBar]; //It apparently does not have showControlsBar, because it is a NSWindow... would have to figure out a way to hide/show it //[_associatedVoutWindow showControlsBar]; //It apparently does not have showControlsBar, because it is a NSWindow... would have to figure out a way to hide/show it
} }
...@@ -247,12 +247,6 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect ...@@ -247,12 +247,6 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
_associatedVoutWindow.styleMask |= NSFullSizeContentViewWindowMask; _associatedVoutWindow.styleMask |= NSFullSizeContentViewWindowMask;
} }
- (void)showTitleBar
{
[[[[_associatedVoutWindow standardWindowButton:NSWindowCloseButton] superview] animator] setAlphaValue:1];
}
- (void)hideTitleBar - (void)hideTitleBar
{ {
[[[[_associatedVoutWindow standardWindowButton:NSWindowCloseButton] superview] animator] setAlphaValue:0]; [[[[_associatedVoutWindow standardWindowButton:NSWindowCloseButton] superview] animator] setAlphaValue:0];
...@@ -446,7 +440,7 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect ...@@ -446,7 +440,7 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
[self fadeOut]; [self fadeOut];
[self hideMouse]; [self hideMouse];
//Issue-3 //Issue-3 //maybe not the right way to go about it. Why hide titleBars for all vout windows? and maybe this should not be a part of draggablepanel at all
[[[VLCMain sharedInstance] voutProvider] updateDraggablePanelsUsingBlock:^(VLCFSPanelController *draggablepanel) { [[[VLCMain sharedInstance] voutProvider] updateDraggablePanelsUsingBlock:^(VLCFSPanelController *draggablepanel) {
[draggablepanel hideTitleBar]; [draggablepanel hideTitleBar];
}]; }];
......
...@@ -34,10 +34,12 @@ ...@@ -34,10 +34,12 @@
- (void)mouseDown:(NSEvent *)event - (void)mouseDown:(NSEvent *)event
{ {
NSLog(@"mouseDown"); //Debug-Statement
NSWindow *window = [self window]; NSWindow *window = [self window];
NSRect mouseLocationInWindow = {[event locationInWindow], {0,0}}; NSRect mouseLocationInWindow = {[event locationInWindow], {0,0}};
NSPoint originalMouseLocation = [window convertRectToScreen:mouseLocationInWindow].origin; NSPoint originalMouseLocation = [window convertRectToScreen:mouseLocationInWindow].origin;
NSRect originalFrame = [window frame]; NSRect originalFrame = [window frame];
NSLog(@"%f",originalFrame.origin.x); //Debug-Statement
while (YES) while (YES)
{ {
......
This diff is collapsed.
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#import <vlc_vout_window.h> #import <vlc_vout_window.h>
#import "VLCKeyboardBacklightControl.h" #import "VLCKeyboardBacklightControl.h"
#import "VLCFSPanelController.h"
@class VLCControlsBarCommon; @class VLCControlsBarCommon;
@class VLCVideoWindowCommon; @class VLCVideoWindowCommon;
...@@ -42,6 +43,7 @@ ...@@ -42,6 +43,7 @@
- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd withAnimation:(BOOL)b_animation; - (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd withAnimation:(BOOL)b_animation;
- (void)updateControlsBarsUsingBlock:(void (^)(VLCControlsBarCommon *controlsBar))block; - (void)updateControlsBarsUsingBlock:(void (^)(VLCControlsBarCommon *controlsBar))block;
- (void)updateDraggablePanelsUsingBlock: (void (^)(VLCFSPanelController *draggablepanel))block;
- (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater; - (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater;
- (void)updateWindowLevelForHelperWindows:(NSInteger)i_level; - (void)updateWindowLevelForHelperWindows:(NSInteger)i_level;
......
...@@ -368,6 +368,9 @@ void WindowClose(vout_window_t *p_wnd) ...@@ -368,6 +368,9 @@ void WindowClose(vout_window_t *p_wnd)
[voutView setVoutThread:(vout_thread_t *)p_wnd->obj.parent]; [voutView setVoutThread:(vout_thread_t *)p_wnd->obj.parent];
[newVideoWindow setHasActiveVideo: YES]; [newVideoWindow setHasActiveVideo: YES];
// newVideoWindow.styleMask |= NSFullSizeContentViewWindowMask;//would this be the right place for it? //Issue-3
[newVideoWindow hideControlsBar];
[voutWindows setObject:newVideoWindow forKey:[NSValue valueWithPointer:p_wnd]]; [voutWindows setObject:newVideoWindow forKey:[NSValue valueWithPointer:p_wnd]];
[[VLCMain sharedInstance] setActiveVideoPlayback: YES]; [[VLCMain sharedInstance] setActiveVideoPlayback: YES];
...@@ -560,6 +563,18 @@ void WindowClose(vout_window_t *p_wnd) ...@@ -560,6 +563,18 @@ void WindowClose(vout_window_t *p_wnd)
}]; }];
} }
- (void)updateDraggablePanelsUsingBlock: (void (^)(VLCFSPanelController *draggablepanel))block
{
[voutWindows enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
if ([obj respondsToSelector:@selector(draggablepanel)]) {
VLCFSPanelController *o_draggablepanel = [obj draggablepanel];
if (o_draggablepanel && block)
block(o_draggablepanel);
}
}];
}
- (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater - (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater
{ {
[voutWindows enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { [voutWindows enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import "VLCWindow.h" #import "VLCWindow.h"
#import "VLCFSPanelController.h"
@class VLCVoutView; @class VLCVoutView;
...@@ -47,6 +48,7 @@ static const float f_min_video_height = 70.0; ...@@ -47,6 +48,7 @@ static const float f_min_video_height = 70.0;
@property (readonly) BOOL windowShouldExitFullscreenWhenFinished; @property (readonly) BOOL windowShouldExitFullscreenWhenFinished;
@property (readwrite, assign) NSRect previousSavedFrame; @property (readwrite, assign) NSRect previousSavedFrame;
@property (nonatomic, readwrite, assign) NSSize nativeVideoSize; @property (nonatomic, readwrite, assign) NSSize nativeVideoSize;
@property (readonly) VLCFSPanelController* draggablepanel;
- (void)setWindowLevel:(NSInteger)i_state; - (void)setWindowLevel:(NSInteger)i_state;
- (void)resizeWindow; - (void)resizeWindow;
......
...@@ -80,6 +80,12 @@ ...@@ -80,6 +80,12 @@
- (void)awakeFromNib - (void)awakeFromNib
{ {
_draggablepanel = [[VLCFSPanelController alloc] init];
[_draggablepanel showWindow:self];
[[self draggablepanel] setVoutWasUpdated:self];
// [self.draggablepanel setActive]; //doubtful
NSLog(@"AWAKEFROMNIB in VLCVideoWindowCommon"); //Debug-Statement
BOOL b_nativeFullscreenMode = var_InheritBool(getIntf(), "macosx-nativefullscreenmode"); BOOL b_nativeFullscreenMode = var_InheritBool(getIntf(), "macosx-nativefullscreenmode");
if (b_nativeFullscreenMode) { if (b_nativeFullscreenMode) {
...@@ -377,17 +383,22 @@ ...@@ -377,17 +383,22 @@
[super becomeKeyWindow]; [super becomeKeyWindow];
// change fspanel state for the case when multiple windows are in fullscreen // change fspanel state for the case when multiple windows are in fullscreen
if ([self hasActiveVideo] && [self fullscreen]) //I am not sure what this means... earlier there was just one fspanel...
[[[[VLCMain sharedInstance] mainWindow] fspanel] setActive];
else //removing it for now, as it is creating an error: when video is played in a separate Vout window then the controller on ML/Playlist window becomes active when the Vout window becomes keyWindow
[[[[VLCMain sharedInstance] mainWindow] fspanel] setNonActive]; // NSLog(@"becomeKeyWindow and activeVideo %hhd", [self hasActiveVideo]);
// if ([self hasActiveVideo])
// [[[[VLCMain sharedInstance] mainWindow] draggablepanel] setActive];
// else
// [[[[VLCMain sharedInstance] mainWindow] draggablepanel] setNonActive];
} }
- (void)resignKeyWindow - (void)resignKeyWindow
{ {
[super resignKeyWindow]; [super resignKeyWindow];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setNonActive]; //This file is for all the video windows right? Then how do I know whether mainWindow has resigned as KeyWindow or is it some other vout window? because, I will have to set Not Active that particular window's draggablepanel. Right?
[[[[VLCMain sharedInstance] mainWindow] draggablepanel] setNonActive];
} }
-(NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow *)window -(NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow *)window
...@@ -472,11 +483,12 @@ ...@@ -472,11 +483,12 @@
[self setFullscreen: YES]; [self setFullscreen: YES];
_inFullscreenTransition = NO; _inFullscreenTransition = NO;
if ([self hasActiveVideo]) { //Would I need to do something here? #check
[[[[VLCMain sharedInstance] mainWindow] fspanel] setVoutWasUpdated:self]; // if ([self hasActiveVideo]) {
if (![_videoView isHidden]) // [[[[VLCMain sharedInstance] mainWindow] fspanel] setVoutWasUpdated:self];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setActive]; // if (![_videoView isHidden])
} // [[[[VLCMain sharedInstance] mainWindow] fspanel] setActive];
// }
NSArray *subviews = [[self videoView] subviews]; NSArray *subviews = [[self videoView] subviews];
NSUInteger count = [subviews count]; NSUInteger count = [subviews count];
...@@ -503,7 +515,6 @@ ...@@ -503,7 +515,6 @@
} }
[NSCursor setHiddenUntilMouseMoves: NO]; [NSCursor setHiddenUntilMouseMoves: NO];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setNonActive];
if (![_videoView isHidden]) { if (![_videoView isHidden]) {
[self showControlsBar]; [self showControlsBar];
...@@ -684,9 +695,7 @@ ...@@ -684,9 +695,7 @@
[o_fullscreen_window makeKeyWindow]; [o_fullscreen_window makeKeyWindow];
[o_fullscreen_window setAcceptsMouseMovedEvents: YES]; [o_fullscreen_window setAcceptsMouseMovedEvents: YES];
/* tell the fspanel to move itself to front next time it's triggered */ [[[[VLCMain sharedInstance] mainWindow] draggablepanel] setVoutWasUpdated:o_fullscreen_window]; //fix
[[[[VLCMain sharedInstance] mainWindow] fspanel] setVoutWasUpdated:o_fullscreen_window];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setActive];
if ([self isVisible]) if ([self isVisible])
[self orderOut: self]; [self orderOut: self];
...@@ -715,7 +724,6 @@ ...@@ -715,7 +724,6 @@
return; return;
} }
[[[[VLCMain sharedInstance] mainWindow] fspanel] setNonActive];
[[o_fullscreen_window screen] setNonFullscreenPresentationOptions]; [[o_fullscreen_window screen] setNonFullscreenPresentationOptions];
if (o_fullscreen_anim1) { if (o_fullscreen_anim1) {
......
...@@ -229,19 +229,11 @@ ...@@ -229,19 +229,11 @@
{ {
NSPoint ml = [self convertPoint: [o_event locationInWindow] fromView: nil]; NSPoint ml = [self convertPoint: [o_event locationInWindow] fromView: nil];
if ([self mouse: ml inRect: [self bounds]]){ if ([self mouse: ml inRect: [self bounds]]){
//NSLog(@"VLCVoutView mouseMoved");//Debug-Statement // NSLog(@"VLCVoutView mouseMoved");//Debug-Statement
//It is triggered only in the Video Playing windows, not Playlist view, which is perfect //It is triggered only in the Video Playing windows, not Playlist view, which is perfect
//Issue-3 [[[[((VLCVideoWindowCommon*)self.window) standardWindowButton:NSWindowCloseButton] superview] animator] setAlphaValue:1]; //Issue-3
// [[[[[[VLCMain sharedInstance] mainWindow] standardWindowButton:NSWindowCloseButton] superview] animator] setAlphaValue:1]; [[((VLCVideoWindowCommon*)self.window) draggablepanel] setActive];
[[[VLCMain sharedInstance] voutProvider] updateDraggablePanelsUsingBlock:^(VLCFSPanelController *draggablepanel) {
[draggablepanel showTitleBar];
}];
//[[VLCMain sharedInstance] mainWindow].titlebarAppearsTransparent = false;//<seems unneccesary
[[VLCMain sharedInstance] showFullscreenController];
} }
[super mouseMoved: o_event]; [super mouseMoved: o_event];
......
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