[vlc-commits] vout: expose fullscreen output selection

Rémi Denis-Courmont git at videolan.org
Sun May 20 19:52:30 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May 19 21:42:22 2018 +0300| [d730e7a5368ab3d9c5b1f22e7045d00f3b18b425] | committer: Rémi Denis-Courmont

vout: expose fullscreen output selection

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

 src/video_output/control.h       |  3 ++-
 src/video_output/video_output.c  | 33 ++++++++++++++++++++++++---------
 src/video_output/vout_internal.h |  3 ++-
 src/video_output/vout_intf.c     |  7 +++++--
 4 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/src/video_output/control.h b/src/video_output/control.h
index 64c52779b5..d02a5f1406 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -51,7 +51,8 @@ enum {
     VOUT_CONTROL_FLUSH,                 /* time */
     VOUT_CONTROL_STEP,                  /* time_ptr */
 
-    VOUT_CONTROL_FULLSCREEN,            /* bool */
+    VOUT_CONTROL_FULLSCREEN,            /* string */
+    VOUT_CONTROL_WINDOWED,              /* void */
     VOUT_CONTROL_WINDOW_STATE,          /* unsigned */
     VOUT_CONTROL_MOUSE_STATE,           /* vlc_mouse_t */
     VOUT_CONTROL_DISPLAY_SIZE,          /* window */
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 4e53ac5a62..5581f50541 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -483,11 +483,16 @@ void vout_ChangeAspectRatio( vout_thread_t *p_vout,
 }
 
 /* vout_Control* are usable by anyone at anytime */
-void vout_ControlChangeFullscreen(vout_thread_t *vout, bool fullscreen)
+void vout_ControlChangeFullscreen(vout_thread_t *vout, const char *id)
 {
-    vout_control_PushBool(&vout->p->control, VOUT_CONTROL_FULLSCREEN,
-                          fullscreen);
+    vout_control_PushString(&vout->p->control, VOUT_CONTROL_FULLSCREEN, id);
 }
+
+void vout_ControlChangeWindowed(vout_thread_t *vout)
+{
+    vout_control_PushVoid(&vout->p->control, VOUT_CONTROL_WINDOWED);
+}
+
 void vout_ControlChangeWindowState(vout_thread_t *vout, unsigned st)
 {
     vout_control_PushInteger(&vout->p->control, VOUT_CONTROL_WINDOW_STATE, st);
@@ -1338,17 +1343,24 @@ static void ThreadStep(vout_thread_t *vout, mtime_t *duration)
     }
 }
 
-static void ThreadChangeFullscreen(vout_thread_t *vout, bool fullscreen)
+static void ThreadChangeFullscreen(vout_thread_t *vout, const char *id)
 {
     vout_window_t *window = vout->p->window;
 
     if (window == NULL)
         return; /* splitter! */
 
-    if (fullscreen)
-        vout_window_SetFullScreen(window, NULL);
-    else
-        vout_window_UnsetFullScreen(window);
+    vout_window_SetFullScreen(window, id);
+}
+
+static void ThreadChangeWindow(vout_thread_t *vout)
+{
+    vout_window_t *window = vout->p->window;
+
+    if (window == NULL)
+        return; /* splitter! */
+
+    vout_window_UnsetFullScreen(window);
 }
 
 static void ThreadChangeWindowState(vout_thread_t *vout, unsigned state)
@@ -1700,7 +1712,10 @@ static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
         ThreadStep(vout, cmd.time_ptr);
         break;
     case VOUT_CONTROL_FULLSCREEN:
-        ThreadChangeFullscreen(vout, cmd.boolean);
+        ThreadChangeFullscreen(vout, cmd.string);
+        break;
+    case VOUT_CONTROL_WINDOWED:
+        ThreadChangeWindow(vout);
         break;
     case VOUT_CONTROL_WINDOW_STATE:
         ThreadChangeWindowState(vout, cmd.integer);
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index d74e7cc462..5f1bf01e34 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -187,7 +187,8 @@ static inline void vout_CloseAndRelease( vout_thread_t *p_vout )
 }
 
 /* TODO to move them to vlc_vout.h */
-void vout_ControlChangeFullscreen(vout_thread_t *, bool fullscreen);
+void vout_ControlChangeFullscreen(vout_thread_t *, const char *id);
+void vout_ControlChangeWindowed(vout_thread_t *);
 void vout_ControlChangeWindowState(vout_thread_t *, unsigned state);
 void vout_ControlChangeDisplaySize(vout_thread_t *,
                                    unsigned width, unsigned height);
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index d6a82c521f..dc2a81deca 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -533,7 +533,7 @@ static int WallPaperCallback( vlc_object_t *obj, char const *name,
     if( cur.b_bool )
     {
         vout_ControlChangeWindowState( vout, VOUT_WINDOW_STATE_BELOW );
-        vout_ControlChangeFullscreen( vout, true );
+        vout_ControlChangeFullscreen( vout, NULL );
     }
     else
     {
@@ -550,7 +550,10 @@ static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd,
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
     (void)psz_cmd; (void) oldval; (void)p_data;
 
-    vout_ControlChangeFullscreen( p_vout, newval.b_bool );
+    if( newval.b_bool )
+        vout_ControlChangeFullscreen( p_vout, NULL );
+    else
+        vout_ControlChangeWindowed( p_vout );
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list