Bugfix: Don’t mess up x/y coordinates in configurerequests for floating windows

This was the cause for ticket #93, which actually has a false
conclusion for the reason of this bug.

This code needs to be refactored.
This commit is contained in:
Michael Stapelberg
2010-03-11 23:34:29 +01:00
parent e11ca75407
commit 93a9f3c244
2 changed files with 32 additions and 5 deletions

View File

@ -365,11 +365,31 @@ int handle_configure_request(void *prophs, xcb_connection_t *conn, xcb_configure
if (client_is_floating(client)) {
i3Font *font = load_font(conn, config.font);
int mode = (client->container != NULL ? client->container->mode : MODE_DEFAULT);
/* TODO: refactor this code. we need a function to translate
* coordinates of child_rect/rect. */
if (event->value_mask & XCB_CONFIG_WINDOW_X)
client->rect.x = event->x;
if (event->value_mask & XCB_CONFIG_WINDOW_Y)
client->rect.y = event->y;
if (event->value_mask & XCB_CONFIG_WINDOW_X) {
if (mode == MODE_STACK || mode == MODE_TABBED) {
client->rect.x = event->x - 2;
} else {
if (client->titlebar_position == TITLEBAR_OFF && client->borderless)
client->rect.x = event->x;
else if (client->titlebar_position == TITLEBAR_OFF && !client->borderless)
client->rect.x = event->x - 1;
else client->rect.x = event->x - 2;
}
}
if (event->value_mask & XCB_CONFIG_WINDOW_Y) {
if (mode == MODE_STACK || mode == MODE_TABBED) {
client->rect.y = event->y - 2;
} else {
if (client->titlebar_position == TITLEBAR_OFF && client->borderless)
client->rect.y = event->y;
else if (client->titlebar_position == TITLEBAR_OFF && !client->borderless)
client->rect.y = event->y - 1;
else client->rect.y = event->y - font->height - 2 - 2;
}
}
if (event->value_mask & XCB_CONFIG_WINDOW_WIDTH) {
if (mode == MODE_STACK || mode == MODE_TABBED) {
client->rect.width = event->width + 2 + 2;