From 792f85cde97742d0c580ee2354044870d0f8754f Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 3 Oct 2016 13:52:17 +0000 Subject: For both kb and mouse move, it is possible to grab a client and move it completely off the screen/region; instead, if the pointer is outside of the client bounds, warp the pointer to the closest edge before moving. --- kbfunc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'kbfunc.c') diff --git a/kbfunc.c b/kbfunc.c index c5b0083..fc2bc8b 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -95,12 +95,24 @@ kbfunc_client_move(struct client_ctx *cc, union arg *arg) { struct screen_ctx *sc = cc->sc; struct geom area; - int x, y; + int x, y, px, py; unsigned int mx = 0, my = 0; if (cc->flags & CLIENT_FREEZE) return; + xu_ptr_getpos(cc->win, &px, &py); + if (px < 0) + px = 0; + else if (px > cc->geom.w) + px = cc->geom.w; + if (py < 0) + py = 0; + else if (py > cc->geom.h) + py = cc->geom.h; + + xu_ptr_setpos(cc->win, px, py); + kbfunc_amount(arg->i, Conf.mamount, &mx, &my); cc->geom.x += mx; -- cgit 1.4.1