From: Dana Jansens Date: Tue, 3 Jun 2003 20:27:09 +0000 (+0000) Subject: improve expose handling for alpha children X-Git-Tag: gl-oldtheme~55 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=62526b3681f709b2044a627f5484c8b1c352540a;p=dana%2Fopenbox.git improve expose handling for alpha children --- diff --git a/render2/paint.c b/render2/paint.c index dbdff140..e22f1f20 100644 --- a/render2/paint.c +++ b/render2/paint.c @@ -6,33 +6,41 @@ #include #include -struct ExposeArea { - struct RrSurface *sur; - int x; - int y; - int w; - int h; -}; - -#define MERGE_AREA(a, x, y, w, h) \ - a->w = MAX(a->x + a->w - 1, x + w - 1) - MIN(a->x, x), \ - a->h = MAX(a->y + a->h - 1, y + h - 1) - MIN(a->y, y), \ - a->x = MIN(a->x, x), \ - a->y = MIN(a->y, y) +void steal_children_exposes(struct RrInstance *inst, struct RrSurface *sur) +{ + GSList *it; + XEvent e2; + for (it = sur->children; it; it = g_slist_next(it)) { + switch (RrSurfaceType(((struct RrSurface*)it->data))) { + case RR_SURFACE_NONE: + break; + case RR_SURFACE_PLANAR: + if (RrPlanarHasAlpha(((struct RrSurface*)it->data))) { + while (XCheckTypedWindowEvent + (RrDisplay(inst), Expose, + ((struct RrSurface*)it->data)->win, &e2)); + steal_children_exposes(inst, it->data); + } + break; + case RR_SURFACE_NONPLANAR: + assert(0); + } + } +} void RrExpose(struct RrInstance *inst, XExposeEvent *e) { XEvent e2; struct RrSurface *sur; - Window win; - win = e->window; + g_message("Expose on %lx", e->window); - if ((sur = RrInstaceLookupSurface(inst, win))) { + if ((sur = RrInstaceLookupSurface(inst, e->window))) { while (1) { struct RrSurface *p = NULL; + /* steal events along the way */ while (XCheckTypedWindowEvent(RrDisplay(inst), Expose, sur->win, &e2)); @@ -50,9 +58,11 @@ void RrExpose(struct RrInstance *inst, XExposeEvent *e) if (p) sur = p; else break; } + /* also do this for transparent children */ + steal_children_exposes(inst, sur); RrPaint(sur, 0); } else - RrDebug("Unable to find surface for window 0x%lx\n", win); + RrDebug("Unable to find surface for window 0x%lx\n", e->window); } /*! Paints the surface, and all its children */ @@ -72,6 +82,8 @@ void RrPaint(struct RrSurface *sur, int recurse_always) if (!RrSurfaceVisible(sur)) return; + g_message("PAINTING SURFACE %p", sur); + ok = glXMakeCurrent(RrDisplay(inst), RrSurfaceWindow(sur),RrContext(inst)); assert(ok);