diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2010-12-21 22:37:59 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2010-12-21 22:37:59 +0000 |
commit | acf13ce9784111ca1e42ffc8206e752668476859 (patch) | |
tree | 49ccd47b2e589a27dab8657d516133205f07f393 /resize.c | |
parent | 1b8488ee75458c4561089bf056c0e911de958428 (diff) |
Store sessions in an RB tree by name rather than a list, this is tidier
and allows them to easily be shown sorted in various lists
(list-sessions/choose-sessions).
Keep a session index which is used in a couple of places internally but
make it an ever-increasing number rather than filling in gaps with new
sessions.
Diffstat (limited to 'resize.c')
-rw-r--r-- | resize.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -52,11 +52,7 @@ recalculate_sizes(void) u_int i, j, ssx, ssy, has, limit; int flag; - for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { - s = ARRAY_ITEM(&sessions, i); - if (s == NULL) - continue; - + RB_FOREACH(s, sessions, &sessions) { ssx = ssy = UINT_MAX; for (j = 0; j < ARRAY_LENGTH(&clients); j++) { c = ARRAY_ITEM(&clients, j); @@ -98,9 +94,8 @@ recalculate_sizes(void) flag = options_get_number(&w->options, "aggressive-resize"); ssx = ssy = UINT_MAX; - for (j = 0; j < ARRAY_LENGTH(&sessions); j++) { - s = ARRAY_ITEM(&sessions, j); - if (s == NULL || s->flags & SESSION_UNATTACHED) + RB_FOREACH(s, sessions, &sessions) { + if (s->flags & SESSION_UNATTACHED) continue; if (flag) has = s->curw->window == w; |