From e60fe72dcb4bfb0c6373a4cc0405b917d4bc15d2 Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Sun, 13 Jan 2013 13:44:05 +0800 Subject: [PATCH] Bug fix #75: --invert-color-include not working & others - Fix a small bug that breaks --invert-color-include if no other blacklists are present. Thanks to MaskRay and xiaq for reporting. - Disable --unredir-if-possible for multi-screen setups. - Fix a bug that causes --no-fading-openclose to have no effect in some cases. Add w->in_openclose to keep track of window open/close state. --- src/compton.c | 34 ++++++++++++++++++++++------------ src/compton.h | 6 ++++-- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/compton.c b/src/compton.c index 9155a84..f933d43 100644 --- a/src/compton.c +++ b/src/compton.c @@ -1358,9 +1358,11 @@ paint_preprocess(session_t *ps, win *list) { if (is_highest && to_paint) { is_highest = false; + // Disable unredirection for multi-screen setups if (WMODE_SOLID == w->mode && (!w->frame_opacity || !win_has_frame(w)) - && win_is_fullscreen(ps, w)) + && win_is_fullscreen(ps, w) + && ScreenCount(ps->dpy) <= 1) ps->unredir_possible = true; } @@ -1966,20 +1968,18 @@ map_win(session_t *ps, Window id) { win_determine_shadow(ps, w); // Set fading state + w->in_openclose = false; if (ps->o.no_fading_openclose) { set_fade_callback(ps, w, finish_map_win, true); - // Must be set after we execute the old fade callback, in case we - // receive two continuous MapNotify for the same window - w->fade = false; + w->in_openclose = true; } else { set_fade_callback(ps, w, NULL, true); - win_determine_fade(ps, w); } + win_determine_fade(ps, w); w->damaged = true; - /* if any configure events happened while the window was unmapped, then configure the window to its correct place */ @@ -1990,14 +1990,18 @@ map_win(session_t *ps, Window id) { static void finish_map_win(session_t *ps, win *w) { - if (ps->o.no_fading_openclose) + w->in_openclose = false; + if (ps->o.no_fading_openclose) { win_determine_fade(ps, w); + } } static void finish_unmap_win(session_t *ps, win *w) { w->damaged = false; + w->in_openclose = false; + update_reg_ignore_expire(ps, w); if (w->extents != None) { @@ -2031,8 +2035,10 @@ unmap_win(session_t *ps, Window id) { // Fading out w->flags |= WFLAG_OPCT_CHANGE; set_fade_callback(ps, w, unmap_callback, false); - if (ps->o.no_fading_openclose) - w->fade = false; + if (ps->o.no_fading_openclose) { + w->in_openclose = true; + win_determine_fade(ps, w); + } // don't care about properties anymore win_ev_stop(ps, w); @@ -2154,7 +2160,10 @@ calc_dim(session_t *ps, win *w) { */ static void win_determine_fade(session_t *ps, win *w) { - w->fade = ps->o.wintype_fade[w->window_type]; + if (ps->o.no_fading_openclose && w->in_openclose) + w->fade = false; + else + w->fade = ps->o.wintype_fade[w->window_type]; } /** @@ -2485,12 +2494,13 @@ add_win(session_t *ps, Window id, Window prev) { .need_configure = false, .queue_configure = { }, .reg_ignore = None, - .destroyed = false, .widthb = 0, .heightb = 0, + .destroyed = false, .bounding_shaped = false, .rounded_corners = false, .to_paint = false, + .in_openclose = false, .client_win = None, .window_type = WINTYPE_UNKNOWN, @@ -4733,7 +4743,7 @@ get_cfg(session_t *ps, int argc, char *const *argv) { // Determine whether we need to track window name and class if (ps->o.shadow_blacklist || ps->o.fade_blacklist - || ps->o.focus_blacklist) + || ps->o.focus_blacklist || ps->o.invert_color_list) ps->o.track_wdata = true; // Determine whether we track window grouping diff --git a/src/compton.h b/src/compton.h index f58711a..2154f86 100644 --- a/src/compton.h +++ b/src/compton.h @@ -667,16 +667,18 @@ typedef struct _win { /// opacity state, window geometry, window mapped/unmapped state, /// window mode, of this and all higher windows. XserverRegion reg_ignore; - /// Whether the window has been destroyed. - bool destroyed; /// Cached width/height of the window including border. int widthb, heightb; + /// Whether the window has been destroyed. + bool destroyed; /// Whether the window is bounding-shaped. bool bounding_shaped; /// Whether the window just have rounded corners. bool rounded_corners; /// Whether this window is to be painted. bool to_paint; + /// Whether this window is in open/close state. + bool in_openclose; // Client window related members /// ID of the top-level client window of the window.