?? readme.iz
字號:
Here is the patch. I did no testing whatsoever with event watchingrequests present (I need some applications which exersize this beforethis, probably lynx ;-), but the code looks working "the normal way".I had no way to test that the poll() branch compiles/works...Here is the API: *) two new functions wgetch_events() wgetstrn_event() are introduced, which allow an event-watch specification given as the last argument;*) if the last argument is NULL, they behave as wgetch() and wgetstrn() (TESTED!);*) the event specification is a pointer to _nc_eventlist, which contains bookkeeping elements (count and the summary of results), and an array of pointers to _nc_event;*) each _nc_event is a typed union, with two types supported "as shipped": _NC_EVENT_TIMEOUT_MSEC, _NC_EVENT_FILE. For _NC_EVENT_FILE the fields are fd, flag, and the output field.*) The only supported flag "as shipped" is _NC_EVENT_FILE_READABLE. If the file was found readable, the return field is set to this, otherwise to 0;*) If these functions return KEY_EVENT, this means that the return fields in both the _nc_eventlist and _nc_event structures make sense. The field result_flags of _nc_eventlist may have a combination of bits _NC_EVENT_TIMEOUT_MSEC and _NC_EVENT_FILE_READABLE set;*) The timeout_msec field of _NC_EVENT_TIMEOUT_MSEC _nc_event's is updated on return, even if the return is not KEY_EVENT. However, the change in the value represents only the amount of time spent in waiting for events, not the amount of time spent bookkeeping;*) the return KEY_EVENT of wgetstrn_event() means that the output string includes the user input typed so far, but the user did not have a chance to press ENTER (or whatever). This call should be repeated (with "shifted" pointer to a buffer, of course) to complete the input;*) The presence of this extension can be checked via inspecting #ifdef NCURSES_EVENT_VERSION. This symbol is not defined on BeOS, since there is no support for this on BeOS.Known issues: calls interrupted by KEY_EVENT reset the ESCDELAYtimer. This is not entirely new, since other synthetic events behavethe same (see "if (ch >= KEY_MIN)" branch of kgetch()). However,KEY_EVENT may be generated in a continuous stream (say, whendownloading a file), thus this may be more important than with othersynthetic keys. An additional field in window structure which keepstimestamp of the first raw key in the queue may be needed tocircumvent this.Another possible issue: KEY_EVENT has a preference over a user input,so a stream of KEY_EVENT's can make input hard. Maybe useresult_flags as in input parameter too, which specifies whether theuser input should have higher precedence?Also: I took an opportunity to document kgetch() better.Enjoy,Ilya
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -