From a7a2b09687ab9d4eb035ae497b402723fe272fdc Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 25 Mar 2019 00:56:34 +0000 Subject: [PATCH] win: invalidate reg_ignore properly when destroying window reg_ignore_valid marks the validity of the reg_ignore of the windows BENEATH the current window. That is, set `w->reg_ignore_valid = false` doesn't invalidate `w->reg_ignore`. When destroying window `w`, we need to invalidate all reg_ignore beneath `w`. So it is not enough to just set `w->next->reg_ignore_valid = false`, we also need to invalidate `w->next->reg_ignore`. Yes, this variable name is confusing. Will be changed in the future. Signed-off-by: Yuxuan Shui --- src/compton.c | 5 +++-- src/win.c | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compton.c b/src/compton.c index 684e40e6..b861f036 100644 --- a/src/compton.c +++ b/src/compton.c @@ -487,7 +487,7 @@ static win *paint_preprocess(session_t *ps, bool *fade_running) { rc_region_t *last_reg_ignore = rc_region_new(); bool unredir_possible = false; - // Trace whether it's the highest window to paint + // Track whether it's the highest window to paint bool is_highest = true; bool reg_ignore_valid = true; for (win *w = ps->list; w; w = next) { @@ -500,8 +500,9 @@ static win *paint_preprocess(session_t *ps, bool *fade_running) { next = w->next; // Destroy reg_ignore if some window above us invalidated it - if (!reg_ignore_valid) + if (!reg_ignore_valid) { rc_region_unref(&w->reg_ignore); + } // log_trace("%d %d %s", w->a.map_state, w->ever_damaged, w->name); diff --git a/src/win.c b/src/win.c index a0360c50..585e9c6c 100644 --- a/src/win.c +++ b/src/win.c @@ -1438,8 +1438,7 @@ static void finish_destroy_win(session_t *ps, win **_w) { // be true, and there is no need to invalid w->next->reg_ignore // when w is destroyed. if (w->next) { - // should be `= w->reg_ignore_valid && w->next->reg_ignore_valid`, - // but keep it this way until we think about reg_ignore. + rc_region_unref(&w->next->reg_ignore); w->next->reg_ignore_valid = false; }