[vlc-commits] vout: pass enum for window state instead of boolean (refs #10302)

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:51:24 2014 +0200| [005ff29ba1fa6e2ab0aebd97a3a54eebbbe1b6cc] | committer: Rémi Denis-Courmont

vout: pass enum for window state instead of boolean (refs #10302)

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

 src/video_output/control.h       |    2 +-
 src/video_output/video_output.c  |   15 ++++++---------
 src/video_output/vout_internal.h |    2 +-
 src/video_output/vout_intf.c     |   15 +++++++--------
 4 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/src/video_output/control.h b/src/video_output/control.h
index 2e25cb8..3d66793 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -49,7 +49,7 @@ enum {
     VOUT_CONTROL_STEP,                  /* time_ptr */
 
     VOUT_CONTROL_FULLSCREEN,            /* bool */
-    VOUT_CONTROL_ON_TOP,                /* bool */
+    VOUT_CONTROL_WINDOW_STATE,          /* unsigned */
     VOUT_CONTROL_DISPLAY_FILLED,        /* bool */
     VOUT_CONTROL_ZOOM,                  /* pair */
 
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 6739d4c..cf65df6 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -499,10 +499,9 @@ void vout_ControlChangeFullscreen(vout_thread_t *vout, bool fullscreen)
     vout_control_PushBool(&vout->p->control, VOUT_CONTROL_FULLSCREEN,
                           fullscreen);
 }
-void vout_ControlChangeOnTop(vout_thread_t *vout, bool is_on_top)
+void vout_ControlChangeWindowState(vout_thread_t *vout, unsigned st)
 {
-    vout_control_PushBool(&vout->p->control, VOUT_CONTROL_ON_TOP,
-                          is_on_top);
+    vout_control_PushInteger(&vout->p->control, VOUT_CONTROL_WINDOW_STATE, st);
 }
 void vout_ControlChangeDisplayFilled(vout_thread_t *vout, bool is_filled)
 {
@@ -1254,11 +1253,9 @@ static void ThreadChangeFullscreen(vout_thread_t *vout, bool fullscreen)
     vout_SetDisplayFullscreen(vout->p->display.vd, fullscreen);
 }
 
-static void ThreadChangeOnTop(vout_thread_t *vout, bool is_on_top)
+static void ThreadChangeWindowState(vout_thread_t *vout, unsigned state)
 {
-    vout_SetWindowState(vout->p->display.vd,
-                        is_on_top ? VOUT_WINDOW_STATE_ABOVE :
-                                    VOUT_WINDOW_STATE_NORMAL);
+    vout_SetWindowState(vout->p->display.vd, state);
 }
 
 static void ThreadChangeDisplayFilled(vout_thread_t *vout, bool is_filled)
@@ -1499,8 +1496,8 @@ static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
     case VOUT_CONTROL_FULLSCREEN:
         ThreadChangeFullscreen(vout, cmd.u.boolean);
         break;
-    case VOUT_CONTROL_ON_TOP:
-        ThreadChangeOnTop(vout, cmd.u.boolean);
+    case VOUT_CONTROL_WINDOW_STATE:
+        ThreadChangeWindowState(vout, cmd.u.integer);
         break;
     case VOUT_CONTROL_DISPLAY_FILLED:
         ThreadChangeDisplayFilled(vout, cmd.u.boolean);
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 90ec3a3..f6ad269 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -140,7 +140,7 @@ struct vout_thread_sys_t
 
 /* TODO to move them to vlc_vout.h */
 void vout_ControlChangeFullscreen(vout_thread_t *, bool fullscreen);
-void vout_ControlChangeOnTop(vout_thread_t *, bool is_on_top);
+void vout_ControlChangeWindowState(vout_thread_t *, unsigned state);
 void vout_ControlChangeDisplayFilled(vout_thread_t *, bool is_filled);
 void vout_ControlChangeZoom(vout_thread_t *, int num, int den);
 void vout_ControlChangeSampleAspectRatio(vout_thread_t *, unsigned num, unsigned den);
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index fb288cf..4a214c4 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -59,7 +59,7 @@ static int ScaleCallback( vlc_object_t *, char const *,
                           vlc_value_t, vlc_value_t, void * );
 static int ZoomCallback( vlc_object_t *, char const *,
                          vlc_value_t, vlc_value_t, void * );
-static int OnTopCallback( vlc_object_t *, char const *,
+static int AboveCallback( 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 * );
@@ -273,7 +273,7 @@ void vout_IntfInit( vout_thread_t *p_vout )
                 | VLC_VAR_ISCOMMAND );
     text.psz_string = _("Always on top");
     var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT, &text, NULL );
-    var_AddCallback( p_vout, "video-on-top", OnTopCallback, NULL );
+    var_AddCallback( p_vout, "video-on-top", AboveCallback, NULL );
 
     /* Add a variable to indicate whether we want window decoration or not */
     var_Create( p_vout, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
@@ -622,13 +622,12 @@ static int ZoomCallback( vlc_object_t *obj, char const *name,
     return var_SetFloat( obj, "scale", cur.f_float );
 }
 
-static int OnTopCallback( vlc_object_t *p_this, char const *psz_cmd,
-                         vlc_value_t oldval, vlc_value_t newval, void *p_data )
+static int AboveCallback( vlc_object_t *obj, char const *name,
+                          vlc_value_t prev, vlc_value_t cur, void *data )
 {
-    vout_thread_t *p_vout = (vout_thread_t *)p_this;
-    (void)psz_cmd; (void)oldval; (void)p_data;
-
-    vout_ControlChangeOnTop( p_vout, newval.b_bool );
+    vout_ControlChangeWindowState( (vout_thread_t *)obj,
+        cur.b_bool ? VOUT_WINDOW_STATE_ABOVE : VOUT_WINDOW_STATE_NORMAL );
+    (void) name; (void) prev; (void) data;
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list