wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

gravitate.c (428B)


      1 /* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
      2  * See LICENSE file for license details.
      3  */
      4 #include "../x11.h"
      5 
      6 Rectangle
      7 gravitate(Rectangle rc, Rectangle rf, Point grav) {
      8 	Point d;
      9 
     10 	/* Get delta between frame and client rectangles */
     11 	d = subpt(subpt(rf.max, rf.min),
     12 		  subpt(rc.max, rc.min));
     13 
     14 	/* Divide by 2 and apply gravity */
     15 	d = divpt(d, Pt(2, 2));
     16 	d = mulpt(d, grav);
     17 
     18 	return rectsubpt(rc, d);
     19 }