Commit 6a3df3f8 authored by Daksh Shah's avatar Daksh Shah

undergoing work

parent d1e02ace
......@@ -93,6 +93,7 @@
1CFE8D591EA0D42A00E94451 /* VLCErrorWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CFE8D581EA0D42A00E94451 /* VLCErrorWindowController.m */; };
524D376B21106CCC008FEE22 /* VLCDraggablePanelView.m in Sources */ = {isa = PBXBuildFile; fileRef = 524D376A21106CCC008FEE22 /* VLCDraggablePanelView.m */; };
524D376E21149546008FEE22 /* VLCDraggablePanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = 524D376D21149546008FEE22 /* VLCDraggablePanelController.m */; };
529BE1402130140A0005F3A4 /* DPCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 529BE13F2130140A0005F3A4 /* DPCommon.m */; };
6B0292E61F43256300A50082 /* VLCBottomBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0292E51F43256300A50082 /* VLCBottomBarView.m */; };
6B0AB0F01F1AC8B3003A1B4E /* VLCSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0AB0ED1F1AC8B3003A1B4E /* VLCSlider.m */; };
6B0AB0F11F1AC8B3003A1B4E /* VLCSliderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0AB0EF1F1AC8B3003A1B4E /* VLCSliderCell.m */; };
......@@ -169,6 +170,8 @@
524D376A21106CCC008FEE22 /* VLCDraggablePanelView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCDraggablePanelView.m; sourceTree = "<group>"; };
524D376C21149546008FEE22 /* VLCDraggablePanelController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCDraggablePanelController.h; sourceTree = "<group>"; };
524D376D21149546008FEE22 /* VLCDraggablePanelController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCDraggablePanelController.m; sourceTree = "<group>"; };
529BE13E2130140A0005F3A4 /* DPCommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DPCommon.h; sourceTree = "<group>"; };
529BE13F2130140A0005F3A4 /* DPCommon.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DPCommon.m; sourceTree = "<group>"; };
5CCED71014C0D4A90057F8D1 /* VLCExtensionsDialogProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCExtensionsDialogProvider.h; sourceTree = "<group>"; };
5CCED71114C0D4A90057F8D1 /* VLCExtensionsDialogProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCExtensionsDialogProvider.m; sourceTree = "<group>"; };
5CCED71214C0D4A90057F8D1 /* VLCExtensionsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCExtensionsManager.h; sourceTree = "<group>"; };
......@@ -1050,6 +1053,8 @@
524D376A21106CCC008FEE22 /* VLCDraggablePanelView.m */,
524D376C21149546008FEE22 /* VLCDraggablePanelController.h */,
524D376D21149546008FEE22 /* VLCDraggablePanelController.m */,
529BE13E2130140A0005F3A4 /* DPCommon.h */,
529BE13F2130140A0005F3A4 /* DPCommon.m */,
);
name = "Fullscreen Controller";
sourceTree = "<group>";
......@@ -1544,6 +1549,7 @@
1CCC88FB2078A3D500E5626F /* Help.xib in Sources */,
1CCC88FC2078A3D500E5626F /* LogMessageWindow.xib in Sources */,
1CCC88FD2078A3D500E5626F /* Open.xib in Sources */,
529BE1402130140A0005F3A4 /* DPCommon.m in Sources */,
1CCC88FE2078A3D500E5626F /* PlaylistAccessoryView.xib in Sources */,
1CCC88FF2078A3D500E5626F /* PlaylistMenu.xib in Sources */,
1CCC89002078A3D500E5626F /* PopupPanel.xib in Sources */,
......
//
// DPCommon.h
// Pseudo-VLC
//
// Created by Daksh Shah on 24/08/18.
//
#import <Foundation/Foundation.h>
@interface DPCommon : NSObject
- (IBAction)play:(id)sender;
@end
//
// DPCommon.m
// Pseudo-VLC
//
// Created by Daksh Shah on 24/08/18.
//
#import "DPCommon.h"
#import "VLCCoreInteraction.h"
#import "CompatibilityFixes.h"
#import "VLCMain.h"
#import <vlc_aout.h>
@implementation DPCommon
- (IBAction)play:(id)sender {
[[VLCCoreInteraction sharedInstance] playOrPause];
}
//#pragma mark -
//#pragma mark Control Actions
//
//- (IBAction)togglePlayPause:(id)sender
//{
// [[VLCCoreInteraction sharedInstance] playOrPause];
//}
//
//- (IBAction)jumpForward:(id)sender
//{
// static NSTimeInterval last_event = 0;
// if (([NSDate timeIntervalSinceReferenceDate] - last_event) > 0.16) {
// /* We just skipped 4 "continuous" events, otherwise we are too fast */
// [[VLCCoreInteraction sharedInstance] forwardExtraShort];
// last_event = [NSDate timeIntervalSinceReferenceDate];
// }
//}
//
//- (IBAction)jumpBackward:(id)sender
//{
// static NSTimeInterval last_event = 0;
// if (([NSDate timeIntervalSinceReferenceDate] - last_event) > 0.16) {
// /* We just skipped 4 "continuous" events, otherwise we are too fast */
// [[VLCCoreInteraction sharedInstance] backwardExtraShort];
// last_event = [NSDate timeIntervalSinceReferenceDate];
// }
//}
//
//- (IBAction)gotoPrevious:(id)sender
//{
// [[VLCCoreInteraction sharedInstance] previous];
//}
//
//- (IBAction)gotoNext:(id)sender
//{
// [[VLCCoreInteraction sharedInstance] next];
//}
//
//- (IBAction)toggleFullscreen:(id)sender
//{
// [[VLCCoreInteraction sharedInstance] toggleFullscreen];
//}
//
//- (IBAction)timeSliderUpdate:(id)sender
//{
// switch([[NSApp currentEvent] type]) {
// case NSLeftMouseUp:
// /* Ignore mouse up, as this is a continuous slider and
// * when the user does a single click to a position on the slider,
// * the action is called twice, once for the mouse down and once
// * for the mouse up event. This results in two short seeks one
// * after another to the same position, which results in weird
// * audio quirks.
// */
// return;
// case NSLeftMouseDown:
// case NSLeftMouseDragged:
// break;
//
// default:
// return;
// }
// input_thread_t *p_input;
// p_input = pl_CurrentInput(getIntf());
//
// if (p_input) {
// vlc_value_t pos;
// pos.f_float = [_timeSlider floatValue] / 10000.;
// var_Set(p_input, "position", pos);
// vlc_object_release(p_input);
// }
// [[[VLCMain sharedInstance] mainWindow] updateTimeSlider];
//}
//
//- (IBAction)volumeSliderUpdate:(id)sender
//{
// [[VLCCoreInteraction sharedInstance] setVolume:[sender intValue]];
//}
//
//#pragma mark -
//#pragma mark Metadata and state updates
//
//- (void)setPlay
//{
// [_playPauseButton setState:NSOffState];
// [_playPauseButton setToolTip: _NS("Play")];
//}
//
//- (void)setPause
//{
// [_playPauseButton setState:NSOnState];
// [_playPauseButton setToolTip: _NS("Pause")];
//}
//
//- (void)setStreamTitle:(NSString *)title
//{
// [_mediaTitle setStringValue:title];
//}
//
//- (void)fixTitleBar
//{
// //Issue-3, the titleBar should be shown/hidden only for the respective window of FSPanel...
// _associatedVoutWindow.styleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask
// | NSMiniaturizableWindowMask;
// // [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
//}
//
//-(void)unFixTitleBar
//{
// _associatedVoutWindow.styleMask |= NSFullSizeContentViewWindowMask;
//}
//
//- (void)hideTitleBar
//{
// [[[[_associatedVoutWindow standardWindowButton:NSWindowCloseButton] superview] animator] setAlphaValue:0];
//}
//
//- (void)updatePositionAndTime
//{
// input_thread_t *p_input = pl_CurrentInput(getIntf());
//
// /* If nothing is playing, reset times and slider */
// if (!p_input) {
// [_timeSlider setFloatValue:0.0];
// [_elapsedTime setStringValue:@""];
// [_remainingOrTotalTime setHidden:YES];
// return;
// }
//
// vlc_value_t pos;
// char psz_time[MSTRTIME_MAX_SIZE];
//
// var_Get(p_input, "position", &pos);
// float f_updated = 10000. * pos.f_float;
// [_timeSlider setFloatValue:f_updated];
//
//
// int64_t t = var_GetInteger(p_input, "time");
// mtime_t dur = input_item_GetDuration(input_GetItem(p_input));
//
// /* Update total duration (right field) */
// if (dur <= 0) {
// [_remainingOrTotalTime setHidden:YES];
// } else {
// [_remainingOrTotalTime setHidden:NO];
//
// NSString *totalTime;
//
// if ([_remainingOrTotalTime timeRemaining]) {
// mtime_t remaining = 0;
// if (dur > t)
// remaining = dur - t;
// totalTime = [NSString stringWithFormat:@"-%s", secstotimestr(psz_time, (int)(remaining / CLOCK_FREQ))];
// } else {
// totalTime = toNSStr(secstotimestr(psz_time, (int)(dur / 1000000)));
// }
// [_remainingOrTotalTime setStringValue:totalTime];
// }
//
// /* Update current position (left field) */
// NSString *playbackPosition = toNSStr(secstotimestr(psz_time, (int)(t / CLOCK_FREQ)));
//
// [_elapsedTime setStringValue:playbackPosition];
// vlc_object_release(p_input);
//}
//
//- (void)setSeekable:(BOOL)seekable
//{
// [_timeSlider setEnabled:seekable];
// [_forwardButton setEnabled:seekable];
// [_backwardButton setEnabled:seekable];
//}
//
//- (void)setVolumeLevel:(int)value
//{
// [_volumeSlider setIntValue:value];
// [_volumeSlider setToolTip: [NSString stringWithFormat:_NS("Volume: %i %%"), (value*200)/AOUT_VOLUME_MAX]];
//}
@end
......@@ -99,7 +99,8 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/VLCVolumeSliderCell.h gui/macosx/VLCVolumeSliderCell.m \
gui/macosx/VLCWrappableTextField.h gui/macosx/VLCWrappableTextField.m \
gui/macosx/VLCDraggablePanelView.h gui/macosx/VLCDraggablePanelView.m \
gui/macosx/VLCDraggablePanelController.h gui/macosx/VLCDraggablePanelController.m
gui/macosx/VLCDraggablePanelController.h gui/macosx/VLCDraggablePanelController.m \
gui/macosx/DPCommon.h gui/macosx/DPCommon.m
# User interface compilation
......
......@@ -177,7 +177,7 @@
</constraints>
<sliderCell key="cell" controlSize="mini" continuous="YES" state="on" alignment="left" maxValue="100" doubleValue="50" tickMarkPosition="above" sliderType="linear" id="4kg-OP-fNv" customClass="VLCDefaultValueSliderCell"/>
<connections>
<action selector="volumeSliderUpdate:" target="-2" id="njx-yb-9F0"/>
<action selector="volumeSliderUpdate:" target="3fL-vQ-fZQ" id="mur-1N-RJX"/>
</connections>
</slider>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="zxC-jL-DOC" userLabel="Playback Buttons group">
......@@ -193,7 +193,7 @@
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="gotoPrevious:" target="-2" id="mCI-e0-K8a"/>
<action selector="gotoPrevious:" target="3fL-vQ-fZQ" id="gKh-Zz-ONt"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="hi7-6M-p0y" userLabel="Backward Button" customClass="VLCImageButton">
......@@ -206,7 +206,7 @@
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="jumpBackward:" target="-2" id="Ddm-Oa-T1O"/>
<action selector="jumpBackward:" target="3fL-vQ-fZQ" id="Yax-zo-ZWJ"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="sr2-da-moG" userLabel="Play Pause Button" customClass="VLCImageButton">
......@@ -222,7 +222,7 @@
<userDefinedRuntimeAttribute type="boolean" keyPath="toggle" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="togglePlayPause:" target="-2" id="9I2-xv-uFd"/>
<action selector="togglePlayPause:" target="3fL-vQ-fZQ" id="SCr-bz-6k1"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="jgn-bJ-CyD" userLabel="Forward Button" customClass="VLCImageButton">
......@@ -235,7 +235,7 @@
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="jumpForward:" target="-2" id="LN9-6b-tqm"/>
<action selector="jumpForward:" target="3fL-vQ-fZQ" id="Ogi-Yd-B5Z"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="cvk-HV-oxv" userLabel="Next Button" customClass="VLCImageButton">
......@@ -248,7 +248,7 @@
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="gotoNext:" target="-2" id="F5v-I4-hQp"/>
<action selector="gotoNext:" target="3fL-vQ-fZQ" id="IPr-ox-l50"/>
</connections>
</button>
</subviews>
......@@ -281,7 +281,7 @@
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="toggleFullscreen:" target="-2" id="iaz-UA-PnF"/>
<action selector="toggleFullscreen:" target="3fL-vQ-fZQ" id="Bpr-x3-zza"/>
</connections>
</button>
</subviews>
......@@ -343,7 +343,7 @@
</constraints>
<sliderCell key="cell" controlSize="small" continuous="YES" state="on" alignment="left" maxValue="10000" tickMarkPosition="above" sliderType="linear" id="nyT-Mk-q5A"/>
<connections>
<action selector="timeSliderUpdate:" target="-2" id="HPz-RF-stJ"/>
<action selector="timeSliderUpdate:" target="3fL-vQ-fZQ" id="DUX-AI-Vbx"/>
</connections>
</slider>
</subviews>
......@@ -407,6 +407,22 @@
<outlet property="timeSlider" destination="20" id="AFS-sq-vuw"/>
</connections>
</customObject>
<customObject id="3fL-vQ-fZQ" userLabel="DP Common waali object" customClass="VLCDraggablePanelController">
<connections>
<outlet property="backwardButton" destination="hi7-6M-p0y" id="D93-Cg-hYg"/>
<outlet property="controlsView" destination="hjO-mI-3wB" id="OH9-jm-Ktw"/>
<outlet property="elapsedTime" destination="I20-7J-nKn" id="fow-LS-rai"/>
<outlet property="forwardButton" destination="jgn-bJ-CyD" id="oBb-Dg-R5O"/>
<outlet property="fullscreenButton" destination="qpg-Nt-InG" id="PHQ-DG-aH3"/>
<outlet property="mediaTitle" destination="QSG-7h-uuB" id="h03-BK-puy"/>
<outlet property="nextButton" destination="cvk-HV-oxv" id="1MA-B8-FSf"/>
<outlet property="playPauseButton" destination="sr2-da-moG" id="bgo-aI-lah"/>
<outlet property="previousButton" destination="tlI-Jl-hVM" id="WIp-fL-rAZ"/>
<outlet property="remainingOrTotalTime" destination="fUw-IV-aIx" id="D6c-zf-BD2"/>
<outlet property="timeSlider" destination="nbQ-vJ-EPO" id="vpS-Y0-KKv"/>
<outlet property="volumeSlider" destination="oxl-sA-ALW" id="UnS-MC-x6w"/>
</connections>
</customObject>
</objects>
<resources>
<image name="VLCBackwardTemplate" width="128" height="128"/>
......
//
// VLCDraggablePanelController.h
// Pseudo-VLC
//
// Created by Daksh Shah on 03/08/18.
//
#import <Cocoa/Cocoa.h>
#import "VLCWindow.h"
#import "VLCDefaultValueSlider.h"
#import "VLCTimeField.h"
//#import <VLCDraggablePanelView.h>
@interface VLCDraggablePanelController : NSWindowController
@interface VLCDraggablePanelController : NSObject
@property (readwrite, weak) NSTimer *hideTimer;
......@@ -47,9 +40,6 @@
- (void)setVoutWasUpdated:(VLCWindow *)voutWindow;
- (void)centerPanel; //Have to find a better alternative than to centering each time on resize/drag
- (void)fixTitleBar;
- (void)unFixTitleBar;
- (void)setSeekable:(BOOL)seekable;
- (void)setVolumeLevel:(int)value;
- (void)updatePositionAndTime;
......
......@@ -34,35 +34,6 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
}
#pragma mark -
#pragma mark Initialization
- (id)init
{
self = [super initWithWindowNibName:@"VLCDraggablePanel"];
if (self) {
NSString *rectStr = [[NSUserDefaults standardUserDefaults] stringForKey:kAssociatedFullscreenRect];
_associatedVoutFrame = NSRectFromString(rectStr);
}
return self;
}
- (void)windowDidLoad {
[super windowDidLoad];
// [self setMaskImage:[self maskImageWithBounds:self.window.contentView.bounds]];
// [self setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
// [self setMaterial:NSVisualEffectMaterialDark];
// [self setState:NSVisualEffectStateActive];
// [self setAutoresizesSubviews:YES];
// [self.window setStyleMask:self.window.styleMask | NSResizableWindowMask];
/* Inject correct background view depending on OS support */
// [self injectVisualEffectView];
}
#define setupButton(target, title, desc) \
target.accessibilityTitle = title; \
target.accessibilityLabel = desc; \
......@@ -115,7 +86,6 @@ target.accessibilityLabel = desc; \
- (IBAction)togglePlayPause:(id)sender
{
NSLog(@"Hey there PLAY PAUSE");
[[VLCCoreInteraction sharedInstance] playOrPause];
}
......@@ -141,7 +111,6 @@ target.accessibilityLabel = desc; \
- (IBAction)gotoPrevious:(id)sender
{
NSLog(@"Hey there gotoPrevious");
[[VLCCoreInteraction sharedInstance] previous];
}
......@@ -152,7 +121,8 @@ target.accessibilityLabel = desc; \
- (IBAction)toggleFullscreen:(id)sender
{
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
[self fadeOut];
// [[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
- (IBAction)timeSliderUpdate:(id)sender
......@@ -211,25 +181,6 @@ target.accessibilityLabel = desc; \
[_mediaTitle setStringValue:title];
}
- (void)fixTitleBar
{
//Issue-3, the titleBar should be shown/hidden only for the respective window of FSPanel...
_associatedVoutWindow.styleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask
| NSMiniaturizableWindowMask;
// [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
}
-(void)unFixTitleBar
{
_associatedVoutWindow.styleMask |= NSFullSizeContentViewWindowMask;
}
- (void)hideTitleBar
{
[[[[_associatedVoutWindow standardWindowButton:NSWindowCloseButton] superview] animator] setAlphaValue:0];
}
- (void)updatePositionAndTime
{
input_thread_t *p_input = pl_CurrentInput(getIntf());
......@@ -302,7 +253,7 @@ target.accessibilityLabel = desc; \
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:0.4f];
[[self.window animator] setAlphaValue:1.0f];
[[_controlsView animator] setAlphaValue:1.0f];
[NSAnimationContext endGrouping];
[self startAutohideTimer];
......@@ -312,55 +263,55 @@ target.accessibilityLabel = desc; \
{
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:0.4f];
[[self.window animator] setAlphaValue:0.0f];
[[_controlsView animator] setAlphaValue:0.0f];
[NSAnimationContext endGrouping];
}
- (void)centerPanel
{
NSRect windowFrame = [self.window frame];
/* Calculate coordinates for centered position */
NSRect limitFrame = _associatedVoutWindow.frame;
windowFrame.origin.x = (limitFrame.size.width - windowFrame.size.width) / 2 + limitFrame.origin.x;
windowFrame.origin.y = (limitFrame.size.height / 5) - windowFrame.size.height + limitFrame.origin.y;
windowFrame = [self contrainFrameToAssociatedVoutWindow:windowFrame];
[self.window setFrame:windowFrame display:YES animate:NO];
}
- (NSRect)contrainFrameToAssociatedVoutWindow:(NSRect)frame
{
NSRect limitFrame = _associatedVoutWindow.frame;
// Limit rect to limitation view
if (frame.origin.x < limitFrame.origin.x)
frame.origin.x = limitFrame.origin.x;
if (frame.origin.y < limitFrame.origin.y)
frame.origin.y = limitFrame.origin.y;
// Limit size (could be needed after resolution changes)
if (frame.size.height > limitFrame.size.height)
frame.size.height = limitFrame.size.height;
if (frame.size.width > limitFrame.size.width)
frame.size.width = limitFrame.size.width;
if (frame.origin.x + frame.size.width > limitFrame.origin.x + limitFrame.size.width)
frame.origin.x = limitFrame.origin.x + limitFrame.size.width - frame.size.width;
if (frame.origin.y + frame.size.height > limitFrame.origin.y + limitFrame.size.height)
frame.origin.y = limitFrame.origin.y + limitFrame.size.height - frame.size.height;
return frame;
}
- (void)setNonActive
{
[self.window orderOut:self];
}
//
//- (void)centerPanel
//{
// NSRect windowFrame = [self.window frame];
//
// /* Calculate coordinates for centered position */
// NSRect limitFrame = _associatedVoutWindow.frame;
// windowFrame.origin.x = (limitFrame.size.width - windowFrame.size.width) / 2 + limitFrame.origin.x;
// windowFrame.origin.y = (limitFrame.size.height / 5) - windowFrame.size.height + limitFrame.origin.y;
//
// windowFrame = [self contrainFrameToAssociatedVoutWindow:windowFrame];
// [self.window setFrame:windowFrame display:YES animate:NO];
//}
//
//- (NSRect)contrainFrameToAssociatedVoutWindow:(NSRect)frame
//{
// NSRect limitFrame = _associatedVoutWindow.frame;
//
// // Limit rect to limitation view
// if (frame.origin.x < limitFrame.origin.x)
// frame.origin.x = limitFrame.origin.x;
// if (frame.origin.y < limitFrame.origin.y)
// frame.origin.y = limitFrame.origin.y;
//
// // Limit size (could be needed after resolution changes)
// if (frame.size.height > limitFrame.size.height)
// frame.size.height = limitFrame.size.height;
// if (frame.size.width > limitFrame.size.width)
// frame.size.width = limitFrame.size.width;
//
// if (frame.origin.x + frame.size.width > limitFrame.origin.x + limitFrame.size.width)
// frame.origin.x = limitFrame.origin.x + limitFrame.size.width - frame.size.width;
// if (frame.origin.y + frame.size.height > limitFrame.origin.y + limitFrame.size.height)
// frame.origin.y = limitFrame.origin.y + limitFrame.size.height - frame.size.height;
//
// return frame;
//}
//
//- (void)setNonActive
//{
// [self.window orderOut:self];
//}
//
- (void)setActive
{
[self.window orderFront:self];
// [self.window orderFront:self];
[self fadeIn];
}
......@@ -371,21 +322,21 @@ target.accessibilityLabel = desc; \
{
[NSCursor setHiddenUntilMouseMoves:YES];
}
- (void)setVoutWasUpdated:(VLCWindow *)voutWindow
{
_associatedVoutWindow = voutWindow;
NSRect voutRect = voutWindow.frame;
if (!NSEqualRects(_associatedVoutFrame, voutRect)) {
_associatedVoutFrame = voutRect;
[[NSUserDefaults standardUserDefaults] setObject:NSStringFromRect(_associatedVoutFrame) forKey:kAssociatedFullscreenRect];
[self centerPanel];
}
}
//
//- (void)setVoutWasUpdated:(VLCWindow *)voutWindow
//{
// _associatedVoutWindow = voutWindow;
//
// NSRect voutRect = voutWindow.frame;
// if (!NSEqualRects(_associatedVoutFrame, voutRect)) {
// _associatedVoutFrame = voutRect;
// [[NSUserDefaults standardUserDefaults] setObject:NSStringFromRect(_associatedVoutFrame) forKey:kAssociatedFullscreenRect];
//
// [self centerPanel];
// }
//
//}
//
#pragma mark -
#pragma mark Autohide timer management
......@@ -414,74 +365,71 @@ target.accessibilityLabel = desc; \
- (void)autohideCallback:(NSTimer *)timer
{
if (!NSMouseInRect([NSEvent mouseLocation], [self.window frame], NO)) {
if (!NSMouseInRect([NSEvent mouseLocation], [_controlsView frame], NO)) {
[self fadeOut];
[self hideMouse];
[[[VLCMain sharedInstance] voutProvider] updateDraggablePanelsUsingBlock:^(VLCFSPanelController *draggablepanel) {
}];
}
_isCounting = NO;
}
#pragma mark -
#pragma mark Helpers
/**
Create an image mask for the NSVisualEffectView
with rounded corners in the given rect
This is necessary as clipping the VisualEffectView using the layers
rounded corners is not possible when using the NSColor clearColor
as background color.
\note The returned image will have the necessary \c capInsets and
\c capResizingMode set.
\param bounds The rect for the image size
*/
- (NSImage *)maskImageWithBounds:(NSRect)bounds
{
static const float radius = 8.0;
NSImage *img = [NSImage imageWithSize:bounds.size flipped:YES drawingHandler:^BOOL(NSRect dstRect) {
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:bounds xRadius:radius yRadius:radius];
[[NSColor blackColor] setFill];
[path fill];
return YES;
}];
[img setCapInsets:NSEdgeInsetsMake(radius, radius, radius, radius)];
[img setResizingMode:NSImageResizingModeStretch];
return img;
}
/**
Injects the visual effect view in the Windows view hierarchy
This is necessary as we can't use the NSVisualEffect view on
all macOS Versions and therefore need to dynamically insert it.
*/
- (void)injectVisualEffectView
{
/* Setup the view */
NSVisualEffectView *view = [[NSVisualEffectView alloc] initWithFrame:self.window.contentView.frame];
[view setMaskImage:[self maskImageWithBounds:self.window.contentView.bounds]];
[view setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
[view setMaterial:NSVisualEffectMaterialDark];
[view setState:NSVisualEffectStateActive];
[view setAutoresizesSubviews:YES];
/* Inject view in view hierarchy */
[self.window setContentView:view];
[_controlsView setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
[self.window.contentView addSubview:_controlsView];
}
- (void)dealloc
{
[self stopAutohideTimer];
}
//
//#pragma mark -
//#pragma mark Helpers
//
//
///**
// Create an image mask for the NSVisualEffectView
// with rounded corners in the given rect
//
// This is necessary as clipping the VisualEffectView using the layers
// rounded corners is not possible when using the NSColor clearColor
// as background color.
//
// \note The returned image will have the necessary \c capInsets and
// \c capResizingMode set.
//
// \param bounds The rect for the image size
// */
//- (NSImage *)maskImageWithBounds:(NSRect)bounds
//{
// static const float radius = 8.0;
// NSImage *img = [NSImage imageWithSize:bounds.size flipped:YES drawingHandler:^BOOL(NSRect dstRect) {
// NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:bounds xRadius:radius yRadius:radius];
// [[NSColor blackColor] setFill];
// [path fill];
// return YES;
// }];
// [img setCapInsets:NSEdgeInsetsMake(radius, radius, radius, radius)];
// [img setResizingMode:NSImageResizingModeStretch];
// return img;
//}