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 <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-03-25 00:56:34 +00:00
parent df15526722
commit d3a2c94461
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
2 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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;
}