new backend: fix crash when window's shadow state change
Create a shadow image for a mapped window when it's shadow become enabled. For unmapped window, the shadow image is created during mapping. Also, if the window has IMAGE_ERROR flag, it won't be render anyway. So shadow image won't be created in that case either. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
eeb8712982
commit
18f6a20bf4
18
src/win.c
18
src/win.c
|
@ -528,8 +528,24 @@ void win_update_prop_shadow(session_t *ps, win *w) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_set_shadow(session_t *ps, win *w, bool shadow_new) {
|
void win_set_shadow(session_t *ps, win *w, bool shadow_new) {
|
||||||
if (w->shadow == shadow_new)
|
if (w->shadow == shadow_new) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_debug("Updating shadow property of window %#010x (%s) to %d", w->id, w->name,
|
||||||
|
shadow_new);
|
||||||
|
if (ps->o.experimental_backends && ps->redirected &&
|
||||||
|
w->state != WSTATE_UNMAPPED && !(w->flags & WIN_FLAGS_IMAGE_ERROR)) {
|
||||||
|
assert(!w->shadow_image);
|
||||||
|
// Create shadow image
|
||||||
|
w->shadow_image = ps->backend_data->ops->render_shadow(
|
||||||
|
ps->backend_data, w->widthb, w->heightb, ps->gaussian_map, ps->o.shadow_red,
|
||||||
|
ps->o.shadow_green, ps->o.shadow_blue, ps->o.shadow_opacity);
|
||||||
|
if (!w->shadow_image) {
|
||||||
|
log_error("Failed to bind shadow image");
|
||||||
|
w->shadow_force = OFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
region_t extents;
|
region_t extents;
|
||||||
pixman_region32_init(&extents);
|
pixman_region32_init(&extents);
|
||||||
|
|
Loading…
Reference in New Issue