gstglwindow_x11: fix resize

This patch was taken from #629#note_178766, the comment made
at the time was:

The root issue is a mismatch between the initialization of render_rect
in GstGLWindowX11Private and what's expected in the draw_cb function.
Because render_rect is not explicitly initialized to a width and height
of -1 (unlike gstglwindow_wayland_egl.c which does initialize to -1),
the less-than check for explicitly-set render_rect at gstglwindow_x11.c:453-454
always fails, even when the parent_win has been set and the render rectangle
has never been set.

Maybe this came from copying the similar check in the wayland code? Regardless,
I think the correct inequality should be '<= 0' (on both lines).

Alternatively initialization could be changed, but other sinks, e.g.
xvimagesink don't appear to use -1 to mean "unset" render_rect this way.

The issue can be reproduced by running the example in
tests/examples/gl/qt/videooverlay/ on X11, and resizing the output
window

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/701>
This commit is contained in:
David Bender 2020-06-12 00:21:56 +02:00 committed by GStreamer Merge Bot
parent a90968997a
commit b4bdb75a80

View file

@ -450,8 +450,8 @@ draw_cb (gpointer data)
GST_TRACE_OBJECT (window, "window size %ux%u", attr.width, attr.height);
if (window_x11->parent_win &&
(window_x11->priv->render_rect.w < 0 ||
window_x11->priv->render_rect.h < 0)) {
(window_x11->priv->render_rect.w <= 0 ||
window_x11->priv->render_rect.h <= 0)) {
XWindowAttributes attr_parent;
XGetWindowAttributes (window_x11->device, window_x11->parent_win,
&attr_parent);