xref: /freebsd/contrib/ncurses/include/curses.events (revision fe75646a0234a261c0013bf1840fdac4acaf0cec)
1/* $Id*/
2/*
3 * vile:cmode:
4 * This file is part of ncurses, designed to be appended after curses.h.in
5 * (see that file for the relevant copyright).
6 */
7
8/*
9 * This is an extension to support events...
10 */
11#ifdef NCURSES_WGETCH_EVENTS
12#if !defined(__BEOS__) || defined(__HAIKU__)
13   /* Fix _nc_timed_wait() on BEOS... */
14#  define NCURSES_EVENT_VERSION	1
15#endif	/* !defined(__BEOS__) */
16
17/*
18 * Bits to set in _nc_event.data.flags
19 */
20#  define _NC_EVENT_TIMEOUT_MSEC	1
21#  define _NC_EVENT_FILE		2
22#  define _NC_EVENT_FILE_READABLE	2
23#  if 0					/* Not supported yet... */
24#    define _NC_EVENT_FILE_WRITABLE	4
25#    define _NC_EVENT_FILE_EXCEPTION	8
26#  endif
27
28typedef struct
29{
30    int type;
31    union
32    {
33	long timeout_msec;	/* _NC_EVENT_TIMEOUT_MSEC */
34	struct
35	{
36	    unsigned int flags;
37	    int fd;
38	    unsigned int result;
39	} fev;				/* _NC_EVENT_FILE */
40    } data;
41} _nc_event;
42
43typedef struct
44{
45    int count;
46    int result_flags;	/* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */
47    _nc_event *events[1];
48} _nc_eventlist;
49
50extern NCURSES_EXPORT(int) wgetch_events (WINDOW *, _nc_eventlist *) GCC_DEPRECATED(experimental option); /* experimental */
51extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *) GCC_DEPRECATED(experimental option); /* experimental */
52
53#define KEY_EVENT	0633		/* We were interrupted by an event */
54
55#endif /* NCURSES_WGETCH_EVENTS */
56