From: Matthew Waters Date: Fri, 12 Jun 2015 03:14:57 +0000 (+1000) Subject: gl/window/x11: only listen on the X Display when needed X-Git-Tag: 1.19.3~511^2~1989^2~793 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=99009284033dc97f2bd90f7fe5a3e412977bcbe6;p=platform%2Fupstream%2Fgstreamer.git gl/window/x11: only listen on the X Display when needed 5697b6b89b4b2a15c45bd47be940a17f4412ea11 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). --- diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c index 6291224..f20c777 100644 --- a/gst-libs/gst/gl/x11/gstglwindow_x11.c +++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c @@ -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,