aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-04-22 11:05:41 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-04-22 11:05:41 -0500
commitfdbe9ee29a62eb19938b6a8a39cb7b208b84ec16 (patch)
treede803c3dafcf18916a85105ec5b97ac46700e59c
parent10bf0ff566e5e973a2f7a5f67ac8f149e39b4307 (diff)
Don't change tiling order in focusnext()
Use the focus stack instead to determine which client is focused
-rw-r--r--dwl.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/dwl.c b/dwl.c
index e028114..bba372f 100644
--- a/dwl.c
+++ b/dwl.c
@@ -413,16 +413,18 @@ focus(Client *c, struct wlr_surface *surface)
void
focusnext(const Arg *arg)
{
- /* Cycle to the next client */
+ /* XXX will need more logic with clients on different monitors */
if (wl_list_length(&clients) < 2) {
return;
}
- Client *c = wl_container_of(clients.next, c, link);
+ /* Find the selected client (top of fstack) and focus the client
+ * following it in tiling order */
+ Client *c = wl_container_of(fstack.next, c, flink);
Client *n = wl_container_of(c->link.next, n, link);
+ /* Skip the sentinel node if we wrap around the end of the list */
+ if (&n->link == &clients)
+ n = wl_container_of(n->link.next, n, link);
focus(n, n->xdg_surface->surface);
- /* Move the previous client to the end of the list */
- wl_list_remove(&c->link);
- wl_list_insert(clients.prev, &c->link);
}
void