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.
Fixes: 1307d9ec70
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
24
src/event.c
24
src/event.c
@@ -585,16 +585,28 @@ static inline void repair_win(session_t *ps, struct managed_win *w) {
|
||||
region_t 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) {
|
||||
win_extents(w, &parts);
|
||||
if (!ps->o.show_all_xerrors) {
|
||||
set_ignore_cookie(&ps->c, xcb_damage_subtract(ps->c.c, w->damage,
|
||||
XCB_NONE, XCB_NONE));
|
||||
auto e = xcb_request_check(
|
||||
ps->c.c, xcb_damage_subtract(ps->c.c, w->damage, XCB_NONE, XCB_NONE));
|
||||
if (e) {
|
||||
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 {
|
||||
auto cookie =
|
||||
xcb_damage_subtract(ps->c.c, w->damage, XCB_NONE, ps->damaged_region);
|
||||
if (!ps->o.show_all_xerrors) {
|
||||
set_ignore_cookie(&ps->c, xcb_damage_subtract(ps->c.c, w->damage, XCB_NONE,
|
||||
ps->damaged_region));
|
||||
set_ignore_cookie(&ps->c, cookie);
|
||||
}
|
||||
x_fetch_region(&ps->c, ps->damaged_region, &parts);
|
||||
pixman_region32_translate(&parts, w->g.x + w->g.border_width,
|
||||
|
||||
Reference in New Issue
Block a user