Browse Source

added screen-border snapping in floating mode, feels quite well

master
arg@mig29 18 years ago
parent
commit
b6614261ea
3 changed files with 10 additions and 0 deletions
  1. +1
    -0
      config.arg.h
  2. +1
    -0
      config.default.h
  3. +8
    -0
      event.c

+ 1
- 0
config.arg.h View File

@ -19,6 +19,7 @@ const char *tags[] = { "dev", "work", "net", "fnord", NULL };
#define MASTER 600 /* per thousand */ #define MASTER 600 /* per thousand */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
#define SNAP 20 /* pixel */
#define KEYS \ #define KEYS \
static Key key[] = { \ static Key key[] = { \


+ 1
- 0
config.default.h View File

@ -19,6 +19,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", NULL };
#define MASTER 600 /* per thousand */ #define MASTER 600 /* per thousand */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
#define SNAP 20 /* pixel */
#define KEYS \ #define KEYS \
static Key key[] = { \ static Key key[] = { \


+ 8
- 0
event.c View File

@ -48,6 +48,14 @@ movemouse(Client *c) {
XSync(dpy, False); XSync(dpy, False);
c->x = ocx + (ev.xmotion.x - x1); c->x = ocx + (ev.xmotion.x - x1);
c->y = ocy + (ev.xmotion.y - y1); c->y = ocy + (ev.xmotion.y - y1);
if(abs(c->x) < sx + SNAP)
c->x = sx;
if(abs(c->y) < sy + bh + SNAP)
c->y = sy + bh;
if(abs(c->x + c->w) > sx + sw - SNAP)
c->x = sw - c->w - 2 * BORDERPX;
if(abs(c->y + c->h) > sy + sh - SNAP)
c->y = sh - c->h - 2 * BORDERPX;
resize(c, False, TopLeft); resize(c, False, TopLeft);
break; break;
} }


Loading…
Cancel
Save