summaryrefslogtreecommitdiff
path: root/app/cwm/kbfunc.c
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2011-06-24 06:06:25 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2011-06-24 06:06:25 +0000
commit8a7ff79029d1e2c3902612d407babe0e3cda2dde (patch)
tree21fa53a5a7647d9bbe3f42be92ce1e01ae049651 /app/cwm/kbfunc.c
parent341bef3da06ab643444209c104829763b2b0ce1c (diff)
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...)
Diffstat (limited to 'app/cwm/kbfunc.c')
-rw-r--r--app/cwm/kbfunc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c
index 3b4e6ba60..d0b278ade 100644
--- a/app/cwm/kbfunc.c
+++ b/app/cwm/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 <sys/param.h>
@@ -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;