Merge branch 'master' into next

This commit is contained in:
Michael Stapelberg 2013-12-24 10:37:14 +01:00
commit 5cd7979e62
8 changed files with 41 additions and 7 deletions

View File

@ -420,7 +420,7 @@ static char *rewrite_binding(const char *input) {
/* /*
* Having verboselog() and errorlog() is necessary when using libi3. * Having verboselog(), errorlog() and debuglog() is necessary when using libi3.
* *
*/ */
void verboselog(char *fmt, ...) { void verboselog(char *fmt, ...) {
@ -439,6 +439,9 @@ void errorlog(char *fmt, ...) {
va_end(args); va_end(args);
} }
void debuglog(char *fmt, ...) {
}
/* /*
* This function resolves ~ in pathnames. * This function resolves ~ in pathnames.
* It may resolve wildcards in the first part of the path, but if no match * It may resolve wildcards in the first part of the path, but if no match

View File

@ -57,7 +57,7 @@ xcb_screen_t *root_screen;
static xcb_get_input_focus_cookie_t focus_cookie; 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, ...) { void verboselog(char *fmt, ...) {
@ -76,6 +76,9 @@ void errorlog(char *fmt, ...) {
va_end(args); va_end(args);
} }
void debuglog(char *fmt, ...) {
}
/* /*
* Restores the X11 input focus to whereever it was before. * Restores the X11 input focus to whereever it was before.
* This is necessary because i3-inputs window has override_redirect=1 * This is necessary because i3-inputs window has override_redirect=1

View File

@ -61,7 +61,7 @@ xcb_connection_t *conn;
xcb_screen_t *root_screen; 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, ...) { void verboselog(char *fmt, ...) {
@ -80,6 +80,9 @@ void errorlog(char *fmt, ...) {
va_end(args); va_end(args);
} }
void debuglog(char *fmt, ...) {
}
/* /*
* Starts the given application by passing it through a shell. We use double fork * Starts the given application by passing it through a shell. We use double fork
* to avoid zombie processes. As the started applications parent exits (immediately), * to avoid zombie processes. As the started applications parent exits (immediately),

View File

@ -48,6 +48,9 @@
} \ } \
} while (0) } while (0)
#if defined(DLOG)
#undef DLOG
#endif
/* Use cool logging-macros */ /* Use cool logging-macros */
#define DLOG(fmt, ...) do { \ #define DLOG(fmt, ...) do { \
if (config.verbose) { \ if (config.verbose) { \

View File

@ -18,7 +18,7 @@
#include "common.h" #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, ...) { void verboselog(char *fmt, ...) {
@ -37,6 +37,9 @@ void errorlog(char *fmt, ...) {
va_end(args); va_end(args);
} }
void debuglog(char *fmt, ...) {
}
/* /*
* Glob path, i.e. expand ~ * Glob path, i.e. expand ~
* *

View File

@ -72,13 +72,20 @@ struct Font {
/* Since this file also gets included by utilities which dont use the i3 log /* Since this file also gets included by utilities which dont use the i3 log
* infrastructure, we define a fallback. */ * infrastructure, we define a fallback. */
#if !defined(LOG) #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__) #define LOG(fmt, ...) verboselog("[libi3] " __FILE__ " " fmt, ##__VA_ARGS__)
#endif #endif
#if !defined(ELOG) #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__) #define ELOG(fmt, ...) errorlog("[libi3] ERROR: " fmt, ##__VA_ARGS__)
#endif #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 * Try to get the contents of the given atom (for example I3_SOCKET_PATH) from

View File

@ -21,6 +21,9 @@
#if defined(ELOG) #if defined(ELOG)
#undef ELOG #undef ELOG
#endif #endif
#if defined(DLOG)
#undef DLOG
#endif
/** ##__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that /** ##__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that
is, delete the preceding comma */ is, delete the preceding comma */
#define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__) #define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__)

View File

@ -30,6 +30,10 @@ static double pango_font_red;
static double pango_font_green; static double pango_font_green;
static double pango_font_blue; 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) { static PangoLayout *create_layout_with_dpi(cairo_t *cr) {
PangoLayout *layout; PangoLayout *layout;
PangoContext *context; PangoContext *context;
@ -37,7 +41,12 @@ static PangoLayout *create_layout_with_dpi(cairo_t *cr) {
context = pango_cairo_create_context(cr); context = pango_cairo_create_context(cr);
const double dpi = (double)root_screen->height_in_pixels * 25.4 / const double dpi = (double)root_screen->height_in_pixels * 25.4 /
(double)root_screen->height_in_millimeters; (double)root_screen->height_in_millimeters;
if (logged_dpi != dpi) {
logged_dpi = dpi;
LOG("X11 root window dictates %f DPI\n", 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); pango_cairo_context_set_resolution(context, dpi);
layout = pango_layout_new(context); layout = pango_layout_new(context);
g_object_unref(context); g_object_unref(context);