diff options
Diffstat (limited to 'dwl.c')
-rw-r--r-- | dwl.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -1687,6 +1687,8 @@ focusclient(Client *c, int lift) void focusmon(const Arg *arg) { + Client *c; + int i = 0, nmons = wl_list_length(&mons); if (nmons) { do /* don't switch to disabled mons */ @@ -1694,6 +1696,16 @@ focusmon(const Arg *arg) while (!selmon->wlr_output->enabled && i++ < nmons); } focusclient(focustop(selmon), 1); + + if (warpcursor) { + wlr_cursor_warp_closest(cursor, NULL, selmon->w.x + selmon->w.width / 2.0, + selmon->w.y + selmon->w.height / 2.0); + c = focustop(selmon); + if (c) { + wlr_cursor_warp_closest(cursor, NULL, c->geom.x + c->geom.width / 2.0, + c->geom.y + c->geom.height / 2.0); + } + } } void @@ -1720,6 +1732,11 @@ focusstack(const Arg *arg) } /* If only one client is visible on selmon, then c == sel */ focusclient(c, 1); + + if (warpcursor) { + wlr_cursor_warp_closest( cursor, NULL, c->geom.x + c->geom.width / 2.0, + c->geom.y + c->geom.height / 2.0); + } } /* We probably should change the name of this, it sounds like @@ -1780,6 +1797,7 @@ handlesig(int signo) void incnmaster(const Arg *arg) { + Client *c; const MonitorRule *r; if (!arg || !selmon) @@ -1791,6 +1809,15 @@ incnmaster(const Arg *arg) } selmon->nmaster = MAX(selmon->nmaster + arg->i, 0); arrange(selmon); + + + if (warpcursor) { + c = focustop(selmon); + if (c) { + wlr_cursor_warp_closest(cursor, NULL, c->geom.x + c->geom.width / 2.0, + c->geom.y + c->geom.height / 2.0); + } + } } void @@ -2580,6 +2607,7 @@ setmfact(const Arg *arg) { float f; const MonitorRule *r; + Client *c; if (!arg || !selmon || !selmon->lt[selmon->sellt]->arrange) return; @@ -2593,6 +2621,14 @@ setmfact(const Arg *arg) else return; arrange(selmon); + + if (warpcursor) { + c = focustop(selmon); + if (c) { + wlr_cursor_warp_closest(cursor, NULL, c->geom.x + c->geom.width / 2.0, + c->geom.y + c->geom.height / 2.0); + } + } } void |