diff options
author | okan | 2016-10-03 13:52:17 +0000 |
---|---|---|
committer | okan | 2016-10-03 13:52:17 +0000 |
commit | 81d2fa85214b3c84c60b29cf852fd6618ebaacc9 (patch) | |
tree | 19f8aeb4925f9cb5dd5a0dc67a0895e84bda62e6 /kbfunc.c | |
parent | 59314d892ab90c218f2fd9b63761bf898ac4da2f (diff) | |
download | cwm-81d2fa85214b3c84c60b29cf852fd6618ebaacc9.tar.gz |
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.
Diffstat (limited to '')
-rw-r--r-- | kbfunc.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: kbfunc.c,v 1.128 2016/10/03 13:41:30 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.129 2016/10/03 13:52:17 okan Exp $ */ #include <sys/types.h> @@ -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; |