June 1994
Intermediate to advanced
821 pages
24h 40m
English
selectEvents selects events for all the windows
of the application.
Example 14-11. basecalc — the selectEvents routine
selectEvents ()
{
int win;
/* Window behind calculator */
XSelectInput (display, calcWin, KeyPressMask|KeyReleaseMask);
/* Where results are drawn */
XSelectInput (display, dispWin, ExposureMask);
/* Pad windows */
for (win = 1; win < NBUTTONS; win++)
XSelectInput (display, Buttons[win].ID,
ExposureMask|ButtonPressMask|ButtonReleaseMask|
EnterWindowMask|LeaveWindowMask);
}The entire calculator window requires key events, because we want to be able to operate the calculator from the keyboard as well as with the pointer.
The display window (dispWin) requires exposure
events, because it must be able to refresh itself for the usual
reasons.
All other windows (pads) require exposure events for refresh, button events for selection, and border crossing events so that the button only needs to be released within a pad to activate the pad. This last feature makes it easier to work quickly with the calculator.
Read now
Unlock full access