From a2ee4721b6eeecc047f764b88b0c2e0ee96a3dc9 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 17 Nov 2014 22:59:39 -0600 Subject: Add DEBUG_FADE This adds printf_dbgf statements to debug issues with fading. --- twin/compton-tde/common.h | 1 + twin/compton-tde/compton.c | 52 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 7 deletions(-) (limited to 'twin') diff --git a/twin/compton-tde/common.h b/twin/compton-tde/common.h index 4d9f41090..acaf68651 100644 --- a/twin/compton-tde/common.h +++ b/twin/compton-tde/common.h @@ -36,6 +36,7 @@ // #define DEBUG_GLX_MARK 1 // #define DEBUG_GLX_PAINTREG 1 // #define MONITOR_REPAINT 1 +// #define DEBUG_FADE 1 // Whether to enable PCRE regular expression support in blacklists, enabled // by default diff --git a/twin/compton-tde/compton.c b/twin/compton-tde/compton.c index 76cbb1838..74302da22 100644 --- a/twin/compton-tde/compton.c +++ b/twin/compton-tde/compton.c @@ -291,6 +291,9 @@ set_fade_callback(session_t *ps, win *w, w->fade_callback = callback; // Must be the last line as the callback could destroy w! if (exec_callback && old_callback) { +#ifdef DEBUG_FADE + printf_dbgf("(%#010lx): exec callback\n", w->id); +#endif old_callback(ps, w); // Although currently no callback function affects window state on // next paint, it could, in the future @@ -2426,9 +2429,15 @@ map_win(session_t *ps, Window id) { static void finish_map_win(session_t *ps, win *w) { w->in_openclose = false; +#ifdef DEBUG_FADE + printf_dbgf("(%#010lx)\n", w->id); +#endif if (ps->o.no_fading_openclose) { win_determine_fade(ps, w); } +#ifdef DEBUG_FADE + printf_dbgf("(%#010lx): end\n", w->id); +#endif } static void @@ -2718,14 +2727,25 @@ calc_dim(session_t *ps, win *w) { */ static void win_determine_fade(session_t *ps, win *w) { - if (UNSET != w->fade_force) - w->fade = w->fade_force; - else if (ps->o.no_fading_opacitychange && (!w->in_openclose)) + if (UNSET != w->fade_force) { +#ifdef DEBUG_FADE + printf_dbgf("(%#010lx): fade forced\n", w->id); +#endif + w->fade = w->fade_force; + } + else if (ps->o.no_fading_openclose && (w->in_openclose || w->destroyed)) { +#ifdef DEBUG_FADE + printf_dbgf("(): no_fading_openclose and in_openclose\n"); +#endif w->fade = false; - else if (ps->o.no_fading_openclose && w->in_openclose) + } + else if (ps->o.no_fading_opacitychange && (!w->in_openclose)) w->fade = false; else if (ps->o.no_fading_destroyed_argb && w->destroyed && WMODE_ARGB == w->mode && w->client_win && w->client_win != w->id) { +#ifdef DEBUG_FADE + printf_dbgf("(): no_fading_destroyed_argb\n"); +#endif w->fade = false; // Prevent it from being overwritten by last-paint value w->fade_last = false; @@ -2733,11 +2753,29 @@ win_determine_fade(session_t *ps, win *w) { // Ignore other possible causes of fading state changes after window // gets unmapped else if (IsViewable != w->a.map_state) { +#ifdef DEBUG_FADE + printf_dbgf("(): ignored: !IsViewable\n"); +#endif } - else if (win_match(ps, w, ps->o.fade_blacklist, &w->cache_fblst)) + else if (win_match(ps, w, ps->o.fade_blacklist, &w->cache_fblst)) { + w->fade = false; - else - w->fade = ps->o.wintype_fade[w->window_type]; + } + else if (ps->o.wintype_fade[w->window_type] != NULL) { + w->fade = ps->o.wintype_fade[w->window_type]; +#ifdef DEBUG_FADE + printf_dbgf("(%#010lx): via wintype_fade[%s]\n", + w->id, WINTYPES[w->window_type]); +#endif + } else { +#ifdef DEBUG_FADE + printf_dbgf("(): fallthrough\n"); +#endif + } + +#ifdef DEBUG_FADE + printf_dbgf("(%#010lx): fade = %d\n", w->id, w->fade ? w->fade : NULL); +#endif } /** -- cgit v1.2.3