[comp.windows.x] No expose after map if backing store?

arne@rrzbu.hanse.de (Arne Ludwig) (01/15/91)

As anybody knows, before drawing to a window just mapped one has to wait
for an exposure event. Fine.

But why does the program below hang on R4 servers with backing store
and runs fine on servers without?

Do I really have to ask the server if it will maintain backing store
before doing the XNextEvent() or is it a bug in the server?

	Xswa.background_pixel = TheBackground;
	Xswa.backing_store = Always;
	TheWindow = XCreateWindow (TheDisplay,
		DefaultRootWindow(TheDisplay),
		0,0,TheWidth,TheHeight,1,
		CopyFromParent,CopyFromParent,
		DefaultVisual(TheDisplay,TheScreen),
		CWBackPixel|CWBackingStore,&Xswa);

	XSelectInput (TheDisplay,TheWindow,ExposureMask);
	XMapWindow (TheDisplay,TheWindow);
	XNextEvent (TheDisplay,&junk);

BTW. How would I ask the server if it will maintain backing store???
-- 
Arne Ludwig		arne@rrzbu.hanse.de	...uunet!??????!rrzbu!arne

stroyan@hpfcso.HP.COM (Mike Stroyan) (01/18/91)

>    As anybody knows, before drawing to a window just mapped one has to wait
>    for an exposure event. Fine.
>
>    But why does the program below hang on R4 servers with backing store
>    and runs fine on servers without?
>
>    Do I really have to ask the server if it will maintain backing store
>    before doing the XNextEvent() or is it a bug in the server?

I suggest that rather than just asking for ExposureMask you also ask for
StructureNotifyMask and proceed after a MapNotify event.  Asking for
ExposureMask is still a good idea since the server may generate
exposures instead of offering backing store.

Mike Stroyan, mike_stroyan@fc.hp.com

toml@ninja.Solbourne.COM (Tom LaStrange) (01/18/91)

   >    As anybody knows, before drawing to a window just mapped one has to wait
   >    for an exposure event. Fine.
   >
   >    But why does the program below hang on R4 servers with backing store
   >    and runs fine on servers without?
   >
   >    Do I really have to ask the server if it will maintain backing store
   >    before doing the XNextEvent() or is it a bug in the server?

   I suggest that rather than just asking for ExposureMask you also ask for
   StructureNotifyMask and proceed after a MapNotify event.  Asking for
   ExposureMask is still a good idea since the server may generate
   exposures instead of offering backing store.

Hi Mike,
It's been my experience that if the server provides backing store it may
send you an Expose event even before mapping the window.  Wouldn't waiting
for an Expose event following a MapNotify potentially not work?

--
Tom LaStrange        toml@Solbourne.COM

stroyan@hpfcso.HP.COM (Mike Stroyan) (01/22/91)

>    Hi Mike,
>    It's been my experience that if the server provides backing store it may
>    send you an Expose event even before mapping the window.  Wouldn't waiting
>    for an Expose event following a MapNotify potentially not work?

Hi Tom,

  Waiting for both could definitely be trouble.  I meant to suggest that
  programs wait for a MapNotify before rendering, and that they subsequently
  react to Expose events.

Mike Stroyan, mike_stroyan@fc.hp.com.

mouse@larry.mcrcim.mcgill.EDU (01/24/91)

>>> As anybody knows, before drawing to a window just mapped one has to
>>> wait for an exposure event. Fine.
>>> But why does the program below hang on R4 servers with backing
>>> store and runs fine on servers without?
>> I suggest that rather than just asking for ExposureMask you also ask
>> for StructureNotifyMask and proceed after a MapNotify event.  Asking
>> for ExposureMask is still a good idea since the server may generate
>> exposures instead of offering backing store.
> It's been my experience that if the server provides backing store it
> may send you an Expose event even before mapping the window.
> Wouldn't waiting for an Expose event following a MapNotify
> potentially not work?

Perfectly true.

So why mess with MapNotify events at all?  Just draw when you get an
Expose.  Clean and, provided you take care that the window is created
with ExposureMask selected, foolproof despite servers changing their
minds on the fly about supporting backing-store....

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu