aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-08-02 18:43:29 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-08-02 18:43:29 -0500
commitef7a37649c09312f98861bbc52a56ea29e7ae670 (patch)
treeb61f4fa40b3f1c3d705e71bc80edc7487e2d4ff5 /dwl.c
parent7856cdc1bf1ed1af46032b40f169112467b58ab1 (diff)
refactor focusclient
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/dwl.c b/dwl.c
index 1d1b4de..b25c5c3 100644
--- a/dwl.c
+++ b/dwl.c
@@ -673,6 +673,16 @@ focusclient(Client *old, Client *c, int lift)
{
struct wlr_keyboard *kb = wlr_seat_get_keyboard(seat);
+ /* Raise client in stacking order if requested */
+ if (c && lift) {
+ wl_list_remove(&c->slink);
+ wl_list_insert(&stack, &c->slink);
+ }
+
+ /* Nothing else to do? */
+ if (c == old)
+ return;
+
/* Deactivate old client if focus is changing */
if (c != old && old) {
if (old->type != XDGShell)
@@ -692,15 +702,10 @@ focusclient(Client *old, Client *c, int lift)
wlr_seat_keyboard_notify_enter(seat, WLR_SURFACE(c),
kb->keycodes, kb->num_keycodes, &kb->modifiers);
- /* Select client's monitor, move it to the top of the focus stack, and
- * raise it in the stacking order if requested. */
- selmon = c->mon;
+ /* Put the new client atop the focus stack and select its monitor */
wl_list_remove(&c->flink);
wl_list_insert(&fstack, &c->flink);
- if (lift) {
- wl_list_remove(&c->slink);
- wl_list_insert(&stack, &c->slink);
- }
+ selmon = c->mon;
/* Activate the new client */
if (c->type != XDGShell)