gl/window/x11: only listen on the X Display when needed

5697b6b89b causes us to possibly listen
on a toolkit provided Display connection.  We thus could eat their
precious winsys events.  Only listen if we need to
(!foreign_display or videooverlay).
This commit is contained in:
Matthew Waters 2015-06-12 13:14:57 +10:00
parent adce0220a8
commit ea4867dfa7

View file

@ -175,13 +175,14 @@ gst_gl_window_x11_open (GstGLWindow * window, GError ** error)
window_x11->device_height =
DisplayHeight (window_x11->device, window_x11->screen_num);
window_x11->x11_source = x11_event_source_new (window_x11);
if (!GST_GL_WINDOW_CLASS (parent_class)->open (window, error))
return FALSE;
g_source_attach (window_x11->x11_source,
g_main_context_get_thread_default ());
if (!display_x11->foreign_display) {
window_x11->x11_source = x11_event_source_new (window_x11);
g_source_attach (window_x11->x11_source,
g_main_context_get_thread_default ());
}
window_x11->allow_extra_expose_events = TRUE;
@ -288,9 +289,11 @@ gst_gl_window_x11_close (GstGLWindow * window)
GST_DEBUG ("display receiver closed");
}
g_source_destroy (window_x11->x11_source);
g_source_unref (window_x11->x11_source);
window_x11->x11_source = NULL;
if (window_x11->x11_source) {
g_source_destroy (window_x11->x11_source);
g_source_unref (window_x11->x11_source);
window_x11->x11_source = NULL;
}
window_x11->running = FALSE;
@ -308,6 +311,14 @@ gst_gl_window_x11_set_window_handle (GstGLWindow * window, guintptr id)
window_x11->parent_win = (Window) id;
/* XXX: seems to be needed for the difference between gtk videooverlay and
* the embedding gl into gtk directly */
if (id && !window_x11->x11_source) {
window_x11->x11_source = x11_event_source_new (window_x11);
g_source_attach (window_x11->x11_source,
g_main_context_get_thread_default ());
}
XGetWindowAttributes (window_x11->device, window_x11->parent_win, &attr);
XResizeWindow (window_x11->device, window_x11->internal_win_id,