]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Fix rounding problems when positioning proportional windows
authorMichael Stapelberg <michael+x200@stapelberg.de>
Sun, 15 Mar 2009 16:35:16 +0000 (17:35 +0100)
committerMichael Stapelberg <michael+x200@stapelberg.de>
Sun, 15 Mar 2009 16:35:16 +0000 (17:35 +0100)
Makefile
src/layout.c

index 8f7ab4a1fd8695e7a4a0ac826058fc03130247d6..fba5af6b30d657c1a712edbc3dd6052bb85e32b3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,7 @@ CFLAGS += -Wunused
 CFLAGS += -Iinclude
 CFLAGS += -I/usr/local/include
 
+LDFLAGS += -lm
 LDFLAGS += -lxcb-wm
 #LDFLAGS += -lxcb-keysyms
 LDFLAGS += -lxcb-xinerama
index 1d4d3ddb963fc2b460060ca3036258aaef9e3666..9d9a0927c7d0f94647800417846749c54b8bc3dd 100644 (file)
@@ -15,6 +15,7 @@
 #include <stdlib.h>
 #include <xcb/xcb.h>
 #include <assert.h>
+#include <math.h>
 
 #include "config.h"
 #include "i3.h"
@@ -248,8 +249,8 @@ static void resize_client(xcb_connection_t *conn, Client *client) {
                                 new_width--;
                 }
                 /* Center the window */
-                rect->y += (rect->height / 2) - (new_height / 2);
-                rect->x += (rect->width / 2) - (new_width / 2);
+                rect->y += ceil(rect->height / 2) - floor(new_height / 2);
+                rect->x += ceil(rect->width / 2) - floor(new_width / 2);
 
                 rect->height = new_height;
                 rect->width = new_width;