diff --git a/awesome.c b/awesome.c index d621c947d..1cd338274 100644 --- a/awesome.c +++ b/awesome.c @@ -156,7 +156,7 @@ scan(void) state = window_state_get_reply(state_wins[i]); if(!attr_r || attr_r->override_redirect - || attr_r->map_state != XCB_MAP_STATE_VIEWABLE + || attr_r->map_state == XCB_MAP_STATE_UNVIEWABLE || state == XCB_WM_STATE_WITHDRAWN) { geom_wins[i] = NULL; @@ -177,6 +177,9 @@ scan(void) *(geom_wins[i]), NULL))) continue; + /* The window can be mapped, so force it to be undrawn for startup */ + xcb_unmap_window(globalconf.connection, wins[i]); + client_manage(wins[i], geom_r, phys_screen, true); p_delete(&geom_r); diff --git a/client.c b/client.c index 194c27ef6..7a0684ac6 100644 --- a/client.c +++ b/client.c @@ -204,14 +204,7 @@ client_ban(client_t *c) { if(!c->isbanned) { - /* Move all clients out of the physical viewport into negative coordinate space. */ - /* They will all be put on top of each other. */ - uint32_t request[2] = { - (c->geometries.internal.width + 2 * c->border), - - (c->geometries.internal.height + 2 * c->border) }; - - xcb_configure_window(globalconf.connection, c->win, - XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, - request); + xcb_unmap_window(globalconf.connection, c->win); c->isbanned = true; @@ -475,6 +468,9 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, c->phys_screen = phys_screen; + /* consider the window banned */ + c->isbanned = true; + /* Initial values */ c->win = w; c->geometry.x = wgeom->x; @@ -545,10 +541,6 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, */ window_state_set(c->win, XCB_WM_STATE_NORMAL); - /* Move window outside the viewport before mapping it. */ - client_ban(c); - xcb_map_window(globalconf.connection, c->win); - if(!startup) spawn_start_notify(c); @@ -718,15 +710,6 @@ client_resize(client_t *c, area_t geometry, bool hints) titlebar_update_geometry(c); - /* The idea is to give a client a resize even when banned. */ - /* We just have to move the (x,y) to keep it out of the viewport. */ - /* This at least doesn't break expectations about events. */ - if(c->isbanned) - { - geometry_internal.x = values[0] = - (geometry_internal.width + 2 * c->border); - geometry_internal.y = values[1] = - (geometry_internal.height + 2 * c->border); - } - xcb_configure_window(globalconf.connection, c->win, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, @@ -993,18 +976,7 @@ client_unban(client_t *c) { if(c->isbanned) { - /* Move the client back where it belongs. */ - uint32_t request[] = { c->geometries.internal.x, - c->geometries.internal.y, - c->geometries.internal.width, - c->geometries.internal.height }; - - xcb_configure_window(globalconf.connection, c->win, - XCB_CONFIG_WINDOW_X - | XCB_CONFIG_WINDOW_Y - | XCB_CONFIG_WINDOW_WIDTH - | XCB_CONFIG_WINDOW_HEIGHT, - request); + xcb_map_window(globalconf.connection, c->win); c->isbanned = false; } diff --git a/event.c b/event.c index 6808468fe..a208876c6 100644 --- a/event.c +++ b/event.c @@ -264,27 +264,15 @@ event_handle_configurerequest(void *data __attribute__ ((unused)), ev->value_mask &= ~(XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE); - if(c->isbanned) - { - /* We'll be sending protocol geometry, so don't readd borders and titlebar. */ - /* We do have to ensure the windows don't end up in the visible screen. */ - ev->x = geometry.x = - (geometry.width + 2*c->border); - ev->y = geometry.y = - (geometry.height + 2*c->border); - window_configure(c->win, geometry, c->border); - event_handle_configurerequest_configure_window(ev); - } - else - { - /** Configure request are sent with size relative to real (internal) - * window size, i.e. without titlebars and borders. */ - geometry = titlebar_geometry_add(c->titlebar, c->border, geometry); + /** Configure request are sent with size relative to real (internal) + * window size, i.e. without titlebars and borders. */ + geometry = titlebar_geometry_add(c->titlebar, c->border, geometry); - if(!client_resize(c, geometry, false)) - { - /* Resize wasn't officially needed, but we don't want to break expectations. */ - geometry = titlebar_geometry_remove(c->titlebar, c->border, c->geometry); - window_configure(c->win, geometry, c->border); - } + if(!client_resize(c, geometry, false)) + { + /* Resize wasn't officially needed, but we don't want to break expectations. */ + geometry = titlebar_geometry_remove(c->titlebar, c->border, c->geometry); + window_configure(c->win, geometry, c->border); } } else diff --git a/titlebar.c b/titlebar.c index ac47bea54..86b061824 100644 --- a/titlebar.c +++ b/titlebar.c @@ -68,13 +68,7 @@ titlebar_ban(wibox_t *titlebar) simple_window_t *sw = &titlebar->sw; if(sw->window) - { - uint32_t request[] = { - sw->geometry.width, - sw->geometry.height }; - /* Move the titlebar to the same place as the window. */ - xcb_configure_window(globalconf.connection, sw->window, - XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, - request); - } + xcb_unmap_window(globalconf.connection, sw->window); /* Remove titlebar geometry from client. */ if((c = client_getbytitlebar(titlebar))) @@ -99,14 +93,7 @@ titlebar_unban(wibox_t *titlebar) simple_window_t *sw = &titlebar->sw; if(sw->window) - { - /* All resizing is done, so only move now. */ - uint32_t request[] = { sw->geometry.x, sw->geometry.y }; - - xcb_configure_window(globalconf.connection, sw->window, - XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, - request); - } + xcb_map_window(globalconf.connection, sw->window); titlebar->isbanned = false; diff --git a/titlebar.h b/titlebar.h index dcd6934c7..485f717fc 100644 --- a/titlebar.h +++ b/titlebar.h @@ -65,7 +65,7 @@ titlebar_geometry_add(wibox_t *t, int border, area_t geometry) * This can then be substracted/added to the witdh/height/x/y. * In this case the border is included, because it belongs to a different window. */ - if(t && !t->isbanned) + if(t && t->isvisible) switch(t->position) { case Top: @@ -106,7 +106,7 @@ titlebar_geometry_remove(wibox_t *t, int border, area_t geometry) * This can then be substracted/added to the witdh/height/x/y. * In this case the border is included, because it belongs to a different window. */ - if(t && !t->isbanned) + if(t && t->isvisible) switch(t->position) { case Top: diff --git a/wibox.h b/wibox.h index a13b9ac1b..d35205a33 100644 --- a/wibox.h +++ b/wibox.h @@ -83,16 +83,8 @@ wibox_t * wibox_getbywin(xcb_window_t); static inline void wibox_moveresize(wibox_t *wibox, area_t geometry) { - if(wibox->sw.window && !wibox->isbanned) + if(wibox->sw.window) simplewindow_moveresize(&wibox->sw, geometry); - else if(wibox->sw.window && wibox->isbanned) - { - area_t real_geom = geometry; - geometry.x = -geometry.width; - geometry.y = -geometry.height; - simplewindow_moveresize(&wibox->sw, geometry); - wibox->sw.geometry = real_geom; - } else wibox->sw.geometry = geometry; wibox->need_update = true;