Commit 844ff7d9 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout: add proper core-managed object variable for wall paper mode

parent 005ff29b
......@@ -499,6 +499,7 @@ static void VariablesInit( playlist_t *p_playlist )
/* Variables to preserve video output parameters */
var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_playlist, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_playlist, "video-wallpaper", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/* Audio output parameters */
var_Create( p_playlist, "mute", VLC_VAR_BOOL );
......
......@@ -574,7 +574,8 @@ void vout_ControlChangeSubMargin(vout_thread_t *vout, int margin)
static void VoutGetDisplayCfg(vout_thread_t *vout, vout_display_cfg_t *cfg, const char *title)
{
/* Load configuration */
cfg->is_fullscreen = var_CreateGetBool(vout, "fullscreen");
cfg->is_fullscreen = var_CreateGetBool(vout, "fullscreen")
|| var_InheritBool(vout, "video-wallpaper");
cfg->display.title = title;
const int display_width = var_CreateGetInteger(vout, "width");
const int display_height = var_CreateGetInteger(vout, "height");
......@@ -1324,9 +1325,15 @@ static int ThreadStart(vout_thread_t *vout, const vout_display_state_t *state)
vout_display_state_t state_default;
if (!state) {
var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
VoutGetDisplayCfg(vout, &state_default.cfg, vout->p->display.title);
state_default.wm_state = var_CreateGetBool(vout, "video-on-top") ? VOUT_WINDOW_STATE_ABOVE :
VOUT_WINDOW_STATE_NORMAL;
bool below = var_InheritBool(vout, "video-wallpaper");
bool above = var_CreateGetBool(vout, "video-on-top");
state_default.wm_state = below ? VOUT_WINDOW_STATE_BELOW
: above ? VOUT_WINDOW_STATE_ABOVE
: VOUT_WINDOW_STATE_NORMAL;
state_default.sar.num = 0;
state_default.sar.den = 0;
......
......@@ -61,6 +61,8 @@ static int ZoomCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int AboveCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int WallPaperCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int FullscreenCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int SnapshotCallback( vlc_object_t *, char const *,
......@@ -275,6 +277,11 @@ void vout_IntfInit( vout_thread_t *p_vout )
var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT, &text, NULL );
var_AddCallback( p_vout, "video-on-top", AboveCallback, NULL );
/* Add a variable to indicate if the window should be below all others */
var_Create( p_vout, "video-wallpaper", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_AddCallback( p_vout, "video-wallpaper", WallPaperCallback,
(void *)(uintptr_t)VOUT_WINDOW_STATE_BELOW );
/* Add a variable to indicate whether we want window decoration or not */
var_Create( p_vout, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
......@@ -327,6 +334,7 @@ void vout_IntfReinit( vout_thread_t *p_vout )
var_TriggerCallback( p_vout, "aspect-ratio" );
var_TriggerCallback( p_vout, "video-on-top" );
var_TriggerCallback( p_vout, "video-wallpaper" );
var_TriggerCallback( p_vout, "video-filter" );
var_TriggerCallback( p_vout, "sub-source" );
......@@ -631,6 +639,25 @@ static int AboveCallback( vlc_object_t *obj, char const *name,
return VLC_SUCCESS;
}
static int WallPaperCallback( vlc_object_t *obj, char const *name,
vlc_value_t prev, vlc_value_t cur, void *data )
{
vout_thread_t *vout = (vout_thread_t *)obj;
if( cur.b_bool )
{
vout_ControlChangeWindowState( vout, VOUT_WINDOW_STATE_BELOW );
vout_ControlChangeFullscreen( vout, true );
}
else
{
var_TriggerCallback( obj, "fullscreen" );
var_TriggerCallback( obj, "video-on-top" );
}
(void) name; (void) prev; (void) data;
return VLC_SUCCESS;
}
static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
......
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