1From cccbc3856787adac05756f76a825ccdaea5fa3aa Mon Sep 17 00:00:00 2001 2From: Jeffy Chen <jeffy.chen@rock-chips.com> 3Date: Thu, 4 May 2023 17:52:33 +0800 4Subject: [PATCH 18/20] gl: x11: Honor render-rectangle for toplevel window 5 6Tested on RK3588 evb with: 7gst-launch-1.0 videotestsrc ! glimagesink render-rectangle='<100,200,300,400>' 8 9Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 10--- 11 gst-libs/gst/gl/x11/gstglwindow_x11.c | 13 +++++++++++++ 12 1 file changed, 13 insertions(+) 13 14diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c 15index 7ee1ded..6d2293e 100644 16--- a/gst-libs/gst/gl/x11/gstglwindow_x11.c 17+++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c 18@@ -229,6 +229,13 @@ gst_gl_window_x11_create_window (GstGLWindowX11 * window_x11) 19 window_x11->visual_info->depth, InputOutput, 20 window_x11->visual_info->visual, mask, &win_attr); 21 22+ /* Set USPosition for toplevel window */ 23+ if (!window_x11->parent_win) { 24+ XSizeHints hints = {0}; 25+ hints.flags = USPosition; 26+ XSetWMNormalHints (window_x11->device, window_x11->internal_win_id, &hints); 27+ } 28+ 29 gst_gl_window_x11_handle_events (GST_GL_WINDOW (window_x11), 30 window_x11->priv->handle_events); 31 32@@ -408,6 +415,12 @@ _show_window (GstGLWindow * window) 33 guint width = window_x11->priv->preferred_width; 34 guint height = window_x11->priv->preferred_height; 35 36+ if (window_x11->priv->render_rect.w > 0 && 37+ window_x11->priv->render_rect.h > 0) { 38+ width = window_x11->priv->render_rect.w; 39+ height = window_x11->priv->render_rect.h; 40+ } 41+ 42 if (!window_x11->visible) { 43 if (!window_x11->parent_win) { 44 XResizeWindow (window_x11->device, window_x11->internal_win_id, 45-- 462.20.1 47 48