Path: utzoo!utgpu!watmath!att!ucbvax!tut.cis.ohio-state.edu!bloom-beacon!AARDVARK.UMD.EDU!jonnyg From: jonnyg@AARDVARK.UMD.EDU (Jon Greenblatt) Newsgroups: comp.windows.x Subject: Re: Your double repaint problem Message-ID: <8908302006.AA14200@aardvark.UMD.EDU> Date: 30 Aug 89 20:06:20 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 43 The way I handle multiple repaints in one of my projects is the following. 1: If this is my first repaint event since the screen was last updated I create a region using the x,y,width, and height of the area that needs updating. If this is not my first repaint event I add the new area to be painted to the original region using XUnionRectWithRegion. 2: If the eposure count is 0 at this point I then take the regions I have collected and make them the clipping region of my current graphics context. Here is a short clip of how the regions are collected. This is somewhat dependent on my environment as you can see: LOCAL addclip(Wnd,expose) XlWindow Wnd; XExposeEvent *expose; {XRectangle rect; if (Wnd->clip_count++ == 0) Wnd->clip_region = XCreateRegion(); MAKE_XRECT(rect,expose->x,expose->y, expose->width,expose->height); XUnionRectWithRegion(&rect,Wnd->clip_region, Wnd->clip_region); XClearArea(Dpy,Wnd->id,rect.x,rect.y,rect.width,rect.height,0); } Here is where I set up for clipping: XSetRegion(Dpy,Wnd->expose_gc->id, Wnd->clip_region); XDestroyRegion(Wnd->clip_region); Wnd->clip_count = 0; I use this in my xlisp toolkit. If you would like to see the entire source it in available VIA anonymous FTP from rover.umd.edu(128.8.2.73) in the directory pub/xlisp2.0w.tar.Z. The file of interest is osstuff.x11 as it contains the X11 dependent stuff. Toolkit designers may be interested in some of my encapsulation methods I used here. JonnyG.