1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-11 13:51:02 -05:00

event: fix dumb bug in repair_win

Basically we won't call xcb_damage_subtract if show_all_xerrors is set,
which is very bad.

Fixes that, and also make sure the damage subtract request is flushed in
all branches.

(cherry picked from commit a5826b6fb0)
Fixes: 1307d9ec70
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-02-06 09:10:04 +00:00
parent de9724f814
commit 41f9a5816c
No known key found for this signature in database
GPG key ID: D3A4405BE6CC17F4

View file

@ -585,16 +585,28 @@ static inline void repair_win(session_t *ps, struct managed_win *w) {
region_t parts; region_t parts;
pixman_region32_init(&parts); pixman_region32_init(&parts);
// If this is the first time this window is damaged, we would redraw the
// whole window, so we don't need to fetch the damage region. But we still need
// to make sure the X server receives the DamageSubtract request, hence the
// `xcb_request_check` here.
// Otherwise, we fetch the damage regions. That means we will receive a reply
// from the X server, which implies it has received our request.
if (!w->ever_damaged) { if (!w->ever_damaged) {
win_extents(w, &parts); auto e = xcb_request_check(
if (!ps->o.show_all_xerrors) { ps->c.c, xcb_damage_subtract(ps->c.c, w->damage, XCB_NONE, XCB_NONE));
set_ignore_cookie(&ps->c, xcb_damage_subtract(ps->c.c, w->damage, if (e) {
XCB_NONE, XCB_NONE)); if (ps->o.show_all_xerrors) {
x_print_error(e->sequence, e->major_code, e->minor_code,
e->error_code);
}
free(e);
} }
win_extents(w, &parts);
} else { } else {
auto cookie =
xcb_damage_subtract(ps->c.c, w->damage, XCB_NONE, ps->damaged_region);
if (!ps->o.show_all_xerrors) { if (!ps->o.show_all_xerrors) {
set_ignore_cookie(&ps->c, xcb_damage_subtract(ps->c.c, w->damage, XCB_NONE, set_ignore_cookie(&ps->c, cookie);
ps->damaged_region));
} }
x_fetch_region(&ps->c, ps->damaged_region, &parts); x_fetch_region(&ps->c, ps->damaged_region, &parts);
pixman_region32_translate(&parts, w->g.x + w->g.border_width, pixman_region32_translate(&parts, w->g.x + w->g.border_width,