mirror of
https://github.com/yshui/picom.git
synced 2025-04-21 18:03:02 -04:00
win: don't add damage when changing shadow setting while unredirected
When the screen is unredirected, no window have a shadow image. So the assertions in win_set_shadow don't hold. But in that case, we don't want to add damages anyway. So we put them behind a check of whether the screen is redirected. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
3576a92da3
commit
22162cb7e2
2 changed files with 36 additions and 29 deletions
|
@ -1512,12 +1512,14 @@ static void draw_callback_impl(EV_P_ session_t *ps, int revents attr_unused) {
|
||||||
|
|
||||||
ps->first_frame = false;
|
ps->first_frame = false;
|
||||||
paint++;
|
paint++;
|
||||||
if (ps->o.benchmark && paint >= ps->o.benchmark)
|
if (ps->o.benchmark && paint >= ps->o.benchmark) {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!fade_running)
|
if (!fade_running) {
|
||||||
ps->fade_time = 0L;
|
ps->fade_time = 0L;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(yshui) Investigate how big the X critical section needs to be. There are
|
// TODO(yshui) Investigate how big the X critical section needs to be. There are
|
||||||
// suggestions that rendering should be in the critical section as well.
|
// suggestions that rendering should be in the critical section as well.
|
||||||
|
|
27
src/win.c
27
src/win.c
|
@ -822,38 +822,43 @@ static void win_set_shadow(session_t *ps, struct managed_win *w, bool shadow_new
|
||||||
// Apply the shadow change
|
// Apply the shadow change
|
||||||
w->shadow = shadow_new;
|
w->shadow = shadow_new;
|
||||||
|
|
||||||
|
if (ps->redirected) {
|
||||||
// Add damage for shadow change
|
// Add damage for shadow change
|
||||||
|
|
||||||
// Window extents need update on shadow state change
|
// Window extents need update on shadow state change
|
||||||
// Shadow geometry currently doesn't change on shadow state change
|
// Shadow geometry currently doesn't change on shadow state change
|
||||||
// calc_shadow_geometry(ps, w);
|
// calc_shadow_geometry(ps, w);
|
||||||
|
|
||||||
// Note: because the release and creation of the shadow images are delayed. When
|
// Note: because the release and creation of the shadow images are
|
||||||
// multiple shadow changes happen in a row, without rendering phase between them,
|
// delayed. When multiple shadow changes happen in a row, without
|
||||||
// there could be a stale shadow image attached to the window even if w->shadow
|
// rendering phase between them, there could be a stale shadow image
|
||||||
// was previously false. And vice versa. So we check the STALE flag before
|
// attached to the window even if w->shadow was previously false. And vice
|
||||||
// asserting the existence of the shadow image.
|
// versa. So we check the STALE flag before asserting the existence of the
|
||||||
|
// shadow image.
|
||||||
if (w->shadow) {
|
if (w->shadow) {
|
||||||
// Mark the new extents as damaged if the shadow is added
|
// Mark the new extents as damaged if the shadow is added
|
||||||
assert(!w->shadow_image || win_check_flags_all(w, WIN_FLAGS_SHADOW_STALE) ||
|
assert(!w->shadow_image ||
|
||||||
|
win_check_flags_all(w, WIN_FLAGS_SHADOW_STALE) ||
|
||||||
!ps->o.experimental_backends);
|
!ps->o.experimental_backends);
|
||||||
pixman_region32_clear(&extents);
|
pixman_region32_clear(&extents);
|
||||||
win_extents(w, &extents);
|
win_extents(w, &extents);
|
||||||
add_damage_from_win(ps, w);
|
add_damage_from_win(ps, w);
|
||||||
} else {
|
} else {
|
||||||
// Mark the old extents as damaged if the shadow is removed
|
// Mark the old extents as damaged if the shadow is removed
|
||||||
assert(w->shadow_image || win_check_flags_all(w, WIN_FLAGS_SHADOW_STALE) ||
|
assert(w->shadow_image ||
|
||||||
|
win_check_flags_all(w, WIN_FLAGS_SHADOW_STALE) ||
|
||||||
!ps->o.experimental_backends);
|
!ps->o.experimental_backends);
|
||||||
add_damage(ps, &extents);
|
add_damage(ps, &extents);
|
||||||
}
|
}
|
||||||
|
|
||||||
pixman_region32_fini(&extents);
|
|
||||||
|
|
||||||
// Delayed update of shadow image
|
// Delayed update of shadow image
|
||||||
// By setting WIN_FLAGS_SHADOW_STALE, we ask win_process_flags to re-create or
|
// By setting WIN_FLAGS_SHADOW_STALE, we ask win_process_flags to
|
||||||
// release the shaodw in based on whether w->shadow is set.
|
// re-create or release the shaodw in based on whether w->shadow is set.
|
||||||
win_set_flags(w, WIN_FLAGS_SHADOW_STALE);
|
win_set_flags(w, WIN_FLAGS_SHADOW_STALE);
|
||||||
ps->pending_updates = true;
|
ps->pending_updates = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pixman_region32_fini(&extents);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue