spkp

Stacking wayland compositor
git clone git://git.z3bra.org/sp:kp.git
Log | Files | Refs

commit 15b481aaaf63f5556727a33b5cb9507d3c84662a
parent e26f1e61fb72fb2608340ba987cf65e533767f8d
Author: Willy Goiffon <dev@z3bra.org>
Date:   Fri, 13 Nov 2020 09:49:42 +0100

Handle cycling through windows in reverse order

Diffstat:
Mcompositor.c | 20++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/compositor.c b/compositor.c @@ -953,23 +953,27 @@ kb_terminate(struct state *server, union keyarg *arg) void kb_alttab(struct state *server, union keyarg *arg) { - (void)arg; + int reverse; struct window *w; - struct wl_list *elm; + struct wl_list *list, *elm; if (wl_list_empty(&server->windows)) return; - elm = server->windows.prev; + reverse = arg->i; - if (elm == &server->windows) - elm = server->windows.next; + list = &server->windows; + elm = list->prev; - w = wl_container_of(elm, w, link); + if (reverse) { + elm = list->next; + list = list->prev; + } - /* re-insert last window on top of the stack */ wl_list_remove(elm); - wl_list_insert(&server->windows, elm); + wl_list_insert(list, elm); + + w = wl_container_of(elm, w, link); focus(w); }