Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!munnari.oz.au!manuel!ccadfa!sserve!csadfa!gfreeman From: gfreeman@csadfa.cs.adfa.oz.au (Graham Freeman) Newsgroups: comp.windows.x Subject: Fast redraw after expose events Message-ID: <1991Apr4.053315.25887@sserve.cc.adfa.oz.au> Date: 4 Apr 91 05:33:15 GMT Sender: news@sserve.cc.adfa.oz.au Organization: Australian Defence Force Academy, Canberra, Australia Lines: 48 We are building a graphics application using X windows, and do not know what is the best way to handle window exposures in the server. The window we are drawing in can take several minutes to draw, and is typically 1000 by 1000 (8-bit) pixels. We want the program to run on a variety of X terminals/workstations. (We are currently building the application on a DecStation 5000/200 running DecWindows, with the server on a SUN or another DECstation; we hope to migrate to OSF/MOTIF in the near future.) We would like to create an off-screen pixmap in the server, so that window expose events could be handled immediately using XCopyPlane, say, rather than having to redraw the whole window from scratch. However, resources on the server are often limited, and requesting memory for the off-screen pixmap cannot be guaranteed to succeed. Worse than that, attempts to obtain sufficient memory for the pixmap when it is not available cause the client process to abort. The alternative is to hold the off-screen pixmap in the client, and to use XGetImage to retrieve from the server the drawn screen pixmap. Window exposures would be handled by XPutImage to send the pixmap over the network to the server for immediate display. When we have tried this approach, we have seen longer refresh times because of network traffic and the volume of information being sent, but otherwise acceptable performance, except for one major obstacle. If the drawing window is partly obscured by other windows when drawn (typically because the worker wants to do something productive in another window while the application is still drawing), the pixmap retrieved by XGetImage is incomplete, containing the obscuring window along with the remainder of the desired contents. What we seem to need, given that we cannot be guaranteed sufficient memory in the server or even the ability to find out by request if the server might have sufficient resources, is the ability to construct the drawn pixmap within the client alone. Is this possible? How have other people handled this problem? Surely others have tackled applications where redraw time prohibits the simple-minded approach of a complete redraw on each expose event, which seems to be all that X provides for. Is there some way of "manually" building an XImage structure containing our image on the client side? Graham Freeman David Rubie Computer Science Department Australian Defence Force Academy