mirror of
https://github.com/yshui/picom.git
synced 2024-10-27 05:24:17 -04:00
Make sure map_win initialize win::win_data
Previously it is initialized by win_update_bounding_shape, so configure_win is called when win_data == NULL and state == WSTATE_MAPPING, which is an invalid state for a `win` to be in. Now map_win explicitly calls backend->prepare_win. This is not very efficient since win_update_bounding_shape will reinit it. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
e82bc0ca23
commit
f120f9b754
1 changed files with 11 additions and 8 deletions
19
src/win.c
19
src/win.c
|
@ -617,11 +617,7 @@ void win_on_win_size_change(session_t *ps, win *w) {
|
|||
w->flags |= WFLAG_SIZE_CHANGE;
|
||||
// Invalidate the shadow we built
|
||||
if (ps->o.experimental_backends) {
|
||||
if (w->state != WSTATE_UNMAPPED && w->state != WSTATE_MAPPED) {
|
||||
// wrapping up fading
|
||||
w->opacity = w->opacity_tgt;
|
||||
win_check_fade_finished(ps, &w);
|
||||
}
|
||||
win_skip_fading(ps, &w);
|
||||
if (!w) {
|
||||
return;
|
||||
}
|
||||
|
@ -1240,13 +1236,14 @@ void win_update_bounding_shape(session_t *ps, win *w) {
|
|||
if (ps->o.experimental_backends) {
|
||||
//log_trace("free out dated pict");
|
||||
// Window shape changed, we should free win_data
|
||||
if (ps->redirected && w->state == WSTATE_MAPPED) {
|
||||
if (ps->redirected && w->state != WSTATE_UNMAPPED) {
|
||||
// Note we only do this when screen is redirected, because
|
||||
// otherwise win_data is not valid
|
||||
backend_info_t *bi = backend_list[ps->o.backend];
|
||||
bi->release_win(ps->backend_data, ps, w, w->win_data);
|
||||
w->win_data = bi->prepare_win(ps->backend_data, ps, w);
|
||||
//log_trace("free out dated pict");
|
||||
if (w->state != WSTATE_UNMAPPING && w->state != WSTATE_DESTROYING) {
|
||||
w->win_data = bi->prepare_win(ps->backend_data, ps, w);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
free_paint(ps, &w->paint);
|
||||
|
@ -1620,6 +1617,12 @@ void map_win(session_t *ps, win *w) {
|
|||
// iff `state` is MAPPED
|
||||
w->state = WSTATE_MAPPING;
|
||||
w->opacity_tgt = win_calc_opacity_target(ps, w);
|
||||
|
||||
// TODO win_update_bounding_shape below will immediately
|
||||
// reinit w->win_data, not very efficient
|
||||
if (ps->redirected) {
|
||||
w->win_data = backend_list[ps->o.backend]->prepare_win(ps->backend_data, ps, w);
|
||||
}
|
||||
log_debug("Window %#010x has opacity %f, opacity target is %f", w->id, w->opacity, w->opacity_tgt);
|
||||
|
||||
win_determine_blur_background(ps, w);
|
||||
|
|
Loading…
Reference in a new issue