Bugfix: Fix rounding problems when positioning proportional windows

next
Michael Stapelberg 2009-03-15 17:35:16 +01:00
parent c02dd93bcc
commit 76effaf29a
2 changed files with 4 additions and 2 deletions

View File

@ -10,6 +10,7 @@ CFLAGS += -Wunused
CFLAGS += -Iinclude
CFLAGS += -I/usr/local/include
LDFLAGS += -lm
LDFLAGS += -lxcb-wm
#LDFLAGS += -lxcb-keysyms
LDFLAGS += -lxcb-xinerama

View 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;