From 53ec5604231b3eefe009111682b0c12ea5254d4a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 21 Oct 2013 15:05:49 -0700 Subject: [PATCH] window: Set a minimum size for toytoolkit windows The decorations tiles start to overlap and look weird if we go below 200x200 size windows. Just set that as a minimum size if the app doesn't provide a bigger minimum size. https://bugs.freedesktop.org/show_bug.cgi?id=66794 --- clients/window.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/clients/window.c b/clients/window.c index 3885873..e7c54d2 100644 --- a/clients/window.c +++ b/clients/window.c @@ -3732,13 +3732,25 @@ idle_resize(struct window *window) void window_schedule_resize(struct window *window, int width, int height) { + /* We should probably get these numbers from the theme. */ + const int min_width = 200, min_height = 200; + window->pending_allocation.x = 0; window->pending_allocation.y = 0; window->pending_allocation.width = width; window->pending_allocation.height = height; - if (window->min_allocation.width == 0) - window->min_allocation = window->pending_allocation; + if (window->min_allocation.width == 0) { + if (width < min_width) + window->min_allocation.width = min_width; + else + window->min_allocation.width = width; + if (height < min_height) + window->min_allocation.height = min_height; + else + window->min_allocation.height = width; + } + if (window->pending_allocation.width < window->min_allocation.width) window->pending_allocation.width = window->min_allocation.width; if (window->pending_allocation.height < window->min_allocation.height) -- 2.7.4