Skip to content

Commit

Permalink
core: reuse handle_new_window for pre-existing windows
Browse files Browse the repository at this point in the history
Reduce code duplication, also handle_new_window handles damage of mapped
windows properly.

Fixes #160

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
  • Loading branch information
yshui committed May 21, 2019
1 parent 1b00eea commit f50428a
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/compton.c
Original file line number Diff line number Diff line change
Expand Up @@ -2005,30 +2005,13 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
}

for (int i = 0; i < nchildren; i++) {
auto w =
add_win_above(ps, children[i], i ? children[i - 1] : XCB_NONE);
fill_win(ps, w);
add_win_above(ps, children[i], i ? children[i - 1] : XCB_NONE);
}
free(reply);

HASH_ITER2(ps->windows, w) {
assert(!w->is_new);
if (!w->managed) {
continue;
}
auto mw = (struct managed_win *)w;
if (mw->a.map_state == XCB_MAP_STATE_VIEWABLE) {
map_win(ps, mw);
// This is a pre-existing window, we have no idea if it's
// ever damaged, so assume conservatively that it is.
mw->ever_damaged = true;
}
}

log_trace("Initial stack:");
list_foreach(struct win, w, &ps->window_stack, stack_neighbour) {
log_trace("%#010x \"%s\"", w->id,
w->managed ? ((struct managed_win *)w)->name : "(null)");
log_trace("%#010x", w->id);
}
}

Expand Down

0 comments on commit f50428a

Please sign in to comment.