mirror of
https://github.com/yshui/picom.git
synced 2025-04-07 17:44:04 -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;
|
||||
paint++;
|
||||
if (ps->o.benchmark && paint >= ps->o.benchmark)
|
||||
if (ps->o.benchmark && paint >= ps->o.benchmark) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!fade_running)
|
||||
if (!fade_running) {
|
||||
ps->fade_time = 0L;
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
|
59
src/win.c
59
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
|
||||
w->shadow = shadow_new;
|
||||
|
||||
// Add damage for shadow change
|
||||
if (ps->redirected) {
|
||||
// Add damage for shadow change
|
||||
|
||||
// Window extents need update on shadow state change
|
||||
// Shadow geometry currently doesn't change on shadow state change
|
||||
// calc_shadow_geometry(ps, w);
|
||||
// Window extents need update on shadow state change
|
||||
// Shadow geometry currently doesn't change on shadow state change
|
||||
// calc_shadow_geometry(ps, w);
|
||||
|
||||
// Note: because the release and creation of the shadow images are delayed. When
|
||||
// multiple shadow changes happen in a row, without rendering phase between them,
|
||||
// there could be a stale shadow image attached to the window even if w->shadow
|
||||
// was previously false. And vice versa. So we check the STALE flag before
|
||||
// asserting the existence of the shadow image.
|
||||
if (w->shadow) {
|
||||
// Mark the new extents as damaged if the shadow is added
|
||||
assert(!w->shadow_image || win_check_flags_all(w, WIN_FLAGS_SHADOW_STALE) ||
|
||||
!ps->o.experimental_backends);
|
||||
pixman_region32_clear(&extents);
|
||||
win_extents(w, &extents);
|
||||
add_damage_from_win(ps, w);
|
||||
} else {
|
||||
// Mark the old extents as damaged if the shadow is removed
|
||||
assert(w->shadow_image || win_check_flags_all(w, WIN_FLAGS_SHADOW_STALE) ||
|
||||
!ps->o.experimental_backends);
|
||||
add_damage(ps, &extents);
|
||||
// Note: because the release and creation of the shadow images are
|
||||
// delayed. When multiple shadow changes happen in a row, without
|
||||
// rendering phase between them, there could be a stale shadow image
|
||||
// attached to the window even if w->shadow was previously false. And vice
|
||||
// versa. So we check the STALE flag before asserting the existence of the
|
||||
// shadow image.
|
||||
if (w->shadow) {
|
||||
// Mark the new extents as damaged if the shadow is added
|
||||
assert(!w->shadow_image ||
|
||||
win_check_flags_all(w, WIN_FLAGS_SHADOW_STALE) ||
|
||||
!ps->o.experimental_backends);
|
||||
pixman_region32_clear(&extents);
|
||||
win_extents(w, &extents);
|
||||
add_damage_from_win(ps, w);
|
||||
} else {
|
||||
// Mark the old extents as damaged if the shadow is removed
|
||||
assert(w->shadow_image ||
|
||||
win_check_flags_all(w, WIN_FLAGS_SHADOW_STALE) ||
|
||||
!ps->o.experimental_backends);
|
||||
add_damage(ps, &extents);
|
||||
}
|
||||
|
||||
// Delayed update of shadow image
|
||||
// By setting WIN_FLAGS_SHADOW_STALE, we ask win_process_flags to
|
||||
// re-create or release the shaodw in based on whether w->shadow is set.
|
||||
win_set_flags(w, WIN_FLAGS_SHADOW_STALE);
|
||||
ps->pending_updates = true;
|
||||
}
|
||||
|
||||
pixman_region32_fini(&extents);
|
||||
|
||||
// Delayed update of shadow image
|
||||
// By setting WIN_FLAGS_SHADOW_STALE, we ask win_process_flags to re-create or
|
||||
// release the shaodw in based on whether w->shadow is set.
|
||||
win_set_flags(w, WIN_FLAGS_SHADOW_STALE);
|
||||
ps->pending_updates = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue