[vlc-devel] [PATCH 12/13] vout: resize display synchronously

RĂ©mi Denis-Courmont remi at remlab.net
Wed Jun 12 19:48:36 CEST 2019


Like the splitter already does, this ensures that we do not queue a
large number of events via vout control upon drag-and-drop of the window.

This also prevents acknowledging the window resize before the resize is
actually handled (refs #20572).
---
 src/video_output/control.h      |  7 -------
 src/video_output/video_output.c | 21 +++++++--------------
 2 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/src/video_output/control.h b/src/video_output/control.h
index 5c4448a6c0..acac368d2d 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -31,7 +31,6 @@ enum {
     VOUT_CONTROL_CHANGE_INTERLACE,      /* boolean */
 
     VOUT_CONTROL_MOUSE_STATE,           /* vlc_mouse_t */
-    VOUT_CONTROL_DISPLAY_SIZE,          /* window */
 
     VOUT_CONTROL_VIEWPOINT,             /* viewpoint */
 };
@@ -42,12 +41,6 @@ typedef struct {
     union {
         bool    boolean;
         char    *string;
-        struct {
-            unsigned x;
-            unsigned y;
-            unsigned width;
-            unsigned height;
-        } window;
         struct {
             int channel;
             float value;
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index af5ba49430..4a721e4c64 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -413,16 +413,15 @@ void vout_ChangeWindowState(vout_thread_t *vout, unsigned st)
 void vout_ChangeDisplaySize(vout_thread_t *vout,
                             unsigned width, unsigned height)
 {
+    vout_thread_sys_t *sys = vout->p;
+
     assert(!vout->p->dummy);
-    /* DO NOT call this outside the vout window callbacks */
-    vout_control_cmd_t cmd;
 
-    vout_control_cmd_Init(&cmd, VOUT_CONTROL_DISPLAY_SIZE);
-    cmd.window.x      = 0;
-    cmd.window.y      = 0;
-    cmd.window.width  = width;
-    cmd.window.height = height;
-    vout_control_Push(&vout->p->control, &cmd);
+    /* DO NOT call this outside the vout window callbacks */
+    vlc_mutex_lock(&sys->display_lock);
+    if (sys->display != NULL)
+        vout_display_SetSize(sys->display, width, height);
+    vlc_mutex_unlock(&sys->display_lock);
 }
 
 void vout_ChangeDisplayFilled(vout_thread_t *vout, bool is_filled)
@@ -1576,12 +1575,6 @@ static void ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
     case VOUT_CONTROL_MOUSE_STATE:
         ThreadProcessMouseState(vout, &cmd.mouse);
         break;
-    case VOUT_CONTROL_DISPLAY_SIZE:
-        vlc_mutex_lock(&vout->p->display_lock);
-        vout_display_SetSize(vout->p->display,
-                             cmd.window.width, cmd.window.height);
-        vlc_mutex_unlock(&vout->p->display_lock);
-        break;
     case VOUT_CONTROL_VIEWPOINT:
         vlc_mutex_lock(&vout->p->display_lock);
         vout_SetDisplayViewpoint(vout->p->display, &cmd.viewpoint);
-- 
2.20.1



More information about the vlc-devel mailing list