[vlc-devel] [PATCH 1/4] vout_window: also store the X11 Display pointer

Thomas Guillem thomas at gllm.fr
Wed Jun 21 10:21:01 CEST 2017


---
 include/vlc_vout_window.h                       | 5 ++++-
 modules/gui/qt/components/interface_widgets.cpp | 3 ++-
 modules/gui/skins2/src/skin_main.cpp            | 3 ++-
 modules/gui/skins2/src/vout_window.cpp          | 3 ++-
 modules/hw/vdpau/display.c                      | 2 +-
 modules/video_output/glx.c                      | 2 +-
 modules/video_output/opengl/egl.c               | 2 +-
 modules/video_output/xcb/events.c               | 2 +-
 modules/video_output/xcb/window.c               | 7 ++++---
 9 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
index 69a719bd2a..698df970d1 100644
--- a/include/vlc_vout_window.h
+++ b/include/vlc_vout_window.h
@@ -137,7 +137,10 @@ struct vout_window_t {
 
     /* display server (mandatory) */
     union {
-        char     *x11; /* X11 display (NULL = use default) */
+        struct {
+            char *name; /* X11 display name (NULL = use default) */
+            void *dpy;  /* (Display created by XOpenDisplay() or NULL) */
+        } x11;
         struct wl_display *wl;   /* Wayland struct wl_display pointer */
     } display;
 
diff --git a/modules/gui/qt/components/interface_widgets.cpp b/modules/gui/qt/components/interface_widgets.cpp
index d483461cb5..e362ab6eda 100644
--- a/modules/gui/qt/components/interface_widgets.cpp
+++ b/modules/gui/qt/components/interface_widgets.cpp
@@ -152,7 +152,8 @@ bool VideoWidget::request( struct vout_window_t *p_wnd )
     {
         case VOUT_WINDOW_TYPE_XID:
             p_wnd->handle.xid = stable->winId();
-            p_wnd->display.x11 = NULL;
+            p_wnd->display.x11.name = NULL;
+            p_wnd->display.x11.dpy = NULL;
             break;
         case VOUT_WINDOW_TYPE_HWND:
             p_wnd->handle.hwnd = (void *)stable->winId();
diff --git a/modules/gui/skins2/src/skin_main.cpp b/modules/gui/skins2/src/skin_main.cpp
index cc93d603ce..2bd1fb3ef9 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -395,7 +395,8 @@ static int WindowOpen( vout_window_t *pWnd, const vout_window_cfg_t *cfg )
     CmdExecuteBlock::executeWait( CmdGenericPtr( cmd ) );
 
 #ifdef X11_SKINS
-    pWnd->display.x11 = NULL;
+    pWnd->display.x11.name = NULL;
+    pWnd->display.x11.dpy = NULL;
 
     if( !pWnd->handle.xid )
 #else
diff --git a/modules/gui/skins2/src/vout_window.cpp b/modules/gui/skins2/src/vout_window.cpp
index 9c2bd2d971..64a452c9ca 100644
--- a/modules/gui/skins2/src/vout_window.cpp
+++ b/modules/gui/skins2/src/vout_window.cpp
@@ -46,7 +46,8 @@ VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd,
 
 #ifdef X11_SKINS
         m_pWnd->handle.xid = getOSHandle();
-        m_pWnd->display.x11 = NULL;
+        m_pWnd->display.x11.name = NULL;
+        m_pWnd->display.x11.dpy = NULL;
 #else
         m_pWnd->handle.hwnd = getOSHandle();
 #endif
diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index a92ac742e5..c9f5208e13 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -434,7 +434,7 @@ static int Open(vlc_object_t *obj)
     }
 
     /* Load the VDPAU back-end and create a device instance */
-    VdpStatus err = vdp_get_x11(sys->embed->display.x11,
+    VdpStatus err = vdp_get_x11(sys->embed->display.x11.name,
                                 xcb_screen_num(sys->conn, screen),
                                 &sys->vdp, &sys->device);
     if (err != VDP_STATUS_OK)
diff --git a/modules/video_output/glx.c b/modules/video_output/glx.c
index dc692e9a59..0f76cd405d 100644
--- a/modules/video_output/glx.c
+++ b/modules/video_output/glx.c
@@ -121,7 +121,7 @@ static int Open (vlc_object_t *obj)
         return VLC_EGENERIC;
 
     /* Initialize GLX display */
-    Display *dpy = XOpenDisplay (gl->surface->display.x11);
+    Display *dpy = XOpenDisplay (gl->surface->display.x11.name);
     if (dpy == NULL)
         return VLC_EGENERIC;
 
diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c
index 22cf3545c9..ffa363cb68 100644
--- a/modules/video_output/opengl/egl.c
+++ b/modules/video_output/opengl/egl.c
@@ -224,7 +224,7 @@ static int Open (vlc_object_t *obj, const struct gl_api *api)
         goto error;
 
     window = &wnd->handle.xid;
-    sys->x11 = XOpenDisplay(wnd->display.x11);
+    sys->x11 = XOpenDisplay(wnd->display.x11.name);
     if (sys->x11 == NULL)
         goto error;
 
diff --git a/modules/video_output/xcb/events.c b/modules/video_output/xcb/events.c
index 1b53f2b66a..a68ba4cd25 100644
--- a/modules/video_output/xcb/events.c
+++ b/modules/video_output/xcb/events.c
@@ -110,7 +110,7 @@ vout_window_t *vlc_xcb_parent_Create(vout_display_t *vd,
         return NULL;
     }
 
-    xcb_connection_t *conn = Connect (VLC_OBJECT(vd), wnd->display.x11);
+    xcb_connection_t *conn = Connect (VLC_OBJECT(vd), wnd->display.x11.name);
     if (conn == NULL)
         goto error;
     *pconn = conn;
diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index bf291aa1e5..68d8a238a1 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -411,7 +411,7 @@ static int Open (vout_window_t *wnd, const vout_window_cfg_t *cfg)
 
     wnd->type = VOUT_WINDOW_TYPE_XID;
     wnd->handle.xid = window;
-    wnd->display.x11 = display;
+    wnd->display.x11.name = display;
     wnd->control = Control;
     wnd->sys = p_sys;
 
@@ -524,7 +524,7 @@ static void Close (vout_window_t *wnd)
         XCB_keyHandler_Destroy (p_sys->keys);
 
     xcb_disconnect (conn);
-    free (wnd->display.x11);
+    free (wnd->display.x11.name);
     free (p_sys);
 }
 
@@ -627,7 +627,8 @@ static int EmOpen (vout_window_t *wnd, const vout_window_cfg_t *cfg)
 
     p_sys->embedded = true;
     wnd->type = VOUT_WINDOW_TYPE_XID;
-    wnd->display.x11 = NULL;
+    wnd->display.x11.name = NULL;
+    wnd->display.x11.dpy = NULL;
     wnd->handle.xid = window;
     wnd->control = Control;
     wnd->sys = p_sys;
-- 
2.11.0



More information about the vlc-devel mailing list