From 2995c517c58043ad8d30f923fb53b2630f1d7266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 26 Jul 2012 23:53:05 -0400 Subject: [PATCH] gears: Keep gears inside screen in fullscreen mode --- clients/gears.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/clients/gears.c b/clients/gears.c index aee03572..a622cdaa 100644 --- a/clients/gears.c +++ b/clients/gears.c @@ -358,18 +358,23 @@ resize_handler(struct widget *widget, int32_t width, int32_t height, void *data) { struct gears *gears = data; + int32_t size, big, small; /* Constrain child size to be square and at least 300x300 */ - if (width > height) - height = width; - else - width = height; - if (width < 300) { - width = 300; - height = 300; + if (width < height) { + small = width; + big = height; + } else { + small = height; + big = width; } - widget_set_size(gears->widget, width, height); + if (gears->fullscreen) + size = small; + else + size = big; + + widget_set_size(gears->widget, size, size); } static void