[comp.windows.x] missing event reading functionality

guido@cwi.nl (Guido van Rossum) (05/03/88)

Looking through chapter 8 of the Xlib documentation I find that the
event reading/checking routines can be organized in a matrix, as
follows:

		| get event,	| get event,		| read event but
		| block if 	| return False		| leave it in queue
		| necessary	| if none queued	| (may block)
----------------+---------------+-----------------------+------------
plain		| XNextEvent	| ?			| XPeekEvent
w/ predicate	| XIfEvent	| XCheckIfEvent		| XPeekIfEvent
for a window	| XWindowEvent	| XCheckWindowEvent	| ?
w/ event mask	| XMaskEvent	| XCheckMaskEvent	| ?
w/ type		| XTypeEvent	| XCheckTypeEvent	| ?

The hole on the top row is almost, but not completely, filled by
XPending; but it doesn't read the event if there is one (and its name
isn't XCheckEvent :-).

I wonder if the last column is as empty as it is because the designers
of Xlib were tired of specifying all those routines that are so much
alike.  With the documentation style they've adopted it's certainly
tedious for the reader to find out what the differences between all
those routines are.  For instance, it took some close reading to find
that really all these functions block when there is no suitable event
ready except the 'Check' column.

I understand that writing a good manual is hard work and the X
Consortium are understaffed, etc.  Still, especially for an audience of
programmers, a formal description needn't be longer than an informal
one.  In the above case I can imagine an explanation of all functions in
terms of the X*IfEvent row with different predicates and a little C
code, which could be a lot clearer on much less paper.

(Something else that's missing from the Xlib docs are examples.  I can
think of several discussions that could be made a lot clearer with fewer
words but more examples, especially pictures of the output produced.
For example, have a look at XDrawText.)
--
Guido van Rossum, Centre for Mathematics and Computer Science (CWI), Amsterdam
guido@piring.cwi.nl or mcvax!piring!guido or guido%piring.cwi.nl@uunet.uu.net

elliott@hpfcdq.HP.COM (Ian Elliott) (05/04/88)

/ guido@cwi.nl (Guido van Rossum) /  3:43 pm  May  2, 1988 /

> Looking through chapter 8 of the Xlib documentation I find that the
> event reading/checking routines can be organized in a matrix, as
> follows:
> 
> 		| get event,	| get event,		| read event but
> 		| block if 	| return False		| leave it in queue
> 		| necessary	| if none queued	| (may block)
> ----------------+---------------+-----------------------+------------
> plain		| XNextEvent	| ?			| XPeekEvent
> w/ predicate	| XIfEvent	| XCheckIfEvent		| XPeekIfEvent
> for a window	| XWindowEvent	| XCheckWindowEvent	| ?
> w/ event mask	| XMaskEvent	| XCheckMaskEvent	| ?
> w/ type		| XTypeEvent	| XCheckTypeEvent	| ?
> 
> The hole on the top row is almost, but not completely, filled by
> XPending; but it doesn't read the event if there is one (and its name
> isn't XCheckEvent :-).

I would also like to put a plug in for the addition of an XCheckEvent (or
XCheckNextEvent) procedure!  I have some code that really needs that
functionality.

						Ian Elliott

ARPA:	elliott%hpfcian@hplabs.HP.COM
UUCP:	hplabs!hpfcla!elliott
Tele:	(303) 229-4272