changeset 3167:d1933497b7a0

Fixed #276: Updated window snapping
author unexist
date Tue, 03 Jan 2012 16:48:24 +0100
parents c27ec8ccca62
children 4733bdd6f197
files src/subtle/client.c
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/subtle/client.c	Tue Jan 03 16:34:12 2012 +0100
+++ b/src/subtle/client.c	Tue Jan 03 16:48:24 2012 +0100
@@ -137,21 +137,21 @@
   DEAD(c);
   assert(c && s && geom);
 
-  /* Snap to screen border - X axis */
-  if(s->geom.x + subtle->snap > geom->x)
+  /* Snap to screen border when value is in snap margin - X axis */
+  if(abs(s->geom.x - geom->x) <= subtle->snap)
     geom->x = s->geom.x + BORDER(c);
-  else if(geom->x > (s->geom.x + s->geom.width +
-      BORDER(c) - geom->width - subtle->snap))
+  else if(abs((s->geom.x + s->geom.width) -
+      (geom->x + geom->width + BORDER(c))) <= subtle->snap)
     {
       geom->x = s->geom.x + s->geom.width -
         geom->width - BORDER(c);
     }
 
-  /* Snap tp screen border - Y axis */
-  if(s->geom.y + subtle->snap > geom->y)
+  /* Snap to screen border when is in snap margin - Y axis */
+  if(abs(s->geom.y - geom->y) <= subtle->snap)
     geom->y = s->geom.y + BORDER(c);
-  else if(geom->y > (s->geom.y + s->geom.height +
-      BORDER(c) - geom->height - subtle->snap))
+  else if(abs((s->geom.y + s->geom.height) -
+      (geom->y + geom->height + BORDER(c))) <= subtle->snap)
     {
       geom->y = s->geom.y + s->geom.height -
         geom->height - BORDER(c);