Path: utzoo!attcan!uunet!husc6!bloom-beacon!EXPO.LCS.MIT.EDU!jim From: jim@EXPO.LCS.MIT.EDU (Jim Fulton) Newsgroups: comp.windows.x Subject: Re: what's wrong with this program? (X11) Message-ID: <8807221850.AA26376@EXPO.LCS.MIT.EDU> Date: 22 Jul 88 18:50:29 GMT References: <12080@duke.cs.duke.edu> Sender: daemon@bloom-beacon.MIT.EDU Organization: X Consortium, MIT Laboratory for Computer Science Lines: 29 > [describes mapping window and drawing without waiting for an expose event] You *must* select for ExposureMask on the window and then wait for an Expose event before drawing. This is to allow the window manager to grab the Map request, ask the user to size and place the window (if appropriate), and then do the real map. For example, pw = XCreateSimpleWindow(dpy, rootw, 0, 0, width / 4, height / 4, BORDER, white_pixel, black_pixel); XSelectInput (dpy, pw, ExposureMask); XMapWindow (dpy, pw); ... /* wait for exposure */ while (1) { XEvent event; XWindowEvent (dpy, pw, ExposureMask, &event); if (event.type == Expose) break; } If you want to specify events later, then you can call XSelectInput again. Jim Fulton MIT X Consortium