Skip to content

Commit

Permalink
Workaround for what seems to be a race in Xserver
Browse files Browse the repository at this point in the history
There seems to be a race between DamageAdd (what the client uses
to report damage to Xserver) and DamageSubtract (what compton uses
to clear the reported damage, so it can receive new ones). I am not
sure how to confirm this. But this (terrible) workaround seems to
solve this problem.
  • Loading branch information
yshui committed Sep 14, 2018
1 parent 265dc67 commit d7cff56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions src/compton.c
Original file line number Diff line number Diff line change
Expand Up @@ -2084,20 +2084,16 @@ add_damage(session_t *ps, XserverRegion damage) {
}

static void
repair_win(session_t *ps, win *w) {
repair_win(session_t *ps, win *w, XDamageNotifyEvent *de) {
if (IsViewable != w->a.map_state)
return;

XserverRegion parts;

if (!w->damaged) {
parts = win_extents(ps, w);
set_ignore_next(ps);
XDamageSubtract(ps->dpy, w->damage, None, None);
} else {
parts = XFixesCreateRegion(ps->dpy, 0, 0);
set_ignore_next(ps);
XDamageSubtract(ps->dpy, w->damage, None, parts);
parts = XFixesCreateRegion(ps->dpy, (XRectangle[]){de->area}, 1);
XFixesTranslateRegion(ps->dpy, parts,
w->a.x + w->a.border_width,
w->a.y + w->a.border_width);
Expand Down Expand Up @@ -2961,7 +2957,7 @@ add_win(session_t *ps, Window id, Window prev) {

// Create Damage for window
set_ignore_next(ps);
new->damage = XDamageCreate(ps->dpy, id, XDamageReportNonEmpty);
new->damage = XDamageCreate(ps->dpy, id, XDamageReportRawRectangles);
}

calc_win_size(ps, new);
Expand Down Expand Up @@ -3291,7 +3287,7 @@ damage_win(session_t *ps, XDamageNotifyEvent *de) {

if (!w) return;

repair_win(ps, w);
repair_win(ps, w, de);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/compton.h
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ static void
add_damage(session_t *ps, XserverRegion damage);

static void
repair_win(session_t *ps, win *w);
repair_win(session_t *ps, win *w, XDamageNotifyEvent *de);

static wintype_t
wid_get_prop_wintype(session_t *ps, Window w);
Expand Down

0 comments on commit d7cff56

Please sign in to comment.