Bugfix: Correctly reconfigure clients when it’s necessary
This commit is contained in:
parent
327a53c849
commit
4ad7f8fb1a
18
src/layout.c
18
src/layout.c
|
@ -193,23 +193,25 @@ void render_container(xcb_connection_t *connection, Container *container) {
|
||||||
num_clients++;
|
num_clients++;
|
||||||
|
|
||||||
if (container->mode == MODE_DEFAULT) {
|
if (container->mode == MODE_DEFAULT) {
|
||||||
|
/* This macro copies the old value of the given variable, changes the variable to contain
|
||||||
|
th new one and returns true if it changed */
|
||||||
|
#define HAS_CHANGED(value, new) (old_value = value, old_value != (value = new))
|
||||||
|
|
||||||
printf("got %d clients in this default container.\n", num_clients);
|
printf("got %d clients in this default container.\n", num_clients);
|
||||||
CIRCLEQ_FOREACH(client, &(container->clients), clients) {
|
CIRCLEQ_FOREACH(client, &(container->clients), clients) {
|
||||||
/* Check if we changed client->x or client->y by updating it.
|
/* Check if we changed client->x or client->y by updating it.
|
||||||
* Note the bitwise OR instead of logical OR to force evaluation of both statements */
|
* Note the bitwise OR instead of logical OR to force evaluation of both statements */
|
||||||
|
int old_value;
|
||||||
if (client->force_reconfigure |
|
if (client->force_reconfigure |
|
||||||
(client->rect.x != (client->rect.x = container->x)) |
|
HAS_CHANGED(client->rect.x, container->x) |
|
||||||
(client->rect.y != (client->rect.y = container->y +
|
HAS_CHANGED(client->rect.y, container->y +
|
||||||
(container->height / num_clients) * current_client))) {
|
(container->height / num_clients) * current_client))
|
||||||
reposition_client(connection, client);
|
reposition_client(connection, client);
|
||||||
}
|
|
||||||
|
|
||||||
printf("before client->rect.width = %d, client->rect.height = %d\n", client->rect.width,
|
|
||||||
client->rect.height);
|
|
||||||
/* TODO: vertical default layout */
|
/* TODO: vertical default layout */
|
||||||
if (client->force_reconfigure |
|
if (client->force_reconfigure |
|
||||||
(client->rect.width != (client->rect.width = container->width)) |
|
HAS_CHANGED(client->rect.width, container->width) |
|
||||||
(client->rect.height != (client->rect.height = container->height / num_clients))) {
|
HAS_CHANGED(client->rect.height, container->height / num_clients)) {
|
||||||
resize_client(connection, client);
|
resize_client(connection, client);
|
||||||
} else printf("no reconfigure necessary\n");
|
} else printf("no reconfigure necessary\n");
|
||||||
printf("after client->rect.width = %d, client->rect.height = %d\n", client->rect.width,
|
printf("after client->rect.width = %d, client->rect.height = %d\n", client->rect.width,
|
||||||
|
|
Loading…
Reference in New Issue