/*
- * Having verboselog() and errorlog() is necessary when using libi3.
+ * Having verboselog(), errorlog() and debuglog() is necessary when using libi3.
*
*/
void verboselog(char *fmt, ...) {
va_end(args);
}
+void debuglog(char *fmt, ...) {
+}
+
/*
* This function resolves ~ in pathnames.
* It may resolve wildcards in the first part of the path, but if no match
static xcb_get_input_focus_cookie_t focus_cookie;
/*
- * Having verboselog() and errorlog() is necessary when using libi3.
+ * Having verboselog(), errorlog() and debuglog() is necessary when using libi3.
*
*/
void verboselog(char *fmt, ...) {
va_end(args);
}
+void debuglog(char *fmt, ...) {
+}
+
/*
* Restores the X11 input focus to whereever it was before.
* This is necessary because i3-input’s window has override_redirect=1
xcb_screen_t *root_screen;
/*
- * Having verboselog() and errorlog() is necessary when using libi3.
+ * Having verboselog(), errorlog() and debuglog() is necessary when using libi3.
*
*/
void verboselog(char *fmt, ...) {
va_end(args);
}
+void debuglog(char *fmt, ...) {
+}
+
/*
* Starts the given application by passing it through a shell. We use double fork
* to avoid zombie processes. As the started application’s parent exits (immediately),
} \
} while (0)
+#if defined(DLOG)
+#undef DLOG
+#endif
/* Use cool logging-macros */
#define DLOG(fmt, ...) do { \
if (config.verbose) { \
#include "common.h"
/*
- * Having verboselog() and errorlog() is necessary when using libi3.
+ * Having verboselog(), errorlog() and debuglog() is necessary when using libi3.
*
*/
void verboselog(char *fmt, ...) {
va_end(args);
}
+void debuglog(char *fmt, ...) {
+}
+
/*
* Glob path, i.e. expand ~
*
/* Since this file also gets included by utilities which don’t use the i3 log
* infrastructure, we define a fallback. */
#if !defined(LOG)
-void verboselog(char *fmt, ...);
+void verboselog(char *fmt, ...)
+ __attribute__ ((format (printf, 1, 2)));
#define LOG(fmt, ...) verboselog("[libi3] " __FILE__ " " fmt, ##__VA_ARGS__)
#endif
#if !defined(ELOG)
-void errorlog(char *fmt, ...);
+void errorlog(char *fmt, ...)
+ __attribute__ ((format (printf, 1, 2)));
#define ELOG(fmt, ...) errorlog("[libi3] ERROR: " fmt, ##__VA_ARGS__)
#endif
+#if !defined(DLOG)
+void debuglog(char *fmt, ...)
+ __attribute__ ((format (printf, 1, 2)));
+#define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, I3__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#endif
/**
* Try to get the contents of the given atom (for example I3_SOCKET_PATH) from
#if defined(ELOG)
#undef ELOG
#endif
+#if defined(DLOG)
+#undef DLOG
+#endif
/** ##__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that
is, delete the preceding comma */
#define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__)
static double pango_font_green;
static double pango_font_blue;
+/* Necessary to track whether the dpi changes and trigger a LOG() message,
+ * which is more easily visible to users. */
+static double logged_dpi = 0.0;
+
static PangoLayout *create_layout_with_dpi(cairo_t *cr) {
PangoLayout *layout;
PangoContext *context;
context = pango_cairo_create_context(cr);
const double dpi = (double)root_screen->height_in_pixels * 25.4 /
(double)root_screen->height_in_millimeters;
- LOG("X11 root window dictates %f DPI\n", dpi);
+ if (logged_dpi != dpi) {
+ logged_dpi = dpi;
+ LOG("X11 root window dictates %f DPI\n", dpi);
+ } else {
+ DLOG("X11 root window dictates %f DPI\n", dpi);
+ }
pango_cairo_context_set_resolution(context, dpi);
layout = pango_layout_new(context);
g_object_unref(context);