From: Michael Stapelberg Date: Sun, 15 Mar 2009 16:35:16 +0000 (+0100) Subject: Bugfix: Fix rounding problems when positioning proportional windows X-Git-Tag: 3.a~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=76effaf29a8fc33c02afa4f2b74b99d6355b1597;p=i3%2Fi3 Bugfix: Fix rounding problems when positioning proportional windows --- diff --git a/Makefile b/Makefile index 8f7ab4a1..fba5af6b 100644 --- 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 diff --git a/src/layout.c b/src/layout.c index 1d4d3ddb..9d9a0927 100644 --- a/src/layout.c +++ b/src/layout.c @@ -15,6 +15,7 @@ #include #include #include +#include #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;