]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/README.IZ
2952f6854e5ab0199bb1c8ca83a81d14ae0952a2
[ncurses.git] / ncurses / README.IZ
1 Here is the patch.  I did no testing whatsoever with event watching
2 requests present (I need some applications which exersize this before
3 this, probably lynx ;-), but the code looks working "the normal way".
4
5 I had no way to test that the poll() branch compiles/works...
6
7 Here is the API: 
8
9 *) two new functions wgetch_events() wgetstrn_event() are introduced,
10    which allow an event-watch specification given as the last argument;
11
12 *) if the last argument is NULL, they behave as wgetch() and
13    wgetstrn() (TESTED!);
14
15 *) the event specification is a pointer to _nc_eventlist, which
16    contains bookkeeping elements (count and the summary of results),
17    and an array of pointers to _nc_event;
18
19 *) each _nc_event is a typed union, with two types supported "as
20    shipped": _NC_EVENT_TIMEOUT_MSEC, _NC_EVENT_FILE.  For
21    _NC_EVENT_FILE the fields are fd, flag, and the output field.
22
23 *) The only supported flag "as shipped" is _NC_EVENT_FILE_READABLE.
24    If the file was found readable, the return field is set to this,
25    otherwise to 0;
26
27 *) If these functions return KEY_EVENT, this means that the return
28    fields in both the _nc_eventlist and _nc_event structures make
29    sense.  The field result_flags of _nc_eventlist may have a
30    combination of bits _NC_EVENT_TIMEOUT_MSEC and _NC_EVENT_FILE_READABLE
31    set;
32
33 *) The timeout_msec field of _NC_EVENT_TIMEOUT_MSEC _nc_event's is
34    updated on return, even if the return is not KEY_EVENT.  However,
35    the change in the value represents only the amount of time spent in
36    waiting for events, not the amount of time spent bookkeeping;
37
38 *) the return KEY_EVENT of wgetstrn_event() means that the output
39    string includes the user input typed so far, but the user did not have
40    a chance to press ENTER (or whatever).  This call should be
41    repeated (with "shifted" pointer to a buffer, of course) to
42    complete the input;
43
44 *) The presence of this extension can be checked via inspecting
45    #ifdef NCURSES_EVENT_VERSION.  This symbol is not defined on BeOS,
46    since there is no support for this on BeOS.
47
48 Known issues:  calls interrupted by KEY_EVENT reset the ESCDELAY
49 timer.  This is not entirely new, since other synthetic events behave
50 the same (see "if (ch >= KEY_MIN)" branch of kgetch()).  However,
51 KEY_EVENT may be generated in a continuous stream (say, when
52 downloading a file), thus this may be more important than with other
53 synthetic keys.  An additional field in window structure which keeps
54 timestamp of the first raw key in the queue may be needed to
55 circumvent this.
56
57 Another possible issue: KEY_EVENT has a preference over a user input,
58 so a stream of KEY_EVENT's can make input hard.  Maybe use
59 result_flags as in input parameter too, which specifies whether the
60 user input should have higher precedence?
61
62 Also: I took an opportunity to document kgetch() better.
63
64 Enjoy,
65 Ilya