mirror of
https://github.com/X11Libre/xf86-video-intel.git
synced 2026-03-24 01:24:12 +00:00
tools/intel-virtual-output: Respond to expose events on target displays
If the destination screen is exposed (for example screensavers), we need to redraw. So enable the ExposeEvent on the target and synthesize damage to any clones on that display in order to trigger a redraw. Reported-by: Raffael Herzog <herzog@raffael.ch> References: https://bugs.freedesktop.org/show_bug.cgi?id=93562 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
@@ -2037,8 +2037,9 @@ static void clone_damage(struct clone *c, const XRectangle *rec)
|
||||
if ((v = (int)rec->y + rec->height) > c->damaged.y2)
|
||||
c->damaged.y2 = v;
|
||||
|
||||
DBG(DAMAGE, ("%s-%s damaged: (%d, %d), (%d, %d)\n",
|
||||
DBG(DAMAGE, ("%s-%s damaged: +(%d,%d)x(%d, %d) -> (%d, %d), (%d, %d)\n",
|
||||
DisplayString(c->dst.display->dpy), c->dst.name,
|
||||
rec->x, rec->y, rec->width, rec->height,
|
||||
c->damaged.x1, c->damaged.y1,
|
||||
c->damaged.x2, c->damaged.y2));
|
||||
}
|
||||
@@ -2382,6 +2383,8 @@ static int add_display(struct context *ctx, Display *dpy)
|
||||
display->depth = DefaultDepth(dpy, DefaultScreen(dpy));
|
||||
display->visual = DefaultVisual(dpy, DefaultScreen(dpy));
|
||||
|
||||
XSelectInput(dpy, display->root, ExposureMask);
|
||||
|
||||
display->has_shm = can_use_shm(dpy, display->root,
|
||||
&display->shm_event,
|
||||
&display->shm_opcode,
|
||||
@@ -3526,7 +3529,32 @@ int main(int argc, char **argv)
|
||||
XNextEvent(ctx.display[i].dpy, &e);
|
||||
|
||||
DBG(POLL, ("%s received event %d\n", DisplayString(ctx.display[i].dpy), e.type));
|
||||
if (ctx.display[i].rr_active && e.type == ctx.display[i].rr_event + RRNotify) {
|
||||
if (e.type == Expose) {
|
||||
XExposeEvent *xe = (XExposeEvent *)&e;
|
||||
struct clone *clone;
|
||||
int damaged = 0;
|
||||
|
||||
DBG(DAMAGE, ("%s exposed: (%d, %d)x(%d, %d)\n",
|
||||
DisplayString(ctx.display[i].dpy),
|
||||
xe->x, xe->y, xe->width, xe->height));
|
||||
|
||||
for (clone = ctx.active; clone; clone = clone->active) {
|
||||
XRectangle r;
|
||||
|
||||
if (clone->dst.display != &ctx.display[i])
|
||||
continue;
|
||||
|
||||
r.x = clone->src.x + xe->x;
|
||||
r.y = clone->src.y + xe->y;
|
||||
r.width = xe->width;
|
||||
r.height = xe->height;
|
||||
clone_damage(clone, &r);
|
||||
damaged++;
|
||||
}
|
||||
|
||||
if (damaged)
|
||||
context_enable_timer(&ctx);
|
||||
} else if (ctx.display[i].rr_active && e.type == ctx.display[i].rr_event + RRNotify) {
|
||||
XRRNotifyEvent *re = (XRRNotifyEvent *)&e;
|
||||
|
||||
DBG(XRR, ("%s received RRNotify, type %d\n", DisplayString(ctx.display[i].dpy), re->subtype));
|
||||
|
||||
Reference in New Issue
Block a user