summaryrefslogtreecommitdiffstats
path: root/compton.h
diff options
context:
space:
mode:
authorRichard Grenville <[email protected]>2012-09-16 23:12:02 +0800
committerRichard Grenville <[email protected]>2012-09-16 23:17:34 +0800
commit32d9807104ab6a288a279beb98679dd2e02603c1 (patch)
tree814031973cf0664d43f3ff1a1fea32c5b72e9e21 /compton.h
parente370ec9b1ca1768ad9160703477d6ac5ec20fa80 (diff)
downloadtdebase-32d9807104ab6a288a279beb98679dd2e02603c1.tar.gz
tdebase-32d9807104ab6a288a279beb98679dd2e02603c1.zip
Misc: Clean up
- Add 4 helper free functions that free XserverRegion, Damage, Picture, and Pixmap. - Rename w->shadow to w->shadow_pict. Add a bool member w->shadow to prepare for a future change.
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