[weston v2 5/8] xwm: Make sure we respect the window's size hints

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Mon Nov 13 21:20:53 UTC 2017


Don't just ignore the minimal and maximal sizes requested
by the application.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
---
 xwayland/window-manager.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 3cc6fa24..a0ff6b62 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -2801,6 +2801,20 @@ send_configure(struct weston_surface *surface, int32_t width, int32_t height)
 	else
 		new_height = 1;
 
+	/* Make sure we respect the window's size hints */
+	if (window->size_hints.min_width > 0 &&
+	    new_width < window->size_hints.min_width)
+		new_width = window->size_hints.min_width;
+	if (window->size_hints.min_height > 0 &&
+	    new_height < window->size_hints.min_height)
+		new_height = window->size_hints.min_height;
+	if (window->size_hints.max_width > 0 &&
+	    new_width > window->size_hints.max_width)
+		new_width = window->size_hints.max_width;
+	if (window->size_hints.max_height > 0 &&
+	    new_height > window->size_hints.max_height)
+		new_height = window->size_hints.max_height;
+
 	if (window->width == new_width && window->height == new_height)
 		return;
 
-- 
2.13.0



More information about the wayland-devel mailing list