]> git.sur5r.net Git - i3/i3/commitdiff
x: only re-render the tree in handle_normal_hints when they actually changed
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 29 May 2011 09:46:01 +0000 (11:46 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 29 May 2011 09:46:01 +0000 (11:46 +0200)
src/handlers.c

index b87bb4181590b0c199a4c8944a385079bc379230..aceb5b7028479b22fb932fe31a54fdf48a689d83 100644 (file)
@@ -739,6 +739,7 @@ static int handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t state
         con->base_height = base_height;
         DLOG("client's base_height changed to %d\n", base_height);
         DLOG("client's base_width changed to %d\n", base_width);
+        changed = true;
     }
 
     /* If no aspect ratio was set or if it was invalid, we ignore the hints */
@@ -764,15 +765,24 @@ static int handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t state
 
     /* Check if we need to set proportional_* variables using the correct ratio */
     if ((width / height) < min_aspect) {
-        con->proportional_width = width;
-        con->proportional_height = width / 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;
+        }
     } else if ((width / height) > max_aspect) {
-        con->proportional_width = width;
-        con->proportional_height = width / 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;
+        }
     } else goto render_and_return;
 
 render_and_return:
-    tree_render();
+    if (changed)
+        tree_render();
     return 1;
 }