summaryrefslogtreecommitdiffstats
path: root/compton.h
diff options
context:
space:
mode:
authorRichard Grenville <[email protected]>2013-08-22 21:15:04 +0800
committerRichard Grenville <[email protected]>2013-08-22 21:44:15 +0800
commitcd62d55a5b62c97cff3e60ebc0b3a66b8c7fa891 (patch)
treece698806bb2637abccb679e118ef9b21c66c7ad3 /compton.h
parent8f6c2d89ea6883d5cee95cfeb83618c5c11cbf12 (diff)
downloadtdebase-cd62d55a5b62c97cff3e60ebc0b3a66b8c7fa891.tar.gz
tdebase-cd62d55a5b62c97cff3e60ebc0b3a66b8c7fa891.zip
Improvement #137: --xinerama-shadow-crop
Add --xinerama-shadow-crop to crop shadow to current Xinerama screen. Thanks to Feltzer for suggestion.
Diffstat (limited to 'compton.h')
-rw-r--r--compton.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/compton.h b/compton.h
index c0773db99..f4a7ef9a2 100644
--- a/compton.h
+++ b/compton.h
@@ -193,6 +193,23 @@ free_wincondlst(c2_lptr_t **pcondlst) {
}
/**
+ * Free Xinerama screen info.
+ */
+static inline void
+free_xinerama_info(session_t *ps) {
+#ifdef CONFIG_XINERAMA
+ if (ps->xinerama_scr_regs) {
+ for (int i = 0; i < ps->xinerama_nscrs; ++i)
+ free_region(ps, &ps->xinerama_scr_regs[i]);
+ free(ps->xinerama_scr_regs);
+ }
+ cxfree(ps->xinerama_scrs);
+ ps->xinerama_scrs = NULL;
+ ps->xinerama_nscrs = 0;
+#endif
+}
+
+/**
* Check whether a paint_t contains enough data.
*/
static inline bool
@@ -1191,6 +1208,31 @@ timeout_clear(session_t *ps);
static bool
mainloop(session_t *ps);
+#ifdef CONFIG_XINERAMA
+static void
+cxinerama_upd_scrs(session_t *ps);
+#endif
+
+/**
+ * Get the Xinerama screen a window is on.
+ *
+ * Return an index >= 0, or -1 if not found.
+ */
+static inline void
+cxinerama_win_upd_scr(session_t *ps, win *w) {
+#ifdef CONFIG_XINERAMA
+ w->xinerama_scr = -1;
+ for (XineramaScreenInfo *s = ps->xinerama_scrs;
+ s < ps->xinerama_scrs + ps->xinerama_nscrs; ++s)
+ if (s->x_org <= w->a.x && s->y_org <= w->a.y
+ && s->x_org + s->width >= w->a.x + w->widthb
+ && s->y_org + s->height >= w->a.y + w->heightb) {
+ w->xinerama_scr = s - ps->xinerama_scrs;
+ return;
+ }
+#endif
+}
+
static session_t *
session_init(session_t *ps_old, int argc, char **argv);