]> git.sesse.net Git - vlc/commitdiff
x11: do not pretend that the video window was resized (refs #8696)
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 8 Jun 2013 18:00:05 +0000 (21:00 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 8 Jun 2013 18:00:05 +0000 (21:00 +0300)
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.

modules/video_output/xcb/x11.c

index 2210875343f3c907b405f43090daab43c6a86645..88752c05d4b064a3140e9d0feae1b31eef9bbc11 100644 (file)
@@ -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);