Skip to content

Commit

Permalink
picom: fix binding root back pixmap in case of depth mismatch
Browse files Browse the repository at this point in the history
the root back pixmap's depth may mismatch the display's screen depth. in
this case picom will fail to bind it what causes errors, warnings and
weird behavior. instead of using the display's screen depth we will use
the root back pixmap's depth.
  • Loading branch information
absolutelynothelix committed Dec 25, 2022
1 parent b997bec commit 07f9516
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,15 +991,31 @@ void root_damaged(session_t *ps) {
if (ps->root_image) {
ps->backend_data->ops->release_image(ps->backend_data, ps->root_image);
}

auto pixmap = x_get_root_back_pixmap(ps->c, ps->root, ps->atoms);
if (pixmap != XCB_NONE) {
xcb_generic_error_t *e;
auto r = xcb_get_geometry_reply(
ps->c, xcb_get_geometry(ps->c, pixmap), &e);
if (!r) {
x_print_error(e->full_sequence, e->major_code,
e->minor_code, e->error_code);
free(e);
goto err;
}

ps->root_image = ps->backend_data->ops->bind_pixmap(
ps->backend_data, pixmap, x_get_visual_info(ps->c, ps->vis), false);
ps->backend_data, pixmap,
x_get_visual_info(ps->c, x_get_visual_for_depth(ps->c, r->depth)),
false);
free(r);

if (ps->root_image) {
ps->backend_data->ops->set_image_property(
ps->backend_data, IMAGE_PROPERTY_EFFECTIVE_SIZE,
ps->root_image, (int[]){ps->root_width, ps->root_height});
} else {
err:
log_error("Failed to bind root back pixmap");
}
}
Expand Down

0 comments on commit 07f9516

Please sign in to comment.