changeset 36307:a3a1ad19b8b4

On X11 use root window as "hidden" window instead of an unmaped window. Creating an unmaped window has ugly side-effects like the window still appearing for a short time and -geometry not working with some window managers. Since creating a GL context for the root window might not work also add fallback behaviour.
author reimar
date Mon, 05 Aug 2013 16:48:56 +0000
parents 97638800c6f3
children 687e65bf99f9
files libvo/vo_gl.c libvo/x11_common.c
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_gl.c	Mon Aug 05 06:46:41 2013 +0000
+++ b/libvo/vo_gl.c	Mon Aug 05 16:48:56 2013 +0000
@@ -1366,7 +1366,10 @@
       if (!allow_sw && isSoftwareGl())
         goto err_out;
       autodetectGlExtensions();
-    } else if (use_ycbcr == -1) {
+    }
+    if (use_yuv == -1)
+      use_yuv = glctx.type == GLTYPE_EGL_X11 || glctx.type == GLTYPE_EGL_ANDROID ? YUV_CONVERSION_SL_PROGRAM : YUV_CONVERSION_FRAGMENT_LOOKUP; // mostly sensible fallback
+    if (use_ycbcr == -1) {
       // rare feature, not worth creating a window to detect
       use_ycbcr = 0;
     }
--- a/libvo/x11_common.c	Mon Aug 05 06:46:41 2013 +0000
+++ b/libvo/x11_common.c	Mon Aug 05 16:48:56 2013 +0000
@@ -1100,6 +1100,16 @@
                              Colormap col_map,
                              const char *classname, const char *title)
 {
+  if (flags & VOFLAG_HIDDEN) {
+    // unmapped windows cause lots of issues, in particular
+    // -geometry might be ignore when finally mapping them etc.
+    if (vo_window == None)
+      vo_window = mRootWin;
+    window_state = VOFLAG_HIDDEN;
+    goto final;
+  } else if (vo_window == mRootWin && (window_state & VOFLAG_HIDDEN)) {
+    vo_window = None;
+  }
   if (vo_wintitle)
     title = vo_wintitle;
   if (WinID >= 0) {
@@ -1138,8 +1148,6 @@
                       x, y, width, height, vis->depth, col_map);
     window_state = VOFLAG_HIDDEN;
   }
-  if (flags & VOFLAG_HIDDEN)
-    goto final;
   XStoreName(mDisplay, vo_window, title);
   XChangeProperty(mDisplay, vo_window, XA_NET_WM_NAME, XAUTF8_STRING,
                   8, PropModeReplace, title, strlen(title));