4 ** Copyright (C) 1992, Csaba Biegl
\r
5 ** 820 Stirrup Dr, Nashville, TN, 37221
\r
6 ** csaba@vuse.vanderbilt.edu
\r
8 ** This file is distributed under the terms listed in the document
\r
9 ** "copying.cb", available from the author at the address above.
\r
10 ** A copy of "copying.cb" should accompany this file; if not, a copy
\r
11 ** should be available from where this file was obtained. This file
\r
12 ** may not be distributed without a verbatim copy of "copying.cb".
\r
13 ** You should also have received a copy of the GNU General Public
\r
14 ** License along with this program (it is in the file "copying");
\r
15 ** if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
\r
16 ** Cambridge, MA 02139, USA.
\r
18 ** This program is distributed in the hope that it will be useful,
\r
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
21 ** GNU General Public License for more details.
\r
24 #ifndef _EVENTQUE_H_
\r
25 #define _EVENTQUE_H_
\r
33 * BE CAREFUL when hacking!!! -- 16 and 32 bit compilers have to generate
\r
34 * the same alignments
\r
37 unsigned char evt_type; /* event type: 0: keyboard, 1: mouse */
\r
38 unsigned char evt_kbstat; /* keyboard status (ALT, SHIFT, etc..) */
\r
39 unsigned char evt_mask; /* mouse event mask */
\r
40 unsigned char evt_button; /* button status */
\r
41 unsigned short evt_xpos; /* X coord (or keycode if keybd event) */
\r
42 unsigned short evt_ypos; /* Y coord */
\r
43 unsigned long evt_time; /* time stamp of event */
\r
44 #define evt_keycode evt_xpos /* reuse this slot for keybd events !! */
\r
45 #define evt_scancode evt_ypos /* store here the BIOS scan code */
\r
49 unsigned short evq_maxsize; /* max size of event queue */
\r
50 unsigned short evq_cursize; /* number of events in the queue */
\r
51 unsigned short evq_rdptr; /* next event to read */
\r
52 unsigned short evq_wrptr; /* next event to be written */
\r
53 short evq_xpos; /* current X coordinate of mouse */
\r
54 short evq_ypos; /* current Y coordinate of mouse */
\r
55 short evq_xmin; /* minimal mouse X coordinate */
\r
56 short evq_ymin; /* minimal mouse Y coordinate */
\r
57 short evq_xmax; /* maximal mouse X coordinate */
\r
58 short evq_ymax; /* maximal mouse Y coordinate */
\r
59 short evq_xspeed; /* horizontal speed (mickey/coord) */
\r
60 short evq_yspeed; /* vertical speed (mickey/coord) */
\r
61 unsigned short evq_thresh; /* fast movement threshold */
\r
62 unsigned short evq_accel; /* multiplier for fast move */
\r
63 unsigned char evq_drawmouse; /* interrupt handler has to draw mouse */
\r
64 unsigned char evq_moved; /* set if mouse moved */
\r
65 unsigned char evq_delchar; /* character removed from BIOS buffer */
\r
66 unsigned char evq_enable; /* event generation control flag */
\r
67 EventRecord evq_events[1]; /* event buffer space */
\r
73 #define EVENT_KEYBD 0
\r
74 #define EVENT_MOUSE 1
\r
77 * MOUSE event flag bits
\r
78 * (also defined in "mousex.h" of the graphics library)
\r
82 #define M_MOTION 0x001
\r
83 #define M_LEFT_DOWN 0x002
\r
84 #define M_LEFT_UP 0x004
\r
85 #define M_RIGHT_DOWN 0x008
\r
86 #define M_RIGHT_UP 0x010
\r
87 #define M_MIDDLE_DOWN 0x020
\r
88 #define M_MIDDLE_UP 0x040
\r
89 #define M_BUTTON_DOWN (M_LEFT_DOWN | M_MIDDLE_DOWN | M_RIGHT_DOWN)
\r
90 #define M_BUTTON_UP (M_LEFT_UP | M_MIDDLE_UP | M_RIGHT_UP)
\r
91 #define M_BUTTON_CHANGE (M_BUTTON_UP | M_BUTTON_DOWN )
\r
94 * MOUSE button status bits
\r
100 #endif /* M_MOTION */
\r
103 * KEYBOARD status word bits
\r
104 * (also defined in "mousex.h" of the graphics library)
\r
108 #define KB_RIGHTSHIFT 0x01 /* right shift key depressed */
\r
109 #define KB_LEFTSHIFT 0x02 /* left shift key depressed */
\r
110 #define KB_CTRL 0x04 /* CTRL depressed */
\r
111 #define KB_ALT 0x08 /* ALT depressed */
\r
112 #define KB_SCROLLOCK 0x10 /* SCROLL LOCK active */
\r
113 #define KB_NUMLOCK 0x20 /* NUM LOCK active */
\r
114 #define KB_CAPSLOCK 0x40 /* CAPS LOCK active */
\r
115 #define KB_INSERT 0x80 /* INSERT state active */
\r
117 #define KB_SHIFT (KB_LEFTSHIFT | KB_RIGHTSHIFT)
\r
119 #endif /* KB_SHIFT */
\r
122 * set this bit in 'evq_enable' to generate the corresponding event
\r
124 #define EVENT_ENABLE(type) (1 << (type))
\r
129 #if defined(__TURBOC__) && defined(FOR_GO32)
\r
130 EventQueue *EventQueueInit(int qsize,int ms_stksize,void (*msdraw)(void),int,int);
\r
132 EventQueue *EventQueueInit(int qsize,int ms_stksize,void (*msdraw)(void));
\r
135 void EventQueueDeInit(void);
\r
136 int EventQueueNextEvent(EventQueue *q,EventRecord *e);
\r
142 #endif /* whole file */
\r