From 974aaa956afc13976666bf73fe3e39aa65d8c31a Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 28 May 2003 02:30:39 +0000 Subject: [PATCH] pass expose events like i was before. cleanups in rendering to not render areas anymore. pass the surface's absx/y to planar's paint func --- openbox/event.c | 2 +- render2/paint.c | 30 ++++++++++-------------------- render2/planar.c | 2 +- render2/planar.h | 2 +- render2/render.h | 15 ++++++++------- render2/surface.c | 14 ++++++++++++++ render2/test.c | 7 ++----- 7 files changed, 37 insertions(+), 35 deletions(-) diff --git a/openbox/event.c b/openbox/event.c index 0d15711f..736cdd8f 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -136,7 +136,7 @@ void event_loop() /* we don't use exposes but the render lib wants them all! */ if (ob_state != State_Exiting && e.type == Expose) - RrExpose(ob_render_inst, &e); + RrExpose(ob_render_inst, &e.xexpose); #ifdef USE_LIBSN sn_display_process_event(ob_sn_display, &e); diff --git a/render2/paint.c b/render2/paint.c index 2037e99a..7b00f59b 100644 --- a/render2/paint.c +++ b/render2/paint.c @@ -21,35 +21,25 @@ struct ExposeArea { a->y = MIN(a->y, y) -void RrExpose(struct RrInstance *inst, XEvent *e) +void RrExpose(struct RrInstance *inst, XExposeEvent *e) { XEvent e2; - GSList *tops = NULL, *it, *n; struct RrSurface *sur; + Window win; - e2 = *e; - if ((sur = RrInstaceLookupSurface(inst, e2.xexpose.window))) { - while (XCheckTypedWindowEvent(RrDisplay(inst), Expose, - e->xexpose.window, &e2)); - while (sur->parent && - RrSurfaceType(sur->parent) != RR_SURFACE_NONE) { + win = e->window; + + if ((sur = RrInstaceLookupSurface(inst, win))) { + while (XCheckTypedWindowEvent(RrDisplay(inst), Expose, win, &e2)); + while (sur->parent && RrSurfaceType(sur->parent) != RR_SURFACE_NONE) sur = sur->parent; - } RrPaint(sur); - } else { - RrDebug("Unable to find surface for window 0x%lx\n", - e2.xexpose.window); - } + } else + RrDebug("Unable to find surface for window 0x%lx\n", win); } /*! Paints the surface, and all its children */ void RrPaint(struct RrSurface *sur) -{ - RrPaintArea(sur, 0, 0, RrSurfaceWidth(sur), RrSurfaceHeight(sur)); -} - -/*! Paints the surface, and all its children, but only in the given area. */ -void RrPaintArea(struct RrSurface *sur, int x, int y, int w, int h) { struct RrInstance *inst; struct RrSurface *p; @@ -97,7 +87,7 @@ void RrPaintArea(struct RrSurface *sur, int x, int y, int w, int h) switch (RrSurfaceType(sur)) { case RR_SURFACE_PLANAR: - RrPlanarPaint(sur, surx + x, sury + y, w, h); + RrPlanarPaint(sur, surx, sury); break; case RR_SURFACE_NONPLANAR: assert(0); diff --git a/render2/planar.c b/render2/planar.c index 945427c9..62684e47 100644 --- a/render2/planar.c +++ b/render2/planar.c @@ -63,7 +63,7 @@ static void copy_parent(struct RrSurface *sur) } } -void RrPlanarPaint(struct RrSurface *sur, int x, int y, int w, int h) +void RrPlanarPaint(struct RrSurface *sur, int absx, int absy) { struct RrColor *pri, *sec, avg; int x, y, w, h; diff --git a/render2/planar.h b/render2/planar.h index c22c2386..c394c98e 100644 --- a/render2/planar.h +++ b/render2/planar.h @@ -14,7 +14,7 @@ struct RrPlanarSurface { #define RrPlanarPrimaryColor(sur) ((sur)->data.planar.primary) #define RrPlanarSecondaryColor(sur) ((sur)->data.planar.secondary) -void RrPlanarPaint(struct RrSurface *sur, int x, int y, int w, int h); +void RrPlanarPaint(struct RrSurface *sur, int absx, int absy); void RrPlanarMinSize(struct RrSurface *sur, int *w, int *h); diff --git a/render2/render.h b/render2/render.h index 08c60b7d..5e218b8e 100644 --- a/render2/render.h +++ b/render2/render.h @@ -112,6 +112,12 @@ void RrSurfaceSetArea(struct RrSurface *sur, int y, int w, int h); +void RrSurfaceSetPos(struct RrSurface *sur, + int x, + int y); +void RrSurfaceSetSize(struct RrSurface *sur, + int w, + int h); Window RrSurfaceWindow(struct RrSurface *sur); @@ -190,12 +196,7 @@ void RrTextureSetNone(struct RrSurface *sur, /*! Paints the surface, and all its children */ void RrPaint(struct RrSurface *sur); -/*! Paints the surface, and all its children, but only in the given area. */ -void RrPaintArea(struct RrSurface *sur, - int x, - int y, - int w, - int h); -void RrExpose(struct RrInstance *inst, XEvent *e); + +void RrExpose(struct RrInstance *inst, XExposeEvent *e); #endif diff --git a/render2/surface.c b/render2/surface.c index a8243130..b4e03370 100644 --- a/render2/surface.c +++ b/render2/surface.c @@ -170,6 +170,20 @@ void RrSurfaceFree(struct RrSurface *sur) } } +void RrSurfaceSetPos(struct RrSurface *sur, + int x, + int y) +{ + RrSurfaceSetArea(sur, x, y, sur->w, sur->h); +} + +void RrSurfaceSetSize(struct RrSurface *sur, + int w, + int h) +{ + RrSurfaceSetArea(sur, sur->x, sur->y, w, h); +} + void RrSurfaceSetArea(struct RrSurface *sur, int x, int y, diff --git a/render2/test.c b/render2/test.c index 8001ab8f..27934d09 100644 --- a/render2/test.c +++ b/render2/test.c @@ -85,16 +85,13 @@ int main() /* fall through ... */ } else { while (XCheckTypedWindowEvent(display, win, Expose, &report)); - RrPaintArea(sur, report.xexpose.x, report.xexpose.y, - report.xexpose.width, report.xexpose.height); + RrPaint(sur); break; } case ConfigureNotify: while (XCheckTypedWindowEvent(display, win, ConfigureNotify, &report)); - RrSurfaceSetArea(sur, - report.xconfigure.x, - report.xconfigure.y, + RrSurfaceSetSize(sur, report.xconfigure.width, report.xconfigure.height); break; -- 2.34.1