summaryrefslogtreecommitdiff
path: root/i3lock.h
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2012-03-26 19:54:47 +0200
committerMichael Stapelberg <michael@stapelberg.de>2012-03-26 19:54:47 +0200
commitbe2195106214b716b23d11534ea004f614b4a0e9 (patch)
tree3dabb9e968586c0bef80249dbcd63381de118f50 /i3lock.h
parent2053e9880aeece3f30060d57ed74ee5eb9cbe717 (diff)
Only output text when in debug mode (fixes problems with xautolock)
Diffstat (limited to 'i3lock.h')
-rw-r--r--i3lock.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/i3lock.h b/i3lock.h
new file mode 100644
index 0000000..3e336ad
--- /dev/null
+++ b/i3lock.h
@@ -0,0 +1,13 @@
+#ifndef _I3LOCK_H
+#define _I3LOCK_H
+
+/* This macro will only print debug output when started with --debug.
+ * This is important because xautolock (for example) closes stdout/stderr by
+ * default, so just printing something to stdout will lead to the data ending
+ * up on the X11 socket (!). */
+#define DEBUG(fmt, ...) do { \
+ if (debug_mode) \
+ printf("[i3lock-debug] " fmt, ##__VA_ARGS__); \
+} while (0)
+
+#endif