WMII Reforge  Artifact [7d4fee4d8b]

Artifact 7d4fee4d8b17f4dca6ce272f9393d8165b102b424942947b7a5864495bed848f:

  • File lib/libstuff/x11/insanity/gravitate.c — part of check-in [15eae1e8e6] at 2019-06-20 16:42:23 on branch trunk — Import sources to have something to work with (user: KhazAkar size: 428)

/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
 * See LICENSE file for license details.
 */
#include "../x11.h"

Rectangle
gravitate(Rectangle rc, Rectangle rf, Point grav) {
	Point d;

	/* Get delta between frame and client rectangles */
	d = subpt(subpt(rf.max, rf.min),
		  subpt(rc.max, rc.min));

	/* Divide by 2 and apply gravity */
	d = divpt(d, Pt(2, 2));
	d = mulpt(d, grav);

	return rectsubpt(rc, d);
}