]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
perhaps fix problems of being left in menus without being able to control openbox
[chaz/openbox] / openbox / client.c
index 375e18aa21c088daae9cc4058e0ef9a223135bbb..a17c73daaa43d92100a41c1dffa8d519457639a2 100644 (file)
@@ -1953,27 +1953,46 @@ void client_configure_full(ObClient *self, ObCorner anchor,
         h -= self->base_size.height;
 
         if (self->min_ratio)
-            if (h * self->min_ratio > w) h = (int)(w / self->min_ratio);
+            if (h * self->min_ratio > w) {
+                h = (int)(w / self->min_ratio);
+
+                /* you cannot resize to nothing */
+                if (h < 1) {
+                    h = 1;
+                    w = (int)(h * self->min_ratio);
+                }
+            }
         if (self->max_ratio)
-            if (h * self->max_ratio < w) h = (int)(w / self->max_ratio);
+            if (h * self->max_ratio < w) {
+                h = (int)(w / self->max_ratio);
+
+                /* you cannot resize to nothing */
+                if (h < 1) {
+                    h = 1;
+                    w = (int)(h * self->min_ratio);
+                }
+            }
 
         w += self->base_size.width;
         h += self->base_size.height;
     }
 
+    g_assert(w > 0);
+    g_assert(h > 0);
+
     switch (anchor) {
     case OB_CORNER_TOPLEFT:
-       break;
+        break;
     case OB_CORNER_TOPRIGHT:
-       x -= w - self->area.width;
-       break;
+        x -= w - self->area.width;
+        break;
     case OB_CORNER_BOTTOMLEFT:
-       y -= h - self->area.height;
-       break;
+        y -= h - self->area.height;
+        break;
     case OB_CORNER_BOTTOMRIGHT:
-       x -= w - self->area.width;
-       y -= h - self->area.height;
-       break;
+        x -= w - self->area.width;
+        y -= h - self->area.height;
+        break;
     }
 
     moved = x != self->area.x || y != self->area.y;
@@ -2674,8 +2693,6 @@ static ObClientIcon* client_icon_recursive(ObClient *self, int w, int h)
     /* li is the largest image < req */
     unsigned long size, smallest = 0xffffffff, largest = 0, si = 0, li = 0;
 
-    g_message("icons %d", self->nicons);
-
     if (!self->nicons) {
         ObClientIcon *parent = NULL;
 
@@ -2718,9 +2735,7 @@ const ObClientIcon* client_icon(ObClient *self, int w, int h)
     ObClientIcon *ret;
     static ObClientIcon deficon;
 
-    g_message("going for broke");
     if (!(ret = client_icon_recursive(self, w, h))) {
-        g_message("using default");
         deficon.width = deficon.height = 48;
         deficon.data = ob_rr_theme->def_win_icon;
         ret = &deficon;
This page took 0.028102 seconds and 4 git commands to generate.