- This is needed to properly process certain changes triggered by arrange, that need yet another arrange. --- client.h | 6 +++--- layout.c | 10 ++++++++-- screen.c | 9 ++++++--- structs.h | 4 ++-- tag.c | 6 ++++-- titlebar.c | 3 ++- wibox.c | 9 ++++++--- 7 files changed, 31 insertions(+), 16 deletions(-)
diff --git a/client.h b/client.h index 780bff2..d1bc349 100644 --- a/client.h +++ b/client.h @@ -38,11 +38,11 @@ client_delete(client_t **c) ARRAY_FUNCS(client_t *, client, DO_NOTHING) DO_RCNT(client_t, client, client_delete) +/* Increase refcount by one. */ #define client_need_arrange(c) \ do { \ - if(!globalconf.screens[(c)->screen].need_arrange \ - && client_isvisible(c, (c)->screen)) \ - globalconf.screens[(c)->screen].need_arrange = true; \ + if(client_isvisible(c, (c)->screen)) \ + globalconf.screens[(c)->screen].need_arrange++; \ } while(0) bool client_maybevisible(client_t *, int); diff --git a/layout.c b/layout.c index ba65e7b..11197f3 100644 --- a/layout.c +++ b/layout.c @@ -71,8 +71,14 @@ arrange(int screen) p_delete(&qp_r); } - /* reset status */ - globalconf.screens[screen].need_arrange = false; + /* Reduce refcount by one. + * This used to be a boolean, but this had one major issue. + * The system expected need_arrange to actually trigger an + * arrange, which wasn't the case when it was called before + * the end of this function (we used to unset need_arrange). + * Now for each "need_arrange" we call arrange to be sure. + */ + globalconf.screens[screen].need_arrange--; } /** Refresh the screen disposition diff --git a/screen.c b/screen.c index e6a3fb0..83c2404 100644 --- a/screen.c +++ b/screen.c @@ -329,8 +329,9 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize) tag_client(c, new_tags->tab[i]); } + /* Increase refcount by one. */ if(wasvisible) - globalconf.screens[old_screen].need_arrange = true; + globalconf.screens[old_screen].need_arrange++; client_need_arrange(c); if (!doresize) @@ -430,7 +431,8 @@ luaA_screen_tags(lua_State *L) tag_array_wipe(&s->tags); tag_array_init(&s->tags); - s->need_arrange = true; + /* Increase the refcount by one. */ + s->need_arrange++; /* push new tags */ lua_pushnil(L); @@ -518,7 +520,8 @@ luaA_screen_padding(lua_State *L) { s->padding = luaA_getopt_padding(L, 2, &s->padding); - s->need_arrange = true; + /* Increase refcount by one. */ + s->need_arrange++; /* All the wiboxes repositioned */ for(int i = 0; i < s->wiboxes.len; i++) diff --git a/structs.h b/structs.h index 69e18a6..badc3f7 100644 --- a/structs.h +++ b/structs.h @@ -263,8 +263,8 @@ typedef struct int index; /** Screen geometry */ area_t geometry; - /** true if we need to arrange() */ - bool need_arrange; + /** greater than 0 if we need to arrange() */ + int need_arrange; /** Tag list */ tag_array_t tags; /** Wiboxes */ diff --git a/tag.c b/tag.c index c9edc1e..cc292f5 100644 --- a/tag.c +++ b/tag.c @@ -40,7 +40,8 @@ tag_view(tag_t *tag, bool view) { tag->selected = view; ewmh_update_net_current_desktop(screen_virttophys(tag->screen)); - globalconf.screens[tag->screen].need_arrange = true; + /* Increase refcount by one. */ + globalconf.screens[tag->screen].need_arrange++; } /** Create a new tag. Parameters values are checked. @@ -397,8 +398,9 @@ luaA_tag_newindex(lua_State *L) return 0; } + /* Increase refcount by one. */ if((*tag)->screen != SCREEN_UNDEF && (*tag)->selected) - globalconf.screens[(*tag)->screen].need_arrange = true; + globalconf.screens[(*tag)->screen].need_arrange++; return 0; } diff --git a/titlebar.c b/titlebar.c index d5de3e4..a957a32 100644 --- a/titlebar.c +++ b/titlebar.c @@ -276,7 +276,8 @@ titlebar_set_visible(wibox_t *t, bool visible) else xcb_unmap_window(globalconf.connection, t->sw.window); - globalconf.screens[t->screen].need_arrange = true; + /* Increase refcount by one. */ + globalconf.screens[t->screen].need_arrange++; client_stack(); } } diff --git a/wibox.c b/wibox.c index 788fd7c..360fa67 100644 --- a/wibox.c +++ b/wibox.c @@ -296,7 +296,8 @@ wibox_position_update(wibox_t *wibox) area_t area, wingeom = wibox->sw.geometry; bool ignore = false; - globalconf.screens[wibox->screen].need_arrange = true; + /* Increase refcount by one. */ + globalconf.screens[wibox->screen].need_arrange++; area = screen_area_get(wibox->screen, NULL, &globalconf.screens[wibox->screen].padding, true); @@ -606,7 +607,8 @@ wibox_detach(wibox_t *wibox) wibox_array_take(&globalconf.screens[wibox->screen].wiboxes, i); break; } - globalconf.screens[wibox->screen].need_arrange = true; + /* Increase refcount by one. */ + globalconf.screens[wibox->screen].need_arrange++; wibox->screen = SCREEN_UNDEF; wibox_unref(&wibox); } @@ -945,7 +947,8 @@ luaA_wibox_geometry(lua_State *L) || wingeom.height != (*wibox)->sw.geometry.height) { wibox_resize(*wibox, wingeom.width, wingeom.height); - globalconf.screens[(*wibox)->screen].need_arrange = true; + /* Increase refcount by one. */ + globalconf.screens[(*wibox)->screen].need_arrange++; } break; } -- 1.6.1.3 -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.