win: make sure delayed image update is always used

Convert several places where the window image is bound/unbound directly
to use image flags. Make sure window image updates only happen in one
place.

Remove win_bind_image function since its no longer used after this.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-09-20 02:18:16 +01:00
parent 39a609acb0
commit 3766aa2c79
3 changed files with 19 additions and 44 deletions

View File

@@ -752,13 +752,14 @@ static bool initialize_backend(session_t *ps) {
continue;
}
auto w = (struct managed_win *)_w;
if (w->a.map_state == XCB_MAP_STATE_VIEWABLE) {
win_bind_image(ps->backend_data, w,
(struct color){.red = ps->o.shadow_red,
.green = ps->o.shadow_green,
.blue = ps->o.shadow_blue,
.alpha = ps->o.shadow_opacity},
ps->gaussian_map);
assert(w->state == WSTATE_MAPPED || w->state == WSTATE_UNMAPPED);
if (w->state == WSTATE_MAPPED) {
// We need to reacquire image
log_debug("Marking window %#010x (%s) for update after "
"redirection",
w->base.id, w->name);
w->flags |= WIN_FLAGS_IMAGES_STALE;
ps->pending_updates = true;
}
}
}