margaret%muav.utah.edu@wasatch.utah.edu (Malgorzata Sturgill) (08/31/89)
Hello, I have a following problem.. I am writing this program using Xlib on a color HP Bobcat 4.3 BSD, X11r3. At this moment it does not do much. I am creating main window using XCreateSimpleWindow, Then I open several children using the same call. I Load a font, create a GC( with that font) map the main window and it's children. Then I write some text usinf XDrawImageString in all of the windows.I XFlush after each operation. The strange thing is that the program seems to work fine, as long as there is no window managerrunning ( I tried uwm and awm). Whenever the window manager is running, no text appears on the windows, when I kill the window manager and run the program again, the text appears on the screen. Any Ideas what might be happening? Thanks, margaret
klee@gilroy.pa.dec.com (Ken Lee) (08/31/89)
In article <3239@wasatch.utah.edu>, margaret%muav.utah.edu@wasatch.utah.edu (Malgorzata Sturgill) writes: > The strange thing is that the program seems to work fine, as long as > there is no window > managerrunning ( I tried uwm and awm). This is one of the most common Xlib user errors. X is asyncronous, so there is no guarantee that your window is mapped when the XMapWindow call returns. If it is not mapped (and you are not using or do not have backing store), your drawings drop in the bit bucket. Most X programs wait for an Expose or Map event before drawing. Many just drop into an event loop after setting up their windows, with the initial Expose event being handled the same as any subsequent Expose event. Ken Lee DEC Western Software Laboratory, Palo Alto, Calif. Internet: klee@decwrl.dec.com uucp: uunet!decwrl!klee
jeff1@stretch.mun.edu (Jeff Sparkes) (09/01/89)
In article <1752@bacchus.dec.com> klee@gilroy.pa.dec.com (Ken Lee) writes: In article <3239@wasatch.utah.edu>, margaret%muav.utah.edu@wasatch.utah.edu (Malgorzata Sturgill) writes: > The strange thing is that the program seems to work fine, as long as > there is no window > managerrunning ( I tried uwm and awm). This is one of the most common Xlib user errors. X is asyncronous, so there is no guarantee that your window is mapped when the XMapWindow call returns. If it is not mapped (and you are not using or do not have backing store), your drawings drop in the bit bucket. Most X programs wait for an Expose or Map event before drawing. Many just drop into an event loop after setting up their windows, with the initial Expose event being handled the same as any subsequent Expose event. The window manager also has an effect, or at least used to. I tested under twm and awm, but can't remeber which did what. One would give both events, but only after the second one could you draw. The other gave you only one event, and it was the opposite. i.e. you had to wait for an expose with one, and a map for the other. I guess (hope) this will be solved by ICCCM window managers. -- Jeff Sparkes jeff1@garfield.mun.edu || uunet!garfield!jeff1
root@johnbob.uucp (/4194303) (09/04/89)
In article <418@stretch.MUN.EDU> jeff1@stretch.mun.edu (Jeff Sparkes) writes: >In article <1752@bacchus.dec.com> klee@gilroy.pa.dec.com (Ken Lee) writes: > In article <3239@wasatch.utah.edu>, margaret%muav.utah.edu@wasatch.utah.edu (Malgorzata Sturgill) writes: > > ...as long as there is no window managerrunning ... > ...Most X > programs wait for an Expose or Map event before drawing. Many... >...One would give >both events, but only after the second one could you draw. The other >gave you only one event, and it was the opposite. i.e. you had to >wait for an expose with one, and a map for the other. I guess (hope) this >will be solved by ICCCM window managers. I think you should only have to redraw for an Expose event. Some window managers will re-parent your window and map it, but the parent window will be unmapped and you don't get an expose event. In any case if your window is unmapped you shouldn't get any expose events from it, and if any part of it becomes visible you should get an Expose event. I don't think the type of window manager (ICCCM or not (or none)) will change this (bug/feature) of X. Also, there are situations where multiple expose events and window resizing can cause unexpected output when there are long network delays. You might consider clearing the exposed area before redrawing it when you get an expose event. This is also a (bug/feature) of X. ..!uunet!cs.utexas.edu!ibmaus!auschs!johnbob.austin.ibm.com!root !john John Harvey !johnbob I don't speak for anybody. Not even myself. Please forgive my employers. They know not what I do.