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/terminal.c b/clients/terminal.c
index a726232..7e7a9fb 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -695,10 +695,6 @@
struct rectangle allocation;
struct winsize ws;
- if (width < 1)
- width = 1;
- if (height < 1)
- height = 1;
if (terminal->width == width && terminal->height == height)
return;
@@ -764,12 +760,6 @@
struct terminal *terminal = data;
int32_t columns, rows, m;
- if (width < 200)
- width = 200;
-
- if (height < 50)
- height = 50;
-
m = 2 * terminal->margin;
columns = (width - m) / (int32_t) terminal->extents.max_x_advance;
rows = (height - m) / (int32_t) terminal->extents.height;
@@ -2492,6 +2482,7 @@
cairo_destroy(cr);
cairo_surface_destroy(surface);
+ terminal_resize(terminal, 20, 5); /* Set minimum size first */
terminal_resize(terminal, 80, 25);
wl_list_insert(terminal_list.prev, &terminal->link);