From 6adcfb2cd5911ee52665aca3bf5486fe69b27fac Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 27 May 2003 20:15:09 +0000 Subject: [PATCH] disgusting new way to handle expose events --- render2/paint.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/render2/paint.c b/render2/paint.c index 64737761..b39d805f 100644 --- a/render2/paint.c +++ b/render2/paint.c @@ -5,15 +5,53 @@ #include #include -void RrExpose(struct RrInstance *inst, XExposeEvent *e) +void RrExpose(struct RrInstance *inst, XEvent *e) { + XEvent e2; + GSList *tops = NULL, *it; struct RrSurface *sur; - if ((sur = RrInstaceLookupSurface(inst, e->window))) { - RrPaintArea(sur, e->x, e->y, e->width, e->height); + XPutBackEvent(RrDisplay(inst), e); + while (XCheckTypedEvent(RrDisplay(inst), Expose, &e2)) { + if ((sur = RrInstaceLookupSurface(inst, e2.xexpose.window))) { + while (sur->parent) sur = sur->parent; + if (!g_slist_find(tops, sur)) + tops = g_slist_append(tops, sur); + } + } + + for (it = tops; it; it = g_slist_next(it)) + RrPaint(it->data); + +/* + XEvent e2; + struct RrSurface *sur; + + assert(e->type == Expose); + if (!(e->type == Expose)) return; + + if ((sur = RrInstaceLookupSurface(inst, e->xexpose.window))) { + int l, r, t, b; + + l = e->xexpose.x; + t = e->xexpose.y; + r = e->xexpose.width + e->xexpose.x - 1; + b = e->xexpose.height + e->xexpose.y - 1; + + while (XCheckTypedWindowEvent(RrDisplay(inst), e->xexpose.window, + Expose, &e2)) { + l = MIN(l, e2.xexpose.x); + t = MIN(t, e2.xexpose.y); + r = MAX(r, e2.xexpose.width + e2.xexpose.x - 1); + b = MAX(b, e2.xexpose.height + e2.xexpose.y - 1); + } + RrPaintArea(sur, l, t, + MIN(r - l + 1, RrSurfaceWidth(sur) - l), + MIN(b - t + 1, RrSurfaceHeight(sur) - t)); } else { - RrDebug("Unable to find surface for window 0x%lx\n", e->window); + RrDebug("Unable to find surface for window 0x%lx\n",e->xexpose.window); } +*/ } /*! Paints the surface, and all its children */ -- 2.34.1