From 8b34eb5fc283bfa86be4e4a0bf6249eee28affab Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 4 Mar 2009 22:41:04 +0100 Subject: [PATCH] Bugfix: Reconfigure all clients in stacking, correctly ignore events, event when for the root window --- src/handlers.c | 9 +++++++-- src/layout.c | 31 ++++++++++++++++--------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/handlers.c b/src/handlers.c index 22140e9e..4c9a6584 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -338,6 +338,7 @@ int handle_map_notify_event(void *prophs, xcb_connection_t *conn, xcb_map_notify window_attributes_t wa = { TAG_VALUE }; wa.u.override_redirect = event->override_redirect; printf("MapNotify for 0x%08x, serial is %d.\n", event->window, event->sequence); + printf("setting ignore_notify_event = %d\n", event->sequence); ignore_notify_event = event->sequence; manage_window(prophs, conn, event->window, wa); return 1; @@ -353,14 +354,16 @@ int handle_configure_event(void *prophs, xcb_connection_t *conn, xcb_configure_n printf("handle_configure_event\n"); printf("event->x = %d, ->y = %d, ->width = %d, ->height = %d\n", event->x, event->y, event->width, event->height); + printf("sequence = %d\n", event->sequence); + + ignore_notify_event = event->sequence; + if (event->event == root) { printf("reconfigure of the root window, need to xinerama\n"); xinerama_requery_screens(conn); return 1; } - ignore_notify_event = event->sequence; - Client *client = table_get(byChild, event->window); if (client == NULL) { printf("client not managed, ignoring\n"); @@ -395,6 +398,8 @@ int handle_configure_event(void *prophs, xcb_connection_t *conn, xcb_configure_n int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_notify_event_t *event) { xcb_window_t root = xcb_setup_roots_iterator(xcb_get_setup(conn)).data->root; + printf("setting ignore_notify_event = %d\n", event->sequence); + ignore_notify_event = event->sequence; Client *client = table_get(byChild, event->window); diff --git a/src/layout.c b/src/layout.c index 7be9bde0..ac3ee361 100644 --- a/src/layout.c +++ b/src/layout.c @@ -304,29 +304,30 @@ void render_container(xcb_connection_t *conn, Container *container) { /* Reconfigure the currently focused client, if necessary. It is the only visible one */ client = container->currently_focused; - /* 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 */ - if (client->force_reconfigure | - HAS_CHANGED(old_value_1, client->rect.x, container->x) | - HAS_CHANGED(old_value_2, client->rect.y, container->y + (decoration_height * num_clients))) - reposition_client(conn, client); - - if (client->force_reconfigure | - HAS_CHANGED(old_value_1, client->rect.width, container->width) | - HAS_CHANGED(old_value_2, client->rect.height, container->height - (decoration_height * num_clients))) - resize_client(conn, client); - - client->force_reconfigure = false; - if (container->workspace->fullscreen_client == NULL) { uint32_t values[] = { XCB_STACK_MODE_ABOVE }; xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_STACK_MODE, values); } /* Render the decorations of all 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. + * Note the bitwise OR instead of logical OR to force evaluation of both statements */ + if (client->force_reconfigure | + HAS_CHANGED(old_value_1, client->rect.x, container->x) | + HAS_CHANGED(old_value_2, client->rect.y, container->y + (decoration_height * num_clients))) + reposition_client(conn, client); + + if (client->force_reconfigure | + HAS_CHANGED(old_value_1, client->rect.width, container->width) | + HAS_CHANGED(old_value_2, client->rect.height, container->height - (decoration_height * num_clients))) + resize_client(conn, client); + + client->force_reconfigure = false; + decorate_window(conn, client, stack_win->window, stack_win->gc, current_client++ * decoration_height); + } } }