]> git.sur5r.net Git - i3/i3/blobdiff - src/handlers.c
Store aspect_ratio instead of weird proportional_{width,height} (Thanks phillip)
[i3/i3] / src / handlers.c
index fdc75abe604098816d16b8e36a77815d908e50f1..6be2a5b1f81ae0bfbbaab867c1a708956bc82e13 100644 (file)
@@ -799,22 +799,18 @@ static bool handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t stat
         goto render_and_return;
 
     /* Check if we need to set proportional_* variables using the correct ratio */
+    double aspect_ratio = 0.0;
     if ((width / height) < min_aspect) {
-        if (con->proportional_width != width ||
-            con->proportional_height != (width / min_aspect)) {
-            con->proportional_width = width;
-            con->proportional_height = width / min_aspect;
-            changed = true;
-        }
+        aspect_ratio = min_aspect;
     } else if ((width / height) > max_aspect) {
-        if (con->proportional_width != width ||
-            con->proportional_height != (width / max_aspect)) {
-            con->proportional_width = width;
-            con->proportional_height = width / max_aspect;
-            changed = true;
-        }
+        aspect_ratio = max_aspect;
     } else goto render_and_return;
 
+    if (fabs(con->aspect_ratio - aspect_ratio) > DBL_EPSILON) {
+        con->aspect_ratio = aspect_ratio;
+        changed = true;
+    }
+
 render_and_return:
     if (changed)
         tree_render();