[vlc-devel] [PATCH 14/16] vout: xcb: use vlc_xcb_handle_t

Thomas Guillem thomas at gllm.fr
Wed Nov 9 18:33:08 CET 2016


Given that our vlc-xcb helpers will require to store some additional state
(such as the previous mouse position, cache of certain properties, etc.) it
makes sense for them to use a handle which we have control over.

xcb_connection_t sadly does not have functionality so that we can pass around
on opaque pointer with it, so instead it is being wrapped in the struct
introduced in this commit.
---
 modules/hw/vdpau/display.c          | 10 ++++---
 modules/video_output/xcb/events.c   | 58 ++++++++++++++++++++-----------------
 modules/video_output/xcb/events.h   | 15 +++++++---
 modules/video_output/xcb/glx.c      | 10 +++----
 modules/video_output/xcb/pictures.c |  8 +++--
 modules/video_output/xcb/pictures.h |  3 +-
 modules/video_output/xcb/x11.c      | 14 ++++-----
 modules/video_output/xcb/xvideo.c   | 14 ++++-----
 8 files changed, 75 insertions(+), 57 deletions(-)

diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index b1d17a8..ee2c592 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -54,6 +54,7 @@ vlc_module_end()
 
 struct vout_display_sys_t
 {
+    vlc_xcb_handle_t vx;
     xcb_connection_t *conn; /**< XCB connection */
     vout_window_t *embed; /**< parent window */
     vdp_t *vdp; /**< VDPAU back-end */
@@ -402,7 +403,7 @@ static void Manage(vout_display_t *vd)
     vout_display_sys_t *sys = vd->sys;
     bool visible;
 
-    vlc_xcb_Manage(vd, sys->conn, &visible);
+    vlc_xcb_Manage(vd, &sys->vx, &visible);
 }
 
 static int xcb_screen_num(xcb_connection_t *conn, const xcb_screen_t *screen)
@@ -431,13 +432,14 @@ static int Open(vlc_object_t *obj)
         return VLC_ENOMEM;
 
     const xcb_screen_t *screen;
-    sys->embed = vlc_xcb_parent_Create(vd, &sys->conn, &screen);
+    sys->embed = vlc_xcb_parent_Create(vd, &sys->vx, &screen);
     if (sys->embed == NULL)
     {
         free(sys);
         return VLC_EGENERIC;
     }
 
+    sys->conn = sys->vx.conn;
     /* Load the VDPAU back-end and create a device instance */
     VdpStatus err = vdp_get_x11(sys->embed->display.x11,
                                 xcb_screen_num(sys->conn, screen),
@@ -599,7 +601,7 @@ static int Open(vlc_object_t *obj)
                 sys->window, sys->embed->handle.xid, place.x, place.y,
                 place.width, place.height, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT,
                 screen->root_visual, mask, values);
-        if (vlc_xcb_error_Check(vd, sys->conn, "window creation failure", c))
+        if (vlc_xcb_error_Check(vd, &sys->vx, "window creation failure", c))
             goto error;
         msg_Dbg(vd, "using X11 window 0x%08"PRIx32, sys->window);
         xcb_map_window(sys->conn, sys->window);
@@ -648,7 +650,7 @@ static int Open(vlc_object_t *obj)
         goto error;
     }
 
-    sys->cursor = vlc_xcb_cursor_Create(sys->conn, screen);
+    sys->cursor = vlc_xcb_cursor_Create(&sys->vx, screen);
     sys->pool = NULL;
 
     /* */
diff --git a/modules/video_output/xcb/events.c b/modules/video_output/xcb/events.c
index 6b2bb73..0fa5d92 100644
--- a/modules/video_output/xcb/events.c
+++ b/modules/video_output/xcb/events.c
@@ -36,12 +36,12 @@
 
 #pragma GCC visibility push(default)
 
