Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DEBUG_FADE #246

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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
Expand Down
50 changes: 44 additions & 6 deletions src/compton.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,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
Expand Down Expand Up @@ -2241,9 +2244,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
Expand Down Expand Up @@ -2414,24 +2423,53 @@ 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_openclose && 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_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;
}
// 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
}

/**
Expand Down