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...) --- mousefunc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mousefunc.c') diff --git a/mousefunc.c b/mousefunc.c index 1ff2393..e38873e 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: mousefunc.c,v 1.28 2011/06/24 05:51:25 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.29 2011/06/24 06:06:24 okan Exp $ */ #include @@ -160,6 +160,13 @@ mousefunc_window_move(struct client_ctx *cc, void *arg) cc->geom.x = ev.xmotion.x_root - px - cc->bwidth; cc->geom.y = ev.xmotion.y_root - py - cc->bwidth; + 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); + /* don't move more than 60 times / second */ if ((ev.xmotion.time - time) > (1000 / 60)) { time = ev.xmotion.time; -- cgit v1.2.3-2-gb3c3