-int vlc_xcb_error_Check(vout_display_t *vd, xcb_connection_t *conn,
+int vlc_xcb_error_Check(vout_display_t *vd, vlc_xcb_handle_t *vx,
                         const char *str, xcb_void_cookie_t ck)
 {
     xcb_generic_error_t *err;
 
-    err = xcb_request_check (conn, ck);
+    err = xcb_request_check (vx->conn, ck);
     if (err)
     {
         int code = err->error_code;
@@ -57,7 +57,7 @@ int vlc_xcb_error_Check(vout_display_t *vd, xcb_connection_t *conn,
 /**
  * Connect to the X server.
  */
-static xcb_connection_t *Connect (vlc_object_t *obj, const char *display)
+static vlc_xcb_handle_t Connect (vlc_object_t *obj, const char *display)
 {
     xcb_connection_t *conn = xcb_connect (display, NULL);
     if (xcb_connection_has_error (conn) /*== NULL*/)
@@ -65,7 +65,7 @@ static xcb_connection_t *Connect (vlc_object_t *obj, const char *display)
         msg_Err (obj, "cannot connect to X server (%s)",
                  (display != NULL) ? display : "default");
         xcb_disconnect (conn);
-        return NULL;
+        return ( vlc_xcb_handle_t ) { .conn = NULL };
     }
 
     const xcb_setup_t *setup = xcb_get_setup (conn);
@@ -74,15 +74,16 @@ static xcb_connection_t *Connect (vlc_object_t *obj, const char *display)
     msg_Dbg (obj, " vendor : %.*s", (int)setup->vendor_len,
              xcb_setup_vendor (setup));
     msg_Dbg (obj, " version: %"PRIu32, setup->release_number);
-    return conn;
+    return ( vlc_xcb_handle_t ) { .conn = conn };
 }
 
 /**
  * (Try to) register to mouse events on a window if needed.
  */
-static void RegisterEvents (vlc_object_t *obj, xcb_connection_t *conn,
+static void RegisterEvents (vlc_object_t *obj, vlc_xcb_handle_t *vx,
                             xcb_window_t wnd)
 {
+    xcb_connection_t* conn = vx->conn;
     /* Subscribe to parent window resize events */
     uint32_t value = XCB_EVENT_MASK_POINTER_MOTION;
     xcb_change_window_attributes (conn, wnd, XCB_CW_EVENT_MASK, &value);
@@ -101,11 +102,11 @@ static void RegisterEvents (vlc_object_t *obj, xcb_connection_t *conn,
  * Find screen matching a given root window.
  */
 static const xcb_screen_t *FindScreen (vlc_object_t *obj,
-                                       xcb_connection_t *conn,
+                                       vlc_xcb_handle_t *vx,
                                        xcb_window_t root)
 {
     /* Find the selected screen */
-    const xcb_setup_t *setup = xcb_get_setup (conn);
+    const xcb_setup_t *setup = xcb_get_setup (vx->conn);
     for (xcb_screen_iterator_t i = xcb_setup_roots_iterator (setup);
          i.rem > 0; xcb_screen_next (&i))
     {
@@ -120,7 +121,7 @@ static const xcb_screen_t *FindScreen (vlc_object_t *obj,
 }
 
 vout_window_t *vlc_xcb_parent_Create(vout_display_t *vd,
-                                     xcb_connection_t **restrict pconn,
+                                     vlc_xcb_handle_t * vx,
                                      const xcb_screen_t **restrict pscreen)
 {
     vout_window_t *wnd = vout_display_NewWindow (vd, VOUT_WINDOW_TYPE_XID);
@@ -130,14 +131,14 @@ vout_window_t *vlc_xcb_parent_Create(vout_display_t *vd,
         return NULL;
     }
 
-    xcb_connection_t *conn = Connect (VLC_OBJECT(vd), wnd->display.x11);
-    if (conn == NULL)
+    *vx = Connect (VLC_OBJECT(vd), wnd->display.x11);
+    if (vx->conn == NULL)
         goto error;
-    *pconn = conn;
 
+    xcb_connection_t *conn = vx->conn;
     /* Events must be registered before the window geometry is queried, so as
      * to avoid missing impeding resize events. */
-    RegisterEvents (VLC_OBJECT(vd), conn, wnd->handle.xid);
+    RegisterEvents (VLC_OBJECT(vd), vx, wnd->handle.xid);
 
     xcb_get_geometry_reply_t *geo =
         xcb_get_geometry_reply (conn, xcb_get_geometry (conn, wnd->handle.xid),
@@ -148,7 +149,7 @@ vout_window_t *vlc_xcb_parent_Create(vout_display_t *vd,
         goto error;
     }
 
-    const xcb_screen_t *screen = FindScreen (VLC_OBJECT(vd), conn, geo->root);
+    const xcb_screen_t *screen = FindScreen (VLC_OBJECT(vd), vx, geo->root);
     free (geo);
     if (screen == NULL)
         goto error;
@@ -156,15 +157,16 @@ vout_window_t *vlc_xcb_parent_Create(vout_display_t *vd,
     return wnd;
 
 error:
-    if (conn != NULL)
-        xcb_disconnect (conn);
+    if (vx->conn != NULL)
+        xcb_disconnect (vx->conn);
     vout_display_DeleteWindow (vd, wnd);
     return NULL;
 }
 
-xcb_cursor_t vlc_xcb_cursor_Create(xcb_connection_t *conn,
+xcb_cursor_t vlc_xcb_cursor_Create(vlc_xcb_handle_t *vx,
                                    const xcb_screen_t *scr)
 {
+    xcb_connection_t* conn = vx->conn;
     xcb_cursor_t cur = xcb_generate_id (conn);
     xcb_pixmap_t pix = xcb_generate_id (conn);
 
@@ -179,22 +181,25 @@ xcb_cursor_t vlc_xcb_cursor_Create(xcb_connection_t *conn,
  */
 
 /* FIXME we assume direct mapping between XCB and VLC */
-static void HandleButtonPress (vout_display_t *vd,
+static void HandleButtonPress (vout_display_t *vd, vlc_xcb_handle_t* vx,
                                const xcb_button_press_event_t *ev)
 {
+    VLC_UNUSED( vx );
     vout_display_SendEventMousePressed (vd, ev->detail - 1);
 }
 
-static void HandleButtonRelease (vout_display_t *vd,
+static void HandleButtonRelease (vout_display_t *vd, vlc_xcb_handle_t* vx,
                                  const xcb_button_release_event_t *ev)
 {
+    VLC_UNUSED( vx );
     vout_display_SendEventMouseReleased (vd, ev->detail - 1);
 }
 
-static void HandleMotionNotify (vout_display_t *vd, xcb_connection_t *conn,
+static void HandleMotionNotify (vout_display_t *vd, vlc_xcb_handle_t *vx,
                                 const xcb_motion_notify_event_t *ev)
 {
     vout_display_place_t place;
+    xcb_connection_t* conn = vx->conn;
 
     /* show the default cursor */
     xcb_change_window_attributes (conn, ev->event, XCB_CW_CURSOR,
@@ -225,21 +230,21 @@ static void HandleVisibilityNotify (vout_display_t *vd, bool *visible,
 /**
  * Process an X11 event.
  */
-static int ProcessEvent (vout_display_t *vd, xcb_connection_t *conn,
+static int ProcessEvent (vout_display_t *vd, vlc_xcb_handle_t *vx,
                          bool *visible, xcb_generic_event_t *ev)
 {
     switch (ev->response_type & 0x7f)
     {
         case XCB_BUTTON_PRESS:
-            HandleButtonPress (vd, (xcb_button_press_event_t *)ev);
+            HandleButtonPress (vd, vx, (xcb_button_press_event_t *)ev);
             break;
 
         case XCB_BUTTON_RELEASE:
-            HandleButtonRelease (vd, (xcb_button_release_event_t *)ev);
+            HandleButtonRelease (vd, vx, (xcb_button_release_event_t *)ev);
             break;
 
         case XCB_MOTION_NOTIFY:
-            HandleMotionNotify (vd, conn, (xcb_motion_notify_event_t *)ev);
+            HandleMotionNotify (vd, vx, (xcb_motion_notify_event_t *)ev);
             break;
 
         case XCB_VISIBILITY_NOTIFY:
@@ -258,12 +263,13 @@ static int ProcessEvent (vout_display_t *vd, xcb_connection_t *conn,
     return VLC_SUCCESS;
 }
 
-int vlc_xcb_Manage(vout_display_t *vd, xcb_connection_t *conn, bool *visible)
+int vlc_xcb_Manage(vout_display_t *vd, vlc_xcb_handle_t *vx, bool *visible)
 {
+    xcb_connection_t* conn = vx->conn;
     xcb_generic_event_t *ev;
 
     while ((ev = xcb_poll_for_event (conn)) != NULL)
-        ProcessEvent (vd, conn, visible, ev);
+        ProcessEvent (vd, vx, visible, ev);
 
     if (xcb_connection_has_error (conn))
     {
diff --git a/modules/video_output/xcb/events.h b/modules/video_output/xcb/events.h
index 556a434..3f1b57f 100644
--- a/modules/video_output/xcb/events.h
+++ b/modules/video_output/xcb/events.h
@@ -29,6 +29,13 @@
 
 #include <vlc_vout_display.h>
 
+struct vlc_xcb_handle_t {
+    xcb_connection_t* conn;
+};
+
+typedef struct vlc_xcb_handle_t vlc_xcb_handle_t;
+
+
 /* keys.c */
 typedef struct key_handler_t key_handler_t;
 key_handler_t *XCB_keyHandler_Create (vlc_object_t *, xcb_connection_t *);
@@ -40,7 +47,7 @@ int XCB_keyHandler_Process (key_handler_t *, xcb_generic_event_t *);
 /**
  * Checks for an XCB error.
  */
-int vlc_xcb_error_Check(vout_display_t *, xcb_connection_t *conn,
+int vlc_xcb_error_Check(vout_display_t *, vlc_xcb_handle_t *conn,
                         const char *str, xcb_void_cookie_t);
 
 /**
@@ -50,7 +57,7 @@ int vlc_xcb_error_Check(vout_display_t *, xcb_connection_t *conn,
  * finds the corresponding X server screen.
  */
 struct vout_window_t *vlc_xcb_parent_Create(vout_display_t *obj,
-                                            xcb_connection_t **connp,
+                                            vlc_xcb_handle_t *vx,
                                             const xcb_screen_t **screenp);
 
 /**
@@ -63,12 +70,12 @@ struct vout_window_t *vlc_xcb_parent_Create(vout_display_t *obj,
  * @param scr target XCB screen
  * @return cursor XID
  */
-xcb_cursor_t vlc_xcb_cursor_Create(xcb_connection_t *conn,
+xcb_cursor_t vlc_xcb_cursor_Create(vlc_xcb_handle_t *vx,
                                    const xcb_screen_t *scr);
 
 /**
  * Processes XCB events.
  */
-int vlc_xcb_Manage(vout_display_t *vd, xcb_connection_t *conn, bool *visible);
+int vlc_xcb_Manage(vout_display_t *vd, vlc_xcb_handle_t *conn, bool *visible);
 
 #endif /* include-guard */
diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c
index e87704a..085342e 100644
--- a/modules/video_output/xcb/glx.c
+++ b/modules/video_output/xcb/glx.c
@@ -57,6 +57,7 @@ vlc_module_end ()
 
 struct vout_display_sys_t
 {
+    vlc_xcb_handle_t vx;
     xcb_connection_t *conn; /**< XCB connection */
     vlc_gl_t *gl;
 
@@ -88,18 +89,17 @@ static int Open (vlc_object_t *obj)
     sys->pool = NULL;
 
     /* Get window, connect to X server (via XCB) */
-    xcb_connection_t *conn;
     const xcb_screen_t *scr;
     vout_window_t *surface;
 
-    surface = vlc_xcb_parent_Create(vd, &conn, &scr);
+    surface = vlc_xcb_parent_Create(vd, &sys->vx, &scr);
     if (surface == NULL)
     {
         free (sys);
         return VLC_EGENERIC;
     }
 
-    sys->conn = conn;
+    sys->conn = sys->vx.conn;
     sys->gl = vlc_gl_Create (surface, VLC_OPENGL, "glx");
     if (sys->gl == NULL)
         goto error;
@@ -114,7 +114,7 @@ static int Open (vlc_object_t *obj)
     if (sys->vgl == NULL)
         goto error;
 
-    sys->cursor = vlc_xcb_cursor_Create(conn, scr);
+    sys->cursor = vlc_xcb_cursor_Create(&sys->vx, scr);
     sys->visible = false;
 
     /* Setup vout_display_t once everything is fine */
@@ -263,5 +263,5 @@ static void Manage (vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
 
-    vlc_xcb_Manage(vd, sys->conn, &sys->visible);
+    vlc_xcb_Manage(vd, &sys->vx, &sys->visible);
 }
diff --git a/modules/video_output/xcb/pictures.c b/modules/video_output/xcb/pictures.c
index fd82e13..f7b219d 100644
--- a/modules/video_output/xcb/pictures.c
+++ b/modules/video_output/xcb/pictures.c
@@ -83,9 +83,11 @@ static void XCB_picture_Destroy (picture_t *pic)
  * the X server (MIT-SHM extension).
  */
 int XCB_picture_Alloc (vout_display_t *vd, picture_resource_t *res,
-                       size_t size, xcb_connection_t *conn,
+                       size_t size, vlc_xcb_handle_t *vx,
                        xcb_shm_seg_t segment)
 {
+    xcb_connection_t* conn = vx->conn;
+
 #ifdef HAVE_SYS_SHM_H
     /* Allocate shared memory segment */
     int id = shmget (IPC_PRIVATE, size, IPC_CREAT | S_IRWXU);
@@ -109,7 +111,7 @@ int XCB_picture_Alloc (vout_display_t *vd, picture_resource_t *res,
     if (segment != 0)
     {   /* Attach the segment to X */
         xcb_void_cookie_t ck = xcb_shm_attach_checked (conn, segment, id, 1);
-        switch (vlc_xcb_error_Check(vd, conn,
+        switch (vlc_xcb_error_Check(vd, vx,
                                     "shared memory server-side error", ck))
         {
             case 0:
@@ -123,7 +125,7 @@ int XCB_picture_Alloc (vout_display_t *vd, picture_resource_t *res,
                 buf.shm_perm.mode |= S_IRGRP|S_IROTH;
                 shmctl (id, IPC_SET, &buf);
                 ck = xcb_shm_attach_checked (conn, segment, id, 1);
-                if (vlc_xcb_error_Check(vd, conn, "same error on retry",
+                if (vlc_xcb_error_Check(vd, vx, "same error on retry",
                                         ck) == 0)
                     break;
                 /* fall through */
diff --git a/modules/video_output/xcb/pictures.h b/modules/video_output/xcb/pictures.h
index 9cb2dea..cdfa217 100644
--- a/modules/video_output/xcb/pictures.h
+++ b/modules/video_output/xcb/pictures.h
@@ -29,10 +29,11 @@
 #include <vlc_picture.h>
 #include <vlc_vout_display.h>
 #include <xcb/shm.h>
+#include "events.h"
 
 bool XCB_shm_Check (vlc_object_t *obj, xcb_connection_t *conn);
 int XCB_picture_Alloc (vout_display_t *, picture_resource_t *, size_t size,
-                       xcb_connection_t *, xcb_shm_seg_t);
+                       vlc_xcb_handle_t *, xcb_shm_seg_t);
 picture_t *XCB_picture_NewFromResource (const video_format_t *,
                                         const picture_resource_t *,
                                         xcb_connection_t *);
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 7117881..bfcb215 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -63,6 +63,7 @@ vlc_module_end ()
 
 struct vout_display_sys_t
 {
+    vlc_xcb_handle_t vx;
     xcb_connection_t *conn;
     vout_window_t *embed; /* VLC window */
 
@@ -113,15 +114,14 @@ static int Open (vlc_object_t *obj)
     sys->pool = NULL;
 
     /* Get window, connect to X server */
-    xcb_connection_t *conn;
     const xcb_screen_t *scr;
-    sys->embed = vlc_xcb_parent_Create(vd, &conn, &scr);
+    sys->embed = vlc_xcb_parent_Create(vd, &sys->vx, &scr);
     if (sys->embed == NULL)
     {
         free (sys);
         return VLC_EGENERIC;
     }
-    sys->conn = conn;
+    xcb_connection_t *conn = sys->conn = sys->vx.conn;
 
     const xcb_setup_t *setup = xcb_get_setup (conn);
 
@@ -282,13 +282,13 @@ found_format:;
         /* Create graphic context (I wonder why the heck do we need this) */
         xcb_create_gc (conn, sys->gc, sys->window, 0, NULL);
 
-        if (vlc_xcb_error_Check(vd, conn, "cannot create X11 window", c))
+        if (vlc_xcb_error_Check(vd, &sys->vx, "cannot create X11 window", c))
             goto error;
     }
     msg_Dbg (vd, "using X11 window %08"PRIx32, sys->window);
     msg_Dbg (vd, "using X11 graphic context %08"PRIx32, sys->gc);
 
-    sys->cursor = vlc_xcb_cursor_Create(conn, scr);
+    sys->cursor = vlc_xcb_cursor_Create(&sys->vx, scr);
     sys->visible = false;
     if (XCB_shm_Check (obj, conn))
     {
@@ -384,7 +384,7 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
     {
         xcb_shm_seg_t seg = (sys->seg_base != 0) ? (sys->seg_base + count) : 0;
 
-        if (XCB_picture_Alloc (vd, &res, size, sys->conn, seg))
+        if (XCB_picture_Alloc (vd, &res, size, &sys->vx, seg))
             break;
         pic_array[count] = XCB_picture_NewFromResource (&vd->fmt, &res,
                                                         sys->conn);
@@ -530,7 +530,7 @@ static void Manage (vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
 
-    vlc_xcb_Manage(vd, sys->conn, &sys->visible);
+    vlc_xcb_Manage(vd, &sys->vx, &sys->visible);
 }
 
 static void ResetPictures (vout_display_t *vd)
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index dde4f33..e847aa4 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -79,6 +79,7 @@ vlc_module_end ()
 
 struct vout_display_sys_t
 {
+    vlc_xcb_handle_t vx;
     xcb_connection_t *conn;
     vout_window_t *embed;/* VLC window */
 
@@ -369,16 +370,15 @@ static int Open (vlc_object_t *obj)
     vd->sys = p_sys;
 
     /* Connect to X */
-    xcb_connection_t *conn;
     const xcb_screen_t *screen;
-    p_sys->embed = vlc_xcb_parent_Create(vd, &conn, &screen);
+    p_sys->embed = vlc_xcb_parent_Create(vd, &p_sys->vx, &screen);
     if (p_sys->embed == NULL)
     {
         free (p_sys);
         return VLC_EGENERIC;
     }
 
-    p_sys->conn = conn;
+    xcb_connection_t *conn = p_sys->conn = p_sys->vx.conn;;
     p_sys->att = NULL;
     p_sys->pool = NULL;
 
@@ -495,7 +495,7 @@ static int Open (vlc_object_t *obj)
                  f->visual, mask, list);
             xcb_map_window (conn, p_sys->window);
 
-            if (!vlc_xcb_error_Check(vd, conn, "cannot create X11 window", c))
+            if (!vlc_xcb_error_Check(vd, &p_sys->vx, "cannot create X11 window", c))
             {
                 msg_Dbg (vd, "using X11 visual ID 0x%"PRIx32
                          " (depth: %"PRIu8")", f->visual, f->depth);
@@ -550,7 +550,7 @@ static int Open (vlc_object_t *obj)
     }
 
     /* Create cursor */
-    p_sys->cursor = vlc_xcb_cursor_Create(conn, screen);
+    p_sys->cursor = vlc_xcb_cursor_Create( &p_sys->vx, screen);
 
     p_sys->shm = XCB_shm_Check (obj, conn);
     p_sys->visible = false;
@@ -631,7 +631,7 @@ static void PoolAlloc (vout_display_t *vd, unsigned requested_count)
     {
         xcb_shm_seg_t seg = p_sys->shm ? xcb_generate_id (p_sys->conn) : 0;
 
-        if (XCB_picture_Alloc (vd, &res, p_sys->data_size, p_sys->conn, seg))
+        if (XCB_picture_Alloc (vd, &res, p_sys->data_size, &p_sys->vx, seg))
             break;
 
         /* Allocate further planes as specified by XVideo */
@@ -782,7 +782,7 @@ static void Manage (vout_display_t *vd)
 {
     vout_display_sys_t *p_sys = vd->sys;
 
-    vlc_xcb_Manage(vd, p_sys->conn, &p_sys->visible);
+    vlc_xcb_Manage(vd, &p_sys->vx, &p_sys->visible);
 }
 
 static int EnumAdaptors (vlc_object_t *obj, const char *var,
-- 
2.9.3



More information about the vlc-devel mailing list