aboutsummaryrefslogtreecommitdiffstats
path: root/kbfunc.c
diff options
context:
space:
mode:
authorWalter Alejandro Iglesias2020-07-24 15:37:19 +0200
committerWolfgang Müller2021-04-27 12:28:35 +0200
commit47703bbeafea2d689a33fce27e46b0e05c6bcd4e (patch)
treef70f82fec6ac6c4b2e20faf15b3bfed92b39cb06 /kbfunc.c
parenteb642bf77c25b12bb61cc7dd3781c6b6c67f6873 (diff)
downloadcwm-47703bbeafea2d689a33fce27e46b0e05c6bcd4e.tar.gz
Warp pointer to last active window if there is no active client
If a client is killed and the cursor lands in the root window, no client is focused. Attempting to cycle back to the last focused client will instead focus the previous-to-last. Add specific checks that make sure the cursor is positioned where the user expects it to be. This patch was taken from a bug report on openbsd-misc [1]. [1] https://marc.info/?l=openbsd-tech&m=155931484124288&w=2
Diffstat (limited to 'kbfunc.c')
-rw-r--r--kbfunc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kbfunc.c b/kbfunc.c
index ef8630e..cde37e3 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -451,6 +451,16 @@ kbfunc_client_cycle(void *ctx, struct cargs *cargs)
newcc->ptr.y = newcc->geom.h / 2;
}
client_ptr_warp(newcc);
+
+ /* When no client is active warp pointer to last active */
+ if (oldcc->flags & (CLIENT_ACTIVE))
+ client_ptr_warp(newcc);
+ else if (oldcc->flags & (CLIENT_SKIP_CYCLE))
+ client_ptr_warp(newcc);
+ else {
+ client_raise(oldcc);
+ client_ptr_warp(oldcc);
+ }
}
void