From dbbe48898ab0d3f7490686a11e1b21f0ebdec99b Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Sat, 6 Dec 2008 23:41:33 +0100 Subject: [PATCH] client: Also check for struts on client_{ban,unban} Signed-off-by: Maarten Maathuis Signed-off-by: Julien Danjou --- client.c | 17 ++++++++++------- event.c | 9 ++------- ewmh.c | 9 ++------- wibox.c | 13 +++++++++++++ wibox.h | 1 + 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/client.c b/client.c index e482e4c90..544e6d0fc 100644 --- a/client.c +++ b/client.c @@ -198,6 +198,10 @@ client_ban(client_t *c) } c->isbanned = true; + + /* All the wiboxes (may) need to be repositioned. */ + if(client_hasstrut(c)) + wibox_update_positions(); } /* Wait until the last moment to take away the focus from the window. */ @@ -987,6 +991,10 @@ client_unban(client_t *c) } c->isbanned = false; + + /* All the wiboxes (may) need to be repositioned. */ + if(client_hasstrut(c)) + wibox_update_positions(); } } @@ -1040,14 +1048,9 @@ client_unmanage(client_t *c) xcb_delete_property(globalconf.connection, c->win, _AWESOME_TAGS); xcb_delete_property(globalconf.connection, c->win, _AWESOME_FLOATING); + /* All the wiboxes (may) need to be repositioned. */ if(client_hasstrut(c)) - /* All the wiboxes (may) need to be repositioned */ - for(int screen = 0; screen < globalconf.nscreen; screen++) - for(int i = 0; i < globalconf.screens[screen].wiboxes.len; i++) - { - wibox_t *s = globalconf.screens[screen].wiboxes.tab[i]; - wibox_position_update(s); - } + wibox_update_positions(); /* set client as invalid */ c->invalid = true; diff --git a/event.c b/event.c index 4f69c8077..f9ed0f142 100644 --- a/event.c +++ b/event.c @@ -223,14 +223,9 @@ event_handle_configurerequest(void *data __attribute__ ((unused)), || geometry.width != c->geometry.width || geometry.height != c->geometry.height) { client_resize(c, geometry, false); + /* All the wiboxes (may) need to be repositioned. */ if(client_hasstrut(c)) - /* All the wiboxes (may) need to be repositioned */ - for(int screen = 0; screen < globalconf.nscreen; screen++) - for(int i = 0; i < globalconf.screens[screen].wiboxes.len; i++) - { - wibox_t *s = globalconf.screens[screen].wiboxes.tab[i]; - wibox_position_update(s); - } + wibox_update_positions(); client_need_arrange(c); } else diff --git a/ewmh.c b/ewmh.c index aec69ab64..2eabdae5e 100644 --- a/ewmh.c +++ b/ewmh.c @@ -561,13 +561,8 @@ ewmh_client_strut_update(client_t *c, xcb_get_property_reply_t *strut_r) c->strut.bottom_end_x = strut[11]; client_need_arrange(c); - /* All the wiboxes (may) need to be repositioned */ - for(int screen = 0; screen < globalconf.nscreen; screen++) - for(int i = 0; i < globalconf.screens[screen].wiboxes.len; i++) - { - wibox_t *s = globalconf.screens[screen].wiboxes.tab[i]; - wibox_position_update(s); - } + /* All the wiboxes (may) need to be repositioned. */ + wibox_update_positions(); } } diff --git a/wibox.c b/wibox.c index 60ce11e74..57ff7b1c5 100644 --- a/wibox.c +++ b/wibox.c @@ -522,6 +522,19 @@ wibox_refresh(void) wibox_draw(c->titlebar); } +/** Reposition all wiboxes. + */ +void +wibox_update_positions(void) +{ + for(int screen = 0; screen < globalconf.nscreen; screen++) + for(int i = 0; i < globalconf.screens[screen].wiboxes.len; i++) + { + wibox_t *s = globalconf.screens[screen].wiboxes.tab[i]; + wibox_position_update(s); + } +} + /** Set a wibox visible or not. * \param wibox The wibox. * \param v The visible value. diff --git a/wibox.h b/wibox.h index 53043226b..398ac4c2e 100644 --- a/wibox.h +++ b/wibox.h @@ -26,6 +26,7 @@ #include "swindow.h" void wibox_refresh(void); +void wibox_update_positions(void); int luaA_wibox_new(lua_State *); int luaA_wibox_userdata_new(lua_State *, wibox_t *);