[vlc-commits] vout: add proper core-managed object variable for wall paper mode

Rémi Denis-Courmont git at videolan.org
Sun Jan 5 11:18:59 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan  4 23:55:23 2014 +0200| [844ff7d95d2881619786d53bfa7c07fe59c945fe] | committer: Rémi Denis-Courmont

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=844ff7d95d2881619786d53bfa7c07fe59c945fe
---

 src/playlist/engine.c           |    1 +
 src/video_output/video_output.c |   13 ++++++++++---
 src/video_output/vout_intf.c    |   27 +++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 9aeaf1b..4861602 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -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 );
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index cf65df6..85000a4 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -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;
 
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 4a214c4..8ecd01f 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -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 )
 {



More information about the vlc-commits mailing list