Commit cb01fbfc authored by Sebastian Dröge's avatar Sebastian Dröge 🍵
Browse files

Revert "gl/window/x11: don't create our own X11 display"

This reverts commit 5697b6b8.

https://bugzilla.gnome.org/show_bug.cgi?id=751003
parent ad579b73
...@@ -149,7 +149,8 @@ gst_gl_window_x11_open (GstGLWindow * window, GError ** error) ...@@ -149,7 +149,8 @@ gst_gl_window_x11_open (GstGLWindow * window, GError ** error)
GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window); GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
GstGLDisplayX11 *display_x11 = (GstGLDisplayX11 *) window->display; GstGLDisplayX11 *display_x11 = (GstGLDisplayX11 *) window->display;
window_x11->device = display_x11->display; window_x11->device = XOpenDisplay (display_x11->name);
// window_x11->device = display_x11->display;
if (window_x11->device == NULL) { if (window_x11->device == NULL) {
g_set_error (error, GST_GL_WINDOW_ERROR, g_set_error (error, GST_GL_WINDOW_ERROR,
GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE, GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE,
...@@ -157,6 +158,8 @@ gst_gl_window_x11_open (GstGLWindow * window, GError ** error) ...@@ -157,6 +158,8 @@ gst_gl_window_x11_open (GstGLWindow * window, GError ** error)
goto failure; goto failure;
} }
XSynchronize (window_x11->device, FALSE);
GST_LOG ("gl device id: %ld", (gulong) window_x11->device); GST_LOG ("gl device id: %ld", (gulong) window_x11->device);
window_x11->screen = DefaultScreenOfDisplay (window_x11->device); window_x11->screen = DefaultScreenOfDisplay (window_x11->device);
...@@ -272,8 +275,13 @@ void ...@@ -272,8 +275,13 @@ void
gst_gl_window_x11_close (GstGLWindow * window) gst_gl_window_x11_close (GstGLWindow * window)
{ {
GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window); GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
GstGLDisplay *display = window->display;
XEvent event;
if (window_x11->device) { if (window_x11->device) {
/* Avoid BadDrawable Errors... */
if (gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_X11)
XSync (GST_GL_DISPLAY_X11 (display)->display, FALSE);
if (window_x11->internal_win_id) if (window_x11->internal_win_id)
XUnmapWindow (window_x11->device, window_x11->internal_win_id); XUnmapWindow (window_x11->device, window_x11->internal_win_id);
...@@ -285,7 +293,12 @@ gst_gl_window_x11_close (GstGLWindow * window) ...@@ -285,7 +293,12 @@ gst_gl_window_x11_close (GstGLWindow * window)
window_x11->root, 0, 0); window_x11->root, 0, 0);
XDestroyWindow (window_x11->device, window_x11->internal_win_id); XDestroyWindow (window_x11->device, window_x11->internal_win_id);
} }
XSync (window_x11->device, FALSE);
while (XPending (window_x11->device))
XNextEvent (window_x11->device, &event);
XCloseDisplay (window_x11->device);
GST_DEBUG ("display receiver closed"); GST_DEBUG ("display receiver closed");
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment