summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-06-23 16:46:39 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-06-23 16:46:39 +0200
commitcb01fbfc2743fefbaafcaab60f3f7e66de9d379c (patch)
tree238c0916b6e8ebfe4df85025df627e2b2ff8e122
parentad579b73e669a39b1be7584064a9b792667b3269 (diff)
Revert "gl/window/x11: don't create our own X11 display"
This reverts commit 5697b6b89b4b2a15c45bd47be940a17f4412ea11. https://bugzilla.gnome.org/show_bug.cgi?id=751003
-rw-r--r--gst-libs/gst/gl/x11/gstglwindow_x11.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c
index f20c777ad..5782eeaca 100644
--- a/gst-libs/gst/gl/x11/gstglwindow_x11.c
+++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c
@@ -149,7 +149,8 @@ gst_gl_window_x11_open (GstGLWindow * window, GError ** error)
GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
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) {
g_set_error (error, GST_GL_WINDOW_ERROR,
GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE,
@@ -157,6 +158,8 @@ gst_gl_window_x11_open (GstGLWindow * window, GError ** error)
goto failure;
}
+ XSynchronize (window_x11->device, FALSE);
+
GST_LOG ("gl device id: %ld", (gulong) window_x11->device);
window_x11->screen = DefaultScreenOfDisplay (window_x11->device);
@@ -272,8 +275,13 @@ void
gst_gl_window_x11_close (GstGLWindow * window)
{
GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
+ GstGLDisplay *display = window->display;
+ XEvent event;
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)
XUnmapWindow (window_x11->device, window_x11->internal_win_id);
@@ -285,7 +293,12 @@ gst_gl_window_x11_close (GstGLWindow * window)
window_x11->root, 0, 0);
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");
}