gears: Keep gears inside screen in fullscreen mode
authorKristian Høgsberg <krh@bitplanet.net>
Fri, 27 Jul 2012 03:53:05 +0000 (23:53 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 27 Jul 2012 03:53:05 +0000 (23:53 -0400)
clients/gears.c

index aee0357..a622cda 100644 (file)
@@ -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