clients: Implement minimum size for toy toolkit clients
We default to setting the minimum size to the initial size. To set a
different minimum size than the initial size, set the minimum size first
then then initial size. Good enough for a toy toolkit.
https://bugs.freedesktop.org/show_bug.cgi?id=50263
diff --git a/clients/window.c b/clients/window.c
index 93299e1..ddad36e 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -135,6 +135,7 @@
struct wl_region *opaque_region;
char *title;
struct rectangle allocation, saved_allocation, server_allocation;
+ struct rectangle min_allocation;
struct rectangle pending_allocation;
int x, y;
int resize_edges;
@@ -2614,6 +2615,13 @@
window->pending_allocation.width = width;
window->pending_allocation.height = height;
+ if (window->min_allocation.width == 0)
+ window->min_allocation = window->pending_allocation;
+ 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)
+ window->pending_allocation.height = window->min_allocation.height;
+
window->resize_needed = 1;
window_schedule_redraw(window);
}