[comp.windows.x] Another toolkit question

josh@mit-vax.LCS.MIT.EDU (Joshua Marantz) (11/21/88)

[Summary:  How do I detect typeahead in the toolkit?]

Text editors often check the event queue for typeahead so that they
can abort screen refreshes.  This allows (for example) emacs to be
effectively used at low baud rates.

Emacs can simply ask whether there is any input pending or not because
it is capable of efficiently regenerating the display even if the
typed-ahead character didn't do very much.

An editor that had a more difficult time regenerating partially corrupt
displays might need to determine whether any of the typed-ahead characters
would cause a major refresh, and thereby justify interrupting the current
refresh.

To accomplish this in the toolkit, we would need to have a function

	XtWidgetMaskIfEvent (widget, event_mask, predicate, user_data);

that calls the predicate for each event that is included in the mask and is
pending on the specified widget.

Even better would be to take advantage of the toolkit's translation management,
rather than passing in raw events.  I'm not quite sure what form this would
take.

Can I do something like that with the existing intrinsics?

-Joshua Marantz
Viewlogic Systems, Inc.

asente@decwrl.dec.com (Paul Asente) (11/23/88)

In article <5120@mit-vax.LCS.MIT.EDU> josh@mit-vax.LCS.MIT.EDU (Joshua Marantz) writes:
>[Summary:  How do I detect typeahead in the toolkit?]
>
>To accomplish this in the toolkit, we would need to have a function
>	XtWidgetMaskIfEvent (widget, event_mask, predicate, user_data);

It's perfectly ok to call the Xlib routines to look for typeahead.  Just
pull the display and window out of the widget with XtDisplay and XtWindow.

	-paul asente
	    asente@decwrl.dec.com	decwrl!asente