[comp.windows.x] Discarding expose events via Xtoolkit.

Luis@postgres.Berkeley.EDU (Luis Miguel) (02/22/89)

	i am writing a widget which is a subclass of composite.
When I remove some of its child widgets, I get an expose event per
call to XtDestroyWidget. Since I remove many widgets at a time,
I would like to be able to get the first expose event, and then
get rid of the rest.
(Note: by expose events I mean calls to my ChangeManaged routine which
I assume is called by the Xtoolkit when an expose event arrives).
Does the toolkit support such a thing? Or do I need to go down to
the Xlib level and flush the events myself?

What I tried to do, and did not work due to the asynchronous nature of X, ids
to add a flag which is set to false when I start destrying widgets and
set to true when done. This flag is tested in my ChangeManaged routine.

Thanks,

/Luis

Luis Miguel. Computer Science Division, UC Berkeley.
arpanet: luis@postgres.Berkeley.EDU         
uucp: {ihnp4,decvax}!ucbvax!ingres!luis                    
at&t: (415) 642-9585 (Work)

kit@ATHENA.MIT.EDU (Chris D. Peterson) (03/02/89)

> 	i am writing a widget which is a subclass of composite.
> When I remove some of its child widgets, I get an expose event per
> call to XtDestroyWidget. Since I remove many widgets at a time,
> I would like to be able to get the first expose event, and then
> get rid of the rest.
> (Note: by expose events I mean calls to my ChangeManaged routine which
> I assume is called by the Xtoolkit when an expose event arrives).
> Does the toolkit support such a thing? Or do I need to go down to
> the Xlib level and flush the events myself?

There is a field in the composite class the compresses exposure events.
I am not sure of the mechanics of this, but it may do what you want.  In order
to have any hope of things working right you will need to destroy all
widgets that will have their exposures compressed before a call to XtNextEvent()
which is in XtMailLoop().  

No, I am not sure it will work, but this is the only magic method that I can 
think of that is supported by the toolkit.  If you want do it yourself, there
is no reason not to look into the event queue and pull out all expose events
pending for the window of your composite widget.

						I hope this helps,

						Chris D. Peterson     
						MIT X Consortium /
						Project Athena 

Net:	kit@athena.mit.edu		
Phone: (617) 253 - 1326			
USMail: MIT - Room E40-321
	77 Massachusetts Ave.		
	Cambridge, MA 02139		




- ------- End of Unsent Draft

------- End of Forwarded Message