aewl

changeset 551:798b906378d6

added screen-border snapping in floating mode, feels quite well
author arg@mig29
date Mon, 30 Oct 2006 11:58:05 +0100
parents 787f6ae02f29
children 98a0d10e9918
files config.arg.h config.default.h event.c
diffstat 3 files changed, 10 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/config.arg.h	Fri Oct 27 13:29:35 2006 +0200
     1.2 +++ b/config.arg.h	Mon Oct 30 11:58:05 2006 +0100
     1.3 @@ -19,6 +19,7 @@
     1.4  
     1.5  #define MASTER			600 /* per thousand */
     1.6  #define MODKEY			Mod1Mask
     1.7 +#define SNAP			20 /* pixel */
     1.8  
     1.9  #define KEYS \
    1.10  static Key key[] = { \
     2.1 --- a/config.default.h	Fri Oct 27 13:29:35 2006 +0200
     2.2 +++ b/config.default.h	Mon Oct 30 11:58:05 2006 +0100
     2.3 @@ -19,6 +19,7 @@
     2.4  
     2.5  #define MASTER			600 /* per thousand */
     2.6  #define MODKEY			Mod1Mask
     2.7 +#define SNAP			20 /* pixel */
     2.8  
     2.9  #define KEYS \
    2.10  static Key key[] = { \
     3.1 --- a/event.c	Fri Oct 27 13:29:35 2006 +0200
     3.2 +++ b/event.c	Mon Oct 30 11:58:05 2006 +0100
     3.3 @@ -48,6 +48,14 @@
     3.4  			XSync(dpy, False);
     3.5  			c->x = ocx + (ev.xmotion.x - x1);
     3.6  			c->y = ocy + (ev.xmotion.y - y1);
     3.7 +			if(abs(c->x) < sx + SNAP)
     3.8 +				c->x = sx;
     3.9 +			if(abs(c->y) < sy + bh + SNAP)
    3.10 +				c->y = sy + bh;
    3.11 +			if(abs(c->x + c->w) > sx + sw - SNAP)
    3.12 +				c->x = sw - c->w - 2 * BORDERPX;
    3.13 +			if(abs(c->y + c->h) > sy + sh - SNAP)
    3.14 +				c->y = sh - c->h - 2 * BORDERPX;
    3.15  			resize(c, False, TopLeft);
    3.16  			break;
    3.17  		}