9 void steal_children_exposes(struct RrInstance *inst, struct RrSurface *sur)
14 for (it = sur->children; it; it = g_slist_next(it)) {
15 switch (RrSurfaceType(((struct RrSurface*)it->data))) {
18 case RR_SURFACE_PLANAR:
19 if (RrPlanarHasAlpha(((struct RrSurface*)it->data))) {
20 while (XCheckTypedWindowEvent
21 (RrDisplay(inst), Expose,
22 ((struct RrSurface*)it->data)->win, &e2));
23 steal_children_exposes(inst, it->data);
26 case RR_SURFACE_NONPLANAR:
32 void RrExpose(struct RrInstance *inst, XExposeEvent *e)
35 struct RrSurface *sur;
37 g_message("Expose on %lx", e->window);
39 if ((sur = RrInstaceLookupSurface(inst, e->window))) {
41 struct RrSurface *p = NULL;
43 /* steal events along the way */
44 while (XCheckTypedWindowEvent(RrDisplay(inst), Expose,
47 switch (RrSurfaceType(sur)) {
50 case RR_SURFACE_PLANAR:
51 if (RrPlanarHasAlpha(sur))
52 p = RrSurfaceParent(sur);
54 case RR_SURFACE_NONPLANAR:
61 /* also do this for transparent children */
62 steal_children_exposes(inst, sur);
65 RrDebug("Unable to find surface for window 0x%lx\n", e->window);
68 /*! Paints the surface, and all its children */
69 void RrPaint(struct RrSurface *sur, int recurse_always)
71 struct RrInstance *inst;
78 inst = RrSurfaceInstance(sur);
80 /* can't paint a prototype! */
84 if (!RrSurfaceVisible(sur)) return;
86 ok = glXMakeCurrent(RrDisplay(inst), RrSurfaceWindow(sur),RrContext(inst));
89 glViewport(0, 0, RrScreenWidth(inst), RrScreenHeight(inst));
91 glMatrixMode(GL_PROJECTION);
93 glOrtho(RrSurfaceX(sur), RrSurfaceX(sur) + RrSurfaceWidth(sur),
94 RrSurfaceY(sur), RrSurfaceY(sur) + RrSurfaceHeight(sur),
96 glMatrixMode(GL_MODELVIEW);
97 glViewport(0, 0, RrSurfaceWidth(sur), RrSurfaceHeight(sur));
101 glTranslatef(-RrSurfaceX(sur), -RrSurfaceY(sur), 0);
102 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
107 surx += RrSurfaceX(p);
108 sury += RrSurfaceY(p);
112 switch (RrSurfaceType(sur)) {
113 case RR_SURFACE_PLANAR:
114 RrPlanarPaint(sur, surx, sury);
115 e = RrPlanarEdgeWidth(sur);
116 x = RrSurfaceX(sur) + e;
117 y = RrSurfaceY(sur) + e;
118 w = RrSurfaceWidth(sur) - e * 2;
119 h = RrSurfaceHeight(sur) - e * 2;
121 case RR_SURFACE_NONPLANAR:
124 case RR_SURFACE_NONE:
127 w = RrSurfaceWidth(sur);
128 h = RrSurfaceHeight(sur);
132 for (i = 0; i < sur->ntextures; ++i)
133 RrTexturePaint(sur, &sur->texture[i], x, y, w, h);
137 glXSwapBuffers(RrDisplay(inst), RrSurfaceWindow(sur));
139 /* recurse and paint children */
140 for (it = RrSurfaceChildren(sur); it; it = g_slist_next(it)) {
142 RrPaint(it->data, 1);
144 switch (RrSurfaceType(((struct RrSurface*)it->data))) {
145 case RR_SURFACE_NONE:
147 case RR_SURFACE_PLANAR:
148 if (RrPlanarHasAlpha(it->data))
149 RrPaint(it->data, 0);
151 case RR_SURFACE_NONPLANAR: