summaryrefslogtreecommitdiffstats
path: root/compton.h
diff options
context:
space:
mode:
Diffstat (limited to 'compton.h')
-rw-r--r--compton.h62
1 files changed, 48 insertions, 14 deletions
diff --git a/compton.h b/compton.h
index 1cca657a5..ce8e4d298 100644
--- a/compton.h
+++ b/compton.h
@@ -97,10 +97,10 @@ typedef struct _win {
Picture picture;
Picture alpha_pict;
Picture alpha_border_pict;
- Picture shadow_pict;
XserverRegion border_size;
XserverRegion extents;
- Picture shadow;
+ Bool shadow;
+ Picture shadow_pict;
int shadow_dx;
int shadow_dy;
int shadow_width;
@@ -159,6 +159,8 @@ extern Atom atom_client_attr;
// inline functions must be made static to compile correctly under clang:
// http://clang.llvm.org/compatibility.html#inline
+// Helper functions
+
/**
* Normalize an int value to a specific range.
*
@@ -256,6 +258,50 @@ print_timestamp(void) {
#endif
/**
+ * Destroy a <code>XserverRegion</code>.
+ */
+inline static void
+free_region(Display *dpy, XserverRegion *p) {
+ if (*p) {
+ XFixesDestroyRegion(dpy, *p);
+ *p = None;
+ }
+}
+
+/**
+ * Destroy a <code>Picture</code>.
+ */
+inline static void
+free_picture(Display *dpy, Picture *p) {
+ if (*p) {
+ XRenderFreePicture(dpy, *p);
+ *p = None;
+ }
+}
+
+/**
+ * Destroy a <code>Pixmap</code>.
+ */
+inline static void
+free_pixmap(Display *dpy, Pixmap *p) {
+ if (*p) {
+ XFreePixmap(dpy, *p);
+ *p = None;
+ }
+}
+
+/**
+ * Destroy a <code>Damage</code>.
+ */
+inline static void
+free_damage(Display *dpy, Damage *p) {
+ if (*p) {
+ XDamageDestroy(dpy, *p);
+ *p = None;
+ }
+}
+
+/**
* Determine if a window has a specific attribute.
*
* @param dpy Display to use
@@ -545,18 +591,6 @@ inline static void
ev_shape_notify(XShapeEvent *ev);
/**
- * Destory the cached border_size of a window.
- */
-inline static void
-win_free_border_size(Display *dpy, win *w) {
- if (w->border_size) {
- set_ignore(dpy, NextRequest(dpy));
- XFixesDestroyRegion(dpy, w->border_size);
- w->border_size = None;
- }
-}
-
-/**
* Get a region of the screen size.
*/
inline static XserverRegion