event: handle reparent to the same parent

When a window is reparented to the same parent again, we should just
move it to the top of the stack, instead of add it again.

Also a slight refactor restack_win.

Fixes #164

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-04-27 13:36:42 +01:00
parent cfbd1819ed
commit ad8211e341
6 changed files with 193 additions and 162 deletions

View File

@@ -61,6 +61,12 @@ static inline void list_move_before(struct list_node *to_move, struct list_node
list_insert_before(new_next, to_move);
}
/// Move `to_move` so that it's after `new_prev`
static inline void list_move_after(struct list_node *to_move, struct list_node *new_prev) {
list_remove(to_move);
list_insert_after(new_prev, to_move);
}
/// Initialize a list node that's intended to be the head node
static inline void list_init_head(struct list_node *head) {
head->next = head->prev = head;