Commit de233f99 authored by David Fuhrmann's avatar David Fuhrmann Committed by Felix Paul Kühne

macosx: allow a smaller min-height when video is playing and currently visible...

macosx: allow a smaller min-height when video is playing and currently visible in order to get more exact zoom behaviour
(cherry picked from commit 884199d83044b4ce5b0a4c4ebb8896ae23cf4d96)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent db625849
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
#import <vlc_aout_intf.h> #import <vlc_aout_intf.h>
@implementation VLCMainWindow @implementation VLCMainWindow
static const float f_min_video_height = 70.0;
static VLCMainWindow *_o_sharedInstance = nil; static VLCMainWindow *_o_sharedInstance = nil;
+ (VLCMainWindow *)sharedInstance + (VLCMainWindow *)sharedInstance
...@@ -272,16 +274,27 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -272,16 +274,27 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_volume_up_btn setEnabled: b_mute]; [o_volume_up_btn setEnabled: b_mute];
/* interface builder action */ /* interface builder action */
if ([self frame].size.height < 100) float f_threshold_height = f_min_video_height + [o_bottombar_view frame].size.height;
if( b_dark_interface )
f_threshold_height += [o_titlebar_view frame].size.height;
if( [[self contentView] frame].size.height < f_threshold_height )
b_splitviewShouldBeHidden = YES; b_splitviewShouldBeHidden = YES;
[self setDelegate: self]; [self setDelegate: self];
[self setExcludedFromWindowsMenu: YES]; [self setExcludedFromWindowsMenu: YES];
[self setAcceptsMouseMovedEvents: YES]; [self setAcceptsMouseMovedEvents: YES];
// Set that here as IB seems to be buggy // Set that here as IB seems to be buggy
if (b_dark_interface) if (b_dark_interface)
[self setContentMinSize:NSMakeSize(604., (288. + [o_titlebar_view frame].size.height))]; {
[self setContentMinSize:NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
[o_detached_video_window setContentMinSize: NSMakeSize( 363., f_min_video_height + [o_detached_bottombar_view frame].size.height + [o_detached_titlebar_view frame].size.height )];
}
else else
{
[self setContentMinSize:NSMakeSize(604., 288.)]; [self setContentMinSize:NSMakeSize(604., 288.)];
[o_detached_video_window setContentMinSize: NSMakeSize( 363., f_min_video_height + [o_detached_bottombar_view frame].size.height )];
}
[self setTitle: _NS("VLC media player")]; [self setTitle: _NS("VLC media player")];
[o_time_fld setAlignment: NSCenterTextAlignment]; [o_time_fld setAlignment: NSCenterTextAlignment];
[o_time_fld setNeedsDisplay:YES]; [o_time_fld setNeedsDisplay:YES];
...@@ -549,8 +562,8 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -549,8 +562,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_split_view setAutosaveName:@"10thanniversary-splitview"]; [o_split_view setAutosaveName:@"10thanniversary-splitview"];
if (b_splitviewShouldBeHidden) if (b_splitviewShouldBeHidden)
{ {
i_lastSplitViewHeight = [o_split_view frame].size.height;
[self hideSplitView]; [self hideSplitView];
i_lastSplitViewHeight = 300;
} }
} }
...@@ -660,6 +673,42 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -660,6 +673,42 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[o_dropzone_box animator] setFrame: plrect]; [[o_dropzone_box animator] setFrame: plrect];
} }
- (void)makeSplitViewVisible
{
if( b_dark_interface )
[self setContentMinSize: NSMakeSize( 604., 288. + [o_titlebar_view frame].size.height )];
else
[self setContentMinSize: NSMakeSize( 604., 288. )];
NSRect old_frame = [self frame];
float newHeight = [self minSize].height;
if( old_frame.size.height < newHeight )
{
NSRect new_frame = old_frame;
new_frame.origin.y = old_frame.origin.y + old_frame.size.height - newHeight;
new_frame.size.height = newHeight;
[[self animator] setFrame: new_frame display: YES animate: YES];
}
[o_video_view setHidden: YES];
[o_split_view setHidden: NO];
[self makeFirstResponder: nil];
}
- (void)makeSplitViewHidden
{
if( b_dark_interface )
[self setContentMinSize: NSMakeSize( 604., f_min_video_height + [o_titlebar_view frame].size.height )];
else
[self setContentMinSize: NSMakeSize( 604., f_min_video_height )];
[o_split_view setHidden: YES];
[o_video_view setHidden: NO];
[self makeFirstResponder: o_video_view];
}
- (IBAction)togglePlaylist:(id)sender - (IBAction)togglePlaylist:(id)sender
{ {
if (![self isVisible] && sender != nil) if (![self isVisible] && sender != nil)
...@@ -703,17 +752,10 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -703,17 +752,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
if (!b_nonembedded) if (!b_nonembedded)
{ {
if (([o_video_view isHidden] && b_activeVideo) || b_restored ) { if (([o_video_view isHidden] && b_activeVideo) || b_restored )
[o_split_view setHidden: YES]; [self makeSplitViewHidden];
[o_video_view setHidden: NO];
[self makeFirstResponder: o_video_view];
}
else else
{ [self makeSplitViewVisible];
[o_video_view setHidden: YES];
[o_split_view setHidden: NO];
[self makeFirstResponder: nil];
}
} }
else else
{ {
...@@ -1128,8 +1170,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1128,8 +1170,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self setContentMinSize: NSMakeSize( 604., [o_bottombar_view frame].size.height )]; [self setContentMinSize: NSMakeSize( 604., [o_bottombar_view frame].size.height )];
[self setContentMaxSize: NSMakeSize( FLT_MAX, [o_bottombar_view frame].size.height )]; [self setContentMaxSize: NSMakeSize( FLT_MAX, [o_bottombar_view frame].size.height )];
} }
if (i_lastSplitViewHeight < 100)
i_lastSplitViewHeight = 300; // random reasonable size
b_splitview_removed = YES; b_splitview_removed = YES;
} }
...@@ -1514,8 +1555,8 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1514,8 +1555,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
unsigned int i_height = nativeVideoSize.height; unsigned int i_height = nativeVideoSize.height;
if (i_width < windowMinSize.width) if (i_width < windowMinSize.width)
i_width = windowMinSize.width; i_width = windowMinSize.width;
if (i_height < windowMinSize.height) if (i_height < f_min_video_height)
i_height = windowMinSize.height; i_height = f_min_video_height;
/* Calculate the window's new size */ /* Calculate the window's new size */
NSRect new_frame; NSRect new_frame;
......
...@@ -392,8 +392,8 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -392,8 +392,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
vout_display_cfg_t cfg_tmp = *cfg; vout_display_cfg_t cfg_tmp = *cfg;
if (cfg_tmp.display.width < windowMinSize.width) if (cfg_tmp.display.width < windowMinSize.width)
cfg_tmp.display.width = windowMinSize.width; cfg_tmp.display.width = windowMinSize.width;
if (cfg_tmp.display.height < windowMinSize.height) if (cfg_tmp.display.height < 70)
cfg_tmp.display.height = windowMinSize.height; cfg_tmp.display.height = 70;
NSRect bounds = [sys->glView bounds]; NSRect bounds = [sys->glView bounds];
if (!config_GetInt(vd, "macosx-video-autoresize")) if (!config_GetInt(vd, "macosx-video-autoresize"))
......
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