win: handle restack to bottom correctly

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-04-03 21:15:38 +01:00
parent 166ec55778
commit b9f894c4fc
3 changed files with 33 additions and 7 deletions

View File

@ -1040,6 +1040,9 @@ void add_win(session_t *ps, xcb_window_t id, xcb_window_t prev) {
}
new->prev = p;
*p = new;
if (p == ps->window_stack_bottom) {
ps->window_stack_bottom = &new->next;
}
HASH_ADD_INT(ps->windows, id, new);
#ifdef CONFIG_DBUS
@ -1494,6 +1497,9 @@ static void finish_destroy_win(session_t *ps, win **_w) {
if (w->next) {
w->next->prev = w->prev;
}
if (&w->next == ps->window_stack_bottom) {
ps->window_stack_bottom = w->prev;
}
if (w == ps->active_win) {
ps->active_win = NULL;