summaryrefslogtreecommitdiffstats
path: root/compton.h
diff options
context:
space:
mode:
authorRichard Grenville <pyxlcy@gmail.com>2012-10-21 20:44:24 +0800
committerRichard Grenville <pyxlcy@gmail.com>2012-10-21 20:49:34 +0800
commit3c1e003830fe4066c4ccca4f75abf381a5cb70c3 (patch)
tree7d96d01c03a805506a70117d71037385b52dc0f2 /compton.h
parent2b120a74844d94d9f06fb86692fb667e557bc613 (diff)
downloadtdebase-3c1e003830fe4066c4ccca4f75abf381a5cb70c3.tar.gz
tdebase-3c1e003830fe4066c4ccca4f75abf381a5cb70c3.zip
Improvement: Stop painting on regions of higher windows
Sort of reverts cdf7db750d, but implements in a different way. (Well, maybe the pre-cdf7db750d way is actually better, if I'm willing to sacrifice some precious code reusability.) Basically, trading CPU for GPU, in an attempt to solve farseerfc and ichi-no-eda's problems. Highly experimental, could be revoked at any moment.
Diffstat (limited to 'compton.h')
-rw-r--r--compton.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/compton.h b/compton.h
index 56a397668..56c580993 100644
--- a/compton.h
+++ b/compton.h
@@ -276,6 +276,11 @@ typedef struct _win {
Bool need_configure;
XConfigureEvent queue_configure;
+ /// Region to be ignored when painting. Basically the region where
+ /// higher opaque windows will paint upon. Depends on window frame
+ /// opacity state, window geometry, window mapped/unmapped state,
+ /// window mode, of this and all higher windows.
+ XserverRegion reg_ignore;
struct _win *prev_trans;
} win;
@@ -1039,6 +1044,39 @@ copy_region(Display *dpy, XserverRegion oldregion) {
}
/**
+ * Dump a region.
+ */
+static inline void
+dump_region(Display *dpy, XserverRegion region) {
+ int nrects = 0, i;
+ XRectangle *rects = XFixesFetchRegion(dpy, region, &nrects);
+ if (!rects)
+ return;
+
+ for (i = 0; i < nrects; ++i)
+ printf("Rect #%d: %8d, %8d, %8d, %8d\n", i, rects[i].x, rects[i].y,
+ rects[i].width, rects[i].height);
+
+ XFree(rects);
+}
+
+/**
+ * Check if a region is empty.
+ *
+ * Keith Packard said this is slow:
+ * http://lists.freedesktop.org/archives/xorg/2007-November/030467.html
+ */
+static inline Bool
+is_region_empty(Display *dpy, XserverRegion region) {
+ int nrects = 0;
+ XRectangle *rects = XFixesFetchRegion(dpy, region, &nrects);
+
+ XFree(rects);
+
+ return !nrects;
+}
+
+/**
* Add a window to damaged area.
*
* @param dpy display in use