summaryrefslogtreecommitdiffstats
path: root/compton.h
diff options
context:
space:
mode:
authorRichard Grenville <pyxlcy@gmail.com>2013-06-09 17:06:35 +0800
committerRichard Grenville <pyxlcy@gmail.com>2013-06-09 17:09:28 +0800
commit0dca9aa79edbc5e2d665d9f65321adc32a595d2a (patch)
tree338792a3973d6e1daa730ebaf81fa76e2b671c7b /compton.h
parentd800a62b878fa152c94253b2c0f60ef4f5b9b9d1 (diff)
downloadtdebase-0dca9aa79edbc5e2d665d9f65321adc32a595d2a.tar.gz
tdebase-0dca9aa79edbc5e2d665d9f65321adc32a595d2a.zip
Feature #116: Shadow exclusion region
- Add --shadow-exclude-reg, which excludes certain regions on the screen to have shadows painted in. (#116) - Adjust session initialization order. Now X root and screen info and basic X extensions are available in configuration parsing step.
Diffstat (limited to 'compton.h')
-rw-r--r--compton.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/compton.h b/compton.h
index 334e7372a..06d48e1b3 100644
--- a/compton.h
+++ b/compton.h
@@ -112,6 +112,41 @@ array_wid_exists(const Window *arr, int count, Window wid) {
}
/**
+ * Convert a geometry_t value to XRectangle.
+ */
+static inline XRectangle
+geom_to_rect(session_t *ps, const geometry_t *src, const XRectangle *def) {
+ XRectangle rect_def = { .x = 0, .y = 0,
+ .width = ps->root_width, .height = ps->root_height };
+ if (!def) def = &rect_def;
+
+ XRectangle rect = { .x = src->x, .y = src->y,
+ .width = src->wid, .height = src->hei };
+ if (src->wid < 0) rect.width = def->width;
+ if (src->hei < 0) rect.height = def->height;
+ if (-1 == src->x) rect.x = def->x;
+ else if (src->x < 0) rect.x = ps->root_width + rect.x + 2 - rect.width;
+ if (-1 == src->y) rect.y = def->y;
+ else if (src->y < 0) rect.y = ps->root_height + rect.y + 2 - rect.height;
+ return rect;
+}
+
+/**
+ * Convert a XRectangle to a XServerRegion.
+ */
+static inline XserverRegion
+rect_to_reg(session_t *ps, const XRectangle *src) {
+ if (!src) return None;
+ XRectangle bound = { .x = 0, .y = 0,
+ .width = ps->root_width, .height = ps->root_height };
+ XRectangle res = { };
+ rect_crop(&res, src, &bound);
+ if (res.width && res.height)
+ return XFixesCreateRegion(ps->dpy, &res, 1);
+ return None;
+}
+
+/**
* Destroy a <code>Picture</code>.
*/
inline static void