disgusting new way to handle expose events
authorDana Jansens <danakj@orodu.net>
Tue, 27 May 2003 20:15:09 +0000 (20:15 +0000)
committerDana Jansens <danakj@orodu.net>
Tue, 27 May 2003 20:15:09 +0000 (20:15 +0000)
render2/paint.c

index 64737761ab0607071dac28b46daa1243d0e7c1b7..b39d805f094bcfaf8da92ce9d7786e0c144953eb 100644 (file)
@@ -5,15 +5,53 @@
 #include <assert.h>
 #include <GL/glx.h>
 
-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 */