From ab4a3c9a9f59f702603e19f3eb3508a815521d6c Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 24 Jun 2011 06:06:24 +0000 Subject: introduce a new config option to snap to the screen edge. 'snapdist' keyword taken from a diff from Sviatoslav Chagaev to do the same thing, but implemented in a completely way (based on some very old code from mk@). default set to 0, so no behavior change. ok oga@ (who would also like to take it further...) --- kbfunc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'kbfunc.c') diff --git a/kbfunc.c b/kbfunc.c index 3b4e6ba..d0b278a 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -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.54 2011/06/24 05:33:41 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.55 2011/06/24 06:06:24 okan Exp $ */ #include @@ -100,6 +100,13 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg) if (cc->geom.x > cc->sc->xmax - 1) cc->geom.x = cc->sc->xmax - 1; + cc->geom.x += client_snapcalc(cc->geom.x, + cc->geom.width, cc->sc->xmax, + cc->bwidth, Conf.snapdist); + cc->geom.y += client_snapcalc(cc->geom.y, + cc->geom.height, cc->sc->ymax, + cc->bwidth, Conf.snapdist); + client_move(cc); xu_ptr_getpos(cc->win, &x, &y); cc->ptr.y = y + my; -- cgit v1.2.3-2-gb3c3