[vlc-commits] GLX: create window with same depth and visual as root

Rémi Denis-Courmont git at videolan.org
Sat Jun 8 19:17:14 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  8 20:13:34 2013 +0300| [eb713edf3b8017fc8fd09464ffe237a3f2797574] | committer: Rémi Denis-Courmont

GLX: create window with same depth and visual as root

...rather than the parent window. This should work better if the parent
window is transparent or has whatever other unusual property. Also pass
a proper visual ID.

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

 modules/video_output/xcb/glx.c |   24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c
index b367cef..4a7efa0 100644
--- a/modules/video_output/xcb/glx.c
+++ b/modules/video_output/xcb/glx.c
@@ -121,22 +121,34 @@ static bool CheckGLX (vout_display_t *vd, Display *dpy)
 }
 
 static int CreateWindow (vout_display_t *vd, xcb_connection_t *conn,
-                         uint_fast8_t depth, xcb_visualid_t vid,
+                         const xcb_screen_t *screen,
                          uint_fast16_t width, uint_fast16_t height)
 {
     vout_display_sys_t *sys = vd->sys;
-    const uint32_t mask = XCB_CW_EVENT_MASK;
+    xcb_pixmap_t pixmap = xcb_generate_id (conn);
+    const uint32_t mask =
+        XCB_CW_BACK_PIXMAP |
+        XCB_CW_BACK_PIXEL |
+        XCB_CW_BORDER_PIXMAP |
+        XCB_CW_BORDER_PIXEL |
+        XCB_CW_EVENT_MASK |
+        XCB_CW_COLORMAP;
     const uint32_t values[] = {
-        /* XCB_CW_EVENT_MASK */
+        pixmap,
+        screen->black_pixel,
+        pixmap,
+        screen->black_pixel,
         XCB_EVENT_MASK_VISIBILITY_CHANGE,
+        screen->default_colormap,
     };
     xcb_void_cookie_t cc, cm;
 
-    cc = xcb_create_window_checked (conn, depth, sys->window,
+    xcb_create_pixmap (conn, screen->root_depth, pixmap, screen->root, 1, 1);
+    cc = xcb_create_window_checked (conn, screen->root_depth, sys->window,
                                     sys->embed->handle.xid, 0, 0,
                                     width, height, 0,
                                     XCB_WINDOW_CLASS_INPUT_OUTPUT,
-                                    vid, mask, values);
+                                    screen->root_visual, mask, values);
     cm = xcb_map_window_checked (conn, sys->window);
     if (XCB_error_Check (vd, conn, "cannot create X11 window", cc)
      || XCB_error_Check (vd, conn, "cannot map X11 window", cm))
@@ -246,7 +258,7 @@ static int Open (vlc_object_t *obj)
     }
 
     sys->glwin = None;
-    if (!CreateWindow (vd, conn, depth, 0 /* ??? */, width, height))
+    if (!CreateWindow (vd, conn, scr, width, height))
         sys->glwin = glXCreateWindow (dpy, conf, sys->window, NULL );
     if (sys->glwin == None)
     {



More information about the vlc-commits mailing list