[vlc-commits] x11: do not pretend that the video window was resized (refs #8696)

Rémi Denis-Courmont git at videolan.org
Sat Jun 8 20:06:25 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  8 21:00:05 2013 +0300| [22b6f35c3c94189efa41a2a84fd3082702908865] | committer: Rémi Denis-Courmont

x11: do not pretend that the video window was resized (refs #8696)

If the core requests a change of the size of the video window, and
the display plugin returns success, the display configuration stored in
the core goes out of synchronization with the X11 server. This results
in incorrect video placement.

Since it cannot be known if resize will succeed or not (at least not
without patching all window provider plugins to block and cross-check),
just return an error.

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

 modules/video_output/xcb/x11.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 2210875..88752c0 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -474,11 +474,17 @@ static int Control (vout_display_t *vd, int query, va_list ap)
             (const vout_display_cfg_t*)va_arg (ap, const vout_display_cfg_t *);
         const bool is_forced = (bool)va_arg (ap, int);
 
-        if (is_forced
-         && vout_window_SetSize (sys->embed,
-                                 p_cfg->display.width,
-                                 p_cfg->display.height))
+        if (is_forced)
+        {   /* Changing the dimensions of the parent window takes place
+             * asynchronously (in the X server). Also it might fail or result
+             * in different dimensions than requested. Request the size change
+             * and return a failure since the size is not (yet) changed.
+             * If the change eventually succeeds, HandleParentStructure()
+             * will trigger a non-forced display size change later. */
+            vout_window_SetSize (sys->embed, p_cfg->display.width,
+                                 p_cfg->display.height);
             return VLC_EGENERIC;
+        }
 
         vout_display_place_t place;
         vout_display_PlacePicture (&place, &vd->source, p_cfg, false);



More information about the vlc-commits mailing list