Path: utzoo!utgpu!attcan!uunet!husc6!bloom-beacon!WHEATIES.AI.MIT.EDU!dms
From: dms@WHEATIES.AI.MIT.EDU (David M Siegel)
Newsgroups: comp.windows.x
Subject: question regarding exposure events in toolkit
Message-ID: <8808151959.AA04645@cheerios.ai.mit.edu>
Date: 15 Aug 88 19:59:16 GMT
Sender: daemon@bloom-beacon.MIT.EDU
Organization: The Internet
Lines: 35

I've written a simple toolkit application that uses a
simpleWidgetClass widget. I do raw X graphics operations to the
widget's window. I'm having trouble handling exposure events for the
window. Whenever the window gets any kind of real exposure event (that
is, some rectangle of the window has really changed) I want to redraw
the entire window (to keep things simple). Thus, it's necessary for
the exposure events to be "compressed". How does one go about doing
this? I've tried several schemes, including the following, which get
both multiple exposure events in some cases, and miss exposure events
altogether in other cases.

In main():

    XtAddEventHandler(simple, Expose, 1, do_expose, 0);

The handler:

do_expose(w, data, e)
Widget w;
char *data;
XEvent *e;
{
    XExposeEvent *event = (XExposeEvent *) e;

    if (event->count == 0) {
	do_display(last_x, last_y);
	XFlush(XtDisplay(simple));
    }
}

What's wrong with this?

Thanks!

-Dave