Commit cba98710 authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by Jean-Baptiste Kempf

macosx: added 2 options: 'macosx-pause-minimized' and 'macosx-video-autoresize' (fixes #5861)

(cherry picked from commit 2d83cb8bef1a1d4ab8b6c81a7724a838d59d80a2)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent eafcec0a
...@@ -764,9 +764,12 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -764,9 +764,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
if (b_dark_interface) if (b_dark_interface)
{ {
[self miniaturize: sender]; [self miniaturize: sender];
if (config_GetInt( VLCIntf, "macosx-pause-minimized" ))
{
if ([[VLCMain sharedInstance] activeVideoPlayback]) if ([[VLCMain sharedInstance] activeVideoPlayback])
[[VLCCoreInteraction sharedInstance] pause]; [[VLCCoreInteraction sharedInstance] pause];
} }
}
else else
[super performMiniaturize: sender]; [super performMiniaturize: sender];
} }
...@@ -908,11 +911,14 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -908,11 +911,14 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)someWindowWillMiniaturize:(NSNotification *)notification - (void)someWindowWillMiniaturize:(NSNotification *)notification
{ {
if (config_GetInt( VLCIntf, "macosx-pause-minimized" ))
{
if([notification object] == o_nonembedded_window || [notification object] == self) if([notification object] == o_nonembedded_window || [notification object] == self)
{ {
if([[VLCMain sharedInstance] activeVideoPlayback]) if([[VLCMain sharedInstance] activeVideoPlayback])
[[VLCCoreInteraction sharedInstance] pause]; [[VLCCoreInteraction sharedInstance] pause];
} }
}
} }
#pragma mark - #pragma mark -
......
...@@ -92,6 +92,16 @@ void WindowClose ( vout_window_t * ); ...@@ -92,6 +92,16 @@ void WindowClose ( vout_window_t * );
#define SAVEVOL_TEXT N_( "Automatically save the volume on exit" ) #define SAVEVOL_TEXT N_( "Automatically save the volume on exit" )
#define KEEPSIZE_TEXT N_( "Resize interface to the native video size" )
#define KEEPSIZE_LONGTEXT N_( "You have two choices:\n" \
" - The interface will resize to the native video size\n" \
" - The video will fit to the interface size\n " \
"By default, interface resize to the native video size." )
#define PAUSE_MINIMIZED_TEXT N_( "Pause the video playback when minimized" )
#define PAUSE_MINIMIZED_LONGTEXT N_( \
"With this option enabled, the playback will be automatically paused when minimizing the window." )
vlc_module_begin () vlc_module_begin ()
set_description( N_("Mac OS X interface") ) set_description( N_("Mac OS X interface") )
set_capability( "interface", 200 ) set_capability( "interface", 200 )
...@@ -110,6 +120,8 @@ vlc_module_begin () ...@@ -110,6 +120,8 @@ vlc_module_begin ()
add_obsolete_bool( "macosx-stretch" ) /* since 2.0.0 */ add_obsolete_bool( "macosx-stretch" ) /* since 2.0.0 */
add_obsolete_bool( "macosx-background" ) /* since 2.0.0 */ add_obsolete_bool( "macosx-background" ) /* since 2.0.0 */
add_obsolete_bool( "macosx-eq-keep" ) /* since 2.0.0 */ add_obsolete_bool( "macosx-eq-keep" ) /* since 2.0.0 */
add_bool( "macosx-video-autoresize", true, KEEPSIZE_TEXT, KEEPSIZE_LONGTEXT, false )
add_bool( "macosx-pause-minimized", false, PAUSE_MINIMIZED_TEXT, PAUSE_MINIMIZED_LONGTEXT, false )
add_submodule () add_submodule ()
set_description( "Mac OS X Video Output Provider" ) set_description( "Mac OS X Video Output Provider" )
......
...@@ -102,6 +102,8 @@ ...@@ -102,6 +102,8 @@
IBOutlet id o_intf_last_update_lbl; IBOutlet id o_intf_last_update_lbl;
IBOutlet id o_intf_enableGrowl_ckb; IBOutlet id o_intf_enableGrowl_ckb;
IBOutlet id o_intf_nativefullscreen_ckb; IBOutlet id o_intf_nativefullscreen_ckb;
IBOutlet id o_intf_autoresize_ckb;
IBOutlet id o_intf_pauseminimized_ckb;
IBOutlet id o_osd_encoding_pop; IBOutlet id o_osd_encoding_pop;
IBOutlet id o_osd_encoding_txt; IBOutlet id o_osd_encoding_txt;
......
...@@ -276,6 +276,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -276,6 +276,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[o_intf_update_ckb setTitle: _NS("Automatically check for updates")]; [o_intf_update_ckb setTitle: _NS("Automatically check for updates")];
[o_intf_last_update_lbl setStringValue: @""]; [o_intf_last_update_lbl setStringValue: @""];
[o_intf_enableGrowl_ckb setTitle: _NS("Enable Growl notifications (on playlist item change)")]; [o_intf_enableGrowl_ckb setTitle: _NS("Enable Growl notifications (on playlist item change)")];
[o_intf_autoresize_ckb setTitle: _NS("Resize interface to the native video size")];
[o_intf_pauseminimized_ckb setTitle: _NS("Pause the video playback when minimized")];
/* Subtitles and OSD */ /* Subtitles and OSD */
[o_osd_encoding_txt setStringValue: _NS("Default Encoding")]; [o_osd_encoding_txt setStringValue: _NS("Default Encoding")];
...@@ -484,6 +486,8 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na ...@@ -484,6 +486,8 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
[o_intf_style_dark_bcell setState: NO]; [o_intf_style_dark_bcell setState: NO];
[o_intf_style_bright_bcell setState: YES]; [o_intf_style_bright_bcell setState: YES];
} }
[self setupButton: o_intf_autoresize_ckb forBoolValue: "macosx-video-autoresize"];
[self setupButton: o_intf_pauseminimized_ckb forBoolValue: "macosx-pause-minimized"];
/****************** /******************
* audio settings * * audio settings *
...@@ -817,6 +821,8 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -817,6 +821,8 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
config_PutInt( p_intf, "macosx-mediakeys", [o_intf_mediakeys_ckb state] ); config_PutInt( p_intf, "macosx-mediakeys", [o_intf_mediakeys_ckb state] );
config_PutInt( p_intf, "macosx-interfacestyle", [o_intf_style_dark_bcell state] ); config_PutInt( p_intf, "macosx-interfacestyle", [o_intf_style_dark_bcell state] );
config_PutInt( p_intf, "macosx-nativefullscreenmode", [o_intf_nativefullscreen_ckb state] ); config_PutInt( p_intf, "macosx-nativefullscreenmode", [o_intf_nativefullscreen_ckb state] );
config_PutInt( p_intf, "macosx-pause-minimized", [o_intf_pauseminimized_ckb state] );
config_PutInt( p_intf, "macosx-video-autoresize", [o_intf_autoresize_ckb state] );
if( [o_intf_enableGrowl_ckb state] == NSOnState ) if( [o_intf_enableGrowl_ckb state] == NSOnState )
{ {
tmpString = getString( "control" ); tmpString = getString( "control" );
......
...@@ -336,6 +336,11 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -336,6 +336,11 @@ static int Control (vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP: case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
{ {
if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
{
if (!config_GetInt( vd, "macosx-video-autoresize" ))
return VLC_SUCCESS;
}
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
NSPoint topleftbase; NSPoint topleftbase;
NSPoint topleftscreen; NSPoint topleftscreen;
......
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