Commit ad80d3c3 authored by Rémi Duraffort's avatar Rémi Duraffort

Use var_ToggleBool when applicable.

parent 9f3dc2d6
...@@ -231,8 +231,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action ) ...@@ -231,8 +231,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
{ {
vlc_object_t *obj = p_vout ? VLC_OBJECT(p_vout) vlc_object_t *obj = p_vout ? VLC_OBJECT(p_vout)
: VLC_OBJECT(p_playlist); : VLC_OBJECT(p_playlist);
bool b = var_GetBool( obj, "fullscreen" ); var_ToggleBool( obj, "fullscreen" );
var_SetBool( obj, "fullscreen", !b );
break; break;
} }
...@@ -265,8 +264,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action ) ...@@ -265,8 +264,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
{ /* FIXME: this is invalid if not using DirectX output!!! */ { /* FIXME: this is invalid if not using DirectX output!!! */
vlc_object_t *obj = p_vout ? VLC_OBJECT(p_vout) vlc_object_t *obj = p_vout ? VLC_OBJECT(p_vout)
: VLC_OBJECT(p_playlist); : VLC_OBJECT(p_playlist);
bool b = var_GetBool( obj, "directx-wallpaper" ); var_ToggleBool( obj, "directx-wallpaper" );
var_SetBool( obj, "directx-wallpaper", !b );
} }
#endif #endif
...@@ -287,8 +285,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action ) ...@@ -287,8 +285,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
case ACTIONID_RANDOM: case ACTIONID_RANDOM:
{ {
bool b = var_GetBool( p_playlist, "random" ); var_ToggleBool( p_playlist, "random" );
var_SetBool( p_playlist, "random", !b );
} }
case ACTIONID_PLAY_PAUSE: case ACTIONID_PLAY_PAUSE:
......
...@@ -235,7 +235,7 @@ static void MacroDo( httpd_file_sys_t *p_args, ...@@ -235,7 +235,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
p_vout = input_GetVout( p_sys->p_input ); p_vout = input_GetVout( p_sys->p_input );
if( p_vout ) if( p_vout )
{ {
var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) ); var_ToggleBool( p_vout, "fullscreen" );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
msg_Dbg( p_intf, "requested fullscreen toggle" ); msg_Dbg( p_intf, "requested fullscreen toggle" );
} }
......
...@@ -506,9 +506,7 @@ ...@@ -506,9 +506,7 @@
if( [o_title isEqualToString: _NS("Fullscreen")] || if( [o_title isEqualToString: _NS("Fullscreen")] ||
[sender isKindOfClass:[NSButton class]] ) [sender isKindOfClass:[NSButton class]] )
{ {
vlc_value_t val; var_ToggleBool( p_playlist, "fullscreen" );
var_Get( p_playlist, "fullscreen", &val );
var_Set( p_playlist, "fullscreen", (vlc_value_t)!val.b_bool );
} }
pl_Release( VLCIntf ); pl_Release( VLCIntf );
......
...@@ -563,19 +563,13 @@ static int HandleKey( intf_thread_t *p_intf, int i_key ) ...@@ -563,19 +563,13 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
vlc_value_t val; vlc_value_t val;
/* Playlist Settings */ /* Playlist Settings */
case 'r': case 'r':
var_Get( p_playlist, "random", &val ); var_ToggleBool( p_playlist, "random" );
val.b_bool = !val.b_bool;
var_Set( p_playlist, "random", val );
goto end; goto end;
case 'l': case 'l':
var_Get( p_playlist, "loop", &val ); var_ToggleBool( p_playlist, "loop" );
val.b_bool = !val.b_bool;
var_Set( p_playlist, "loop", val );
goto end; goto end;
case 'R': case 'R':
var_Get( p_playlist, "repeat", &val ); var_ToggleBool( p_playlist, "repeat" );
val.b_bool = !val.b_bool;
var_Set( p_playlist, "repeat", val );
goto end; goto end;
/* Playlist sort */ /* Playlist sort */
...@@ -1137,16 +1131,12 @@ static int HandleKey( intf_thread_t *p_intf, int i_key ) ...@@ -1137,16 +1131,12 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
VLC_OBJECT_VOUT, FIND_CHILD ); VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout ) if( p_vout )
{ {
var_Get( p_vout, "fullscreen", &val ); var_ToggleBool( p_vout, "fullscreen" );
val.b_bool = !val.b_bool;
var_Set( p_vout, "fullscreen", val );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
} }
else else
{ {
var_Get( p_playlist, "fullscreen", &val ); var_ToggleBool( p_playlist, "fullscreen" );
val.b_bool = !val.b_bool;
var_Set( p_playlist, "fullscreen", val );
} }
} }
i_ret = 0; i_ret = 0;
......
...@@ -117,7 +117,7 @@ void ActionsManager::fullscreen() ...@@ -117,7 +117,7 @@ void ActionsManager::fullscreen()
vout_thread_t *p_vout = THEMIM->getVout(); vout_thread_t *p_vout = THEMIM->getVout();
if( p_vout) if( p_vout)
{ {
var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) ); var_ToggleBool( p_vout, "fullscreen" );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
} }
} }
...@@ -143,8 +143,7 @@ void ActionsManager::record() ...@@ -143,8 +143,7 @@ void ActionsManager::record()
if( p_input ) if( p_input )
{ {
/* This method won't work fine if the stream can't be cut anywhere */ /* This method won't work fine if the stream can't be cut anywhere */
const bool b_recording = var_GetBool( p_input, "record" ); var_ToggleBool( p_input, "record" );
var_SetBool( p_input, "record", !b_recording );
#if 0 #if 0
else else
{ {
......
...@@ -37,7 +37,7 @@ void CmdFullscreen::execute() ...@@ -37,7 +37,7 @@ void CmdFullscreen::execute()
if( pVout ) if( pVout )
{ {
// Switch to fullscreen // Switch to fullscreen
var_SetBool( pVout, "fullscreen", !var_GetBool( pVout, "fullscreen" ) ); var_ToggleBool( pVout, "fullscreen" );
vlc_object_release( pVout ); vlc_object_release( pVout );
} }
} }
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