From a610e02057f5713f42cd23ddf886c7e282d08bc9 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Tue, 2 Oct 2012 13:24:18 +0200 Subject: [PATCH] wlt: toolkit: allow zero values as new size If zero is passed as new size, we now simply use the current size. This allows widgets to schedule a resize round without having to specify the current size explicitely. Signed-off-by: David Herrmann --- src/wlt_toolkit.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wlt_toolkit.c b/src/wlt_toolkit.c index 112dcd0..b2010aa 100644 --- a/src/wlt_toolkit.c +++ b/src/wlt_toolkit.c @@ -1031,7 +1031,12 @@ static int resize_window(struct wlt_window *wnd, unsigned int width, int ret; unsigned int oldw, oldh, neww, newh, minw, minh, flags; - if (!wnd || !width || !height) + if (!width) + width = wnd->buffer.width; + if (!height) + height = wnd->buffer.height; + + if (!width || !height) return -EINVAL; flags = 0; @@ -1466,7 +1471,7 @@ void wlt_window_resize(struct wlt_window *wnd, uint32_t edges) int wlt_window_set_size(struct wlt_window *wnd, unsigned int width, unsigned int height) { - if (!wnd || !width || !height) + if (!wnd) return -EINVAL; wnd->new_width = width;