diff options
author | Jakub Adam <jakub.adam@ktknet.cz> | 2016-04-21 08:45:40 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-04-26 11:13:01 +0300 |
commit | 59d7f9c62ee95dfbb5b450476f73a717e03b7b8c (patch) | |
tree | c611e92e4b3c38b46bb97d2b05ccd5546f09c07f /sys | |
parent | 7ba7c58f992be6ad1447b79e8798689c116cc9a5 (diff) | |
download | gst-plugins-base-59d7f9c62ee95dfbb5b450476f73a717e03b7b8c.tar.gz gst-plugins-base-59d7f9c62ee95dfbb5b450476f73a717e03b7b8c.tar.xz |
ximagesink: generate reconfigure on window handle change
When ximagesink is given a new window handle, it should check
its geometry and if the size of the new window differs from
the previous one, create reconfigure event in order to get
a chance to negotiate a more suitable image resolution with
the upstream elements.
We can't rely on receiving Expose or ConfigureNotify from
the X server for the newly assigned window, which would also
generate reconfigure.
https://bugzilla.gnome.org/show_bug.cgi?id=765424
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ximage/ximagesink.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index 88c1de157..e625989fd 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -1585,7 +1585,6 @@ gst_x_image_sink_set_window_handle (GstVideoOverlay * overlay, guintptr id) XID xwindow_id = id; GstXImageSink *ximagesink = GST_X_IMAGE_SINK (overlay); GstXWindow *xwindow = NULL; - XWindowAttributes attr; /* We acquire the stream lock while setting this window in the element. We are basically cleaning tons of stuff replacing the old window, putting @@ -1626,12 +1625,8 @@ gst_x_image_sink_set_window_handle (GstVideoOverlay * overlay, guintptr id) xwindow->win = xwindow_id; - /* We get window geometry, set the event we want to receive, - and create a GC */ + /* We set the events we want to receive and create a GC. */ g_mutex_lock (&ximagesink->x_lock); - XGetWindowAttributes (ximagesink->xcontext->disp, xwindow->win, &attr); - xwindow->width = attr.width; - xwindow->height = attr.height; xwindow->internal = FALSE; if (ximagesink->handle_events) { XSelectInput (ximagesink->xcontext->disp, xwindow->win, ExposureMask | @@ -1643,8 +1638,11 @@ gst_x_image_sink_set_window_handle (GstVideoOverlay * overlay, guintptr id) g_mutex_unlock (&ximagesink->x_lock); } - if (xwindow) + if (xwindow) { ximagesink->xwindow = xwindow; + /* Update the window geometry, possibly generating a reconfigure event. */ + gst_x_image_sink_xwindow_update_geometry(ximagesink); + } g_mutex_unlock (&ximagesink->flow_lock); } |