1/*
2 * @APPLE_LICENSE_HEADER_START@
3 *
4 * Copyright (c) 1999-2009 Apple Computer, Inc.  All Rights Reserved.
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/******************************************************************************
24	event.h (PostScript side version)
25
26	CONFIDENTIAL
27	Copyright (c) 1988 NeXT, Inc. as an unpublished work.
28	All Rights Reserved.
29
30	Created Leo 01Mar88
31
32	Modified:
33	04May88 Leo  Final event types and record
34	22Aug88 Leo  Change short -> int for window, add reserved
35	26May90 Ted  Added NX_UNDIMMASK to correct triggering of UndoAutoDim
36	12Dec91 Mike Brought into sync with dpsclient/event.h, and fixed
37		     the #ifndef interlock with dpsclient/event.h that was
38		     broken during the Great Header Revision.
39
40	The PostScript version of this file differs from the
41	Window Kit version in that the coordinates here are
42	ints instead of floats.
43******************************************************************************/
44
45#ifndef _DEV_EVENT_H
46#define _DEV_EVENT_H
47
48#include <libkern/OSTypes.h>
49#include <IOKit/hidsystem/IOHIDTypes.h>
50
51#ifdef EVENT_H		/* Interlock with dpsclient/event.h */
52#if !defined(_NXSIZE_)	/* Work around patch for old event.h in Phase 3 projs*/
53#define _NXSIZE_	1	/* NXCoord, NXPoint, NXSize decl seen */
54#define _NXSize_	NXSize
55#endif /* _NXSIZE_ */
56#else  /* EVENT_H */		/* Haven't seen dpsclient/event.h, so define away */
57#define EVENT_H
58
59#ifdef	KERNEL
60#else	/* KERNEL */
61
62#if !defined(_NXSIZE_)	/* Work around patch for old event.h in Phase 3 projs*/
63#define _NXSIZE_	1	/* NXCoord, NXPoint, NXSize decl seen */
64typedef float   NXCoord;
65
66typedef struct _NXPoint {	/* point */
67    NXCoord         x, y;
68} NXPoint;
69
70typedef struct _NXSize {	/* size */
71    NXCoord         width, height;
72} NXSize;
73#define _NXSize_	NXSize	/* Correct usage in event_status_driver.h */
74#endif /* _NXSIZE_ */
75
76#endif	/* KERNEL */
77
78/* Event types */
79
80#define NX_NULLEVENT		0	/* internal use */
81
82/* mouse events */
83
84#define NX_LMOUSEDOWN		1	/* left mouse-down event */
85#define NX_LMOUSEUP		2	/* left mouse-up event */
86#define NX_RMOUSEDOWN		3	/* right mouse-down event */
87#define NX_RMOUSEUP		4	/* right mouse-up event */
88#define NX_MOUSEMOVED		5	/* mouse-moved event */
89#define NX_LMOUSEDRAGGED	6	/* left mouse-dragged event */
90#define NX_RMOUSEDRAGGED	7	/* right mouse-dragged event */
91#define NX_MOUSEENTERED		8	/* mouse-entered event */
92#define NX_MOUSEEXITED		9	/* mouse-exited event */
93
94/* other mouse events
95 *
96 * event.data.mouse.buttonNumber should contain the
97 * button number (2-31) changing state.
98 */
99#define NX_OMOUSEDOWN		25	/* other mouse-down event */
100#define NX_OMOUSEUP		26	/* other mouse-up event */
101#define NX_OMOUSEDRAGGED	27	/* other mouse-dragged event */
102
103/* keyboard events */
104
105#define NX_KEYDOWN		10	/* key-down event */
106#define NX_KEYUP		11	/* key-up event */
107#define NX_FLAGSCHANGED		12	/* flags-changed event */
108
109/* composite events */
110
111#define NX_KITDEFINED		13	/* application-kit-defined event */
112#define NX_SYSDEFINED		14	/* system-defined event */
113#define NX_APPDEFINED		15	/* application-defined event */
114/* There are additional DPS client defined events past this point. */
115
116/* Scroll wheel events */
117
118#define NX_SCROLLWHEELMOVED	22
119
120/* Zoom events */
121#define NX_ZOOM             28
122
123/* tablet events */
124
125#define NX_TABLETPOINTER	23	/* for non-mousing transducers */
126#define NX_TABLETPROXIMITY	24  /* for non-mousing transducers */
127
128/* event range */
129
130#define NX_FIRSTEVENT		0
131#define NX_LASTEVENT		28
132#define NX_NUMPROCS		(NX_LASTEVENT-NX_FIRSTEVENT+1)
133
134/* Event masks */
135#define NX_NULLEVENTMASK        (1 << NX_NULLEVENT)     /* NULL event */
136#define NX_LMOUSEDOWNMASK       (1 << NX_LMOUSEDOWN)	/* left mouse-down */
137#define NX_LMOUSEUPMASK         (1 << NX_LMOUSEUP)      /* left mouse-up */
138#define NX_RMOUSEDOWNMASK       (1 << NX_RMOUSEDOWN)	/* right mouse-down */
139#define NX_RMOUSEUPMASK         (1 << NX_RMOUSEUP)      /* right mouse-up */
140#define NX_OMOUSEDOWNMASK       (1 << NX_OMOUSEDOWN)	/* other mouse-down */
141#define NX_OMOUSEUPMASK         (1 << NX_OMOUSEUP)      /* other mouse-up  */
142#define NX_MOUSEMOVEDMASK       (1 << NX_MOUSEMOVED)	/* mouse-moved */
143#define NX_LMOUSEDRAGGEDMASK	(1 << NX_LMOUSEDRAGGED)	/* left-dragged */
144#define NX_RMOUSEDRAGGEDMASK	(1 << NX_RMOUSEDRAGGED)	/* right-dragged */
145#define NX_OMOUSEDRAGGEDMASK	(1 << NX_OMOUSEDRAGGED)	/* other-dragged */
146#define NX_MOUSEENTEREDMASK     (1 << NX_MOUSEENTERED)	/* mouse-entered */
147#define NX_MOUSEEXITEDMASK      (1 << NX_MOUSEEXITED)	/* mouse-exited */
148#define NX_KEYDOWNMASK          (1 << NX_KEYDOWN)       /* key-down */
149#define NX_KEYUPMASK            (1 << NX_KEYUP)         /* key-up */
150#define NX_FLAGSCHANGEDMASK     (1 << NX_FLAGSCHANGED)	/* flags-changed */
151#define NX_KITDEFINEDMASK       (1 << NX_KITDEFINED)	/* kit-defined */
152#define NX_SYSDEFINEDMASK       (1 << NX_SYSDEFINED)	/* system-defined */
153#define NX_APPDEFINEDMASK       (1 << NX_APPDEFINED)	/* app-defined */
154#define NX_SCROLLWHEELMOVEDMASK	(1 << NX_SCROLLWHEELMOVED)	/* scroll wheel moved */
155#define NX_ZOOMMASK             (1 << NX_ZOOM)          /* Zoom */
156#define NX_TABLETPOINTERMASK	(1 << NX_TABLETPOINTER)	/* tablet pointer moved */
157#define NX_TABLETPROXIMITYMASK	(1 << NX_TABLETPROXIMITY)	/* tablet pointer proximity */
158
159#define EventCodeMask(type)	(1 << (type))
160#define NX_ALLEVENTS		-1	/* Check for all events */
161
162/* sub types for mouse and move events */
163
164#define NX_SUBTYPE_DEFAULT					0
165#define NX_SUBTYPE_TABLET_POINT				1
166#define NX_SUBTYPE_TABLET_PROXIMITY			2
167#define NX_SUBTYPE_MOUSE_TOUCH              3
168
169/* sub types for system defined events */
170
171#define NX_SUBTYPE_POWER_KEY				1
172#define NX_SUBTYPE_AUX_MOUSE_BUTTONS		7
173
174/*
175 * NX_SUBTYPE_AUX_CONTROL_BUTTONS usage
176 *
177 * The incoming NXEvent for other mouse button down/up has event.type
178 * NX_SYSDEFINED and event.data.compound.subtype NX_SUBTYPE_AUX_MOUSE_BUTTONS.
179 * Within the event.data.compound.misc.L[0] contains bits for all the buttons
180 * that have changed state, and event.data.compound.misc.L[1] contains the
181 * current button state as a bitmask, with 1 representing down, and 0
182 * representing up.  Bit 0 is the left button, bit one is the right button,
183 * bit 2 is the center button and so forth.
184 */
185#define NX_SUBTYPE_AUX_CONTROL_BUTTONS		8
186
187#define NX_SUBTYPE_EJECT_KEY				10
188#define NX_SUBTYPE_SLEEP_EVENT				11
189#define NX_SUBTYPE_RESTART_EVENT			12
190#define NX_SUBTYPE_SHUTDOWN_EVENT			13
191
192#define NX_SUBTYPE_STICKYKEYS_ON			100
193#define NX_SUBTYPE_STICKYKEYS_OFF			101
194#define NX_SUBTYPE_STICKYKEYS_SHIFT			102
195#define NX_SUBTYPE_STICKYKEYS_CONTROL			103
196#define NX_SUBTYPE_STICKYKEYS_ALTERNATE			104
197#define NX_SUBTYPE_STICKYKEYS_COMMAND			105
198#define NX_SUBTYPE_STICKYKEYS_RELEASE			106
199#define NX_SUBTYPE_STICKYKEYS_TOGGLEMOUSEDRIVING	107
200
201// New stickykeys key events
202// These were created to send an event describing the
203// different state of the modifiers
204#define NX_SUBTYPE_STICKYKEYS_SHIFT_DOWN		110
205#define NX_SUBTYPE_STICKYKEYS_CONTROL_DOWN		111
206#define NX_SUBTYPE_STICKYKEYS_ALTERNATE_DOWN		112
207#define NX_SUBTYPE_STICKYKEYS_COMMAND_DOWN		113
208#define NX_SUBTYPE_STICKYKEYS_FN_DOWN			114
209
210#define NX_SUBTYPE_STICKYKEYS_SHIFT_LOCK		120
211#define NX_SUBTYPE_STICKYKEYS_CONTROL_LOCK		121
212#define NX_SUBTYPE_STICKYKEYS_ALTERNATE_LOCK		122
213#define NX_SUBTYPE_STICKYKEYS_COMMAND_LOCK		123
214#define NX_SUBTYPE_STICKYKEYS_FN_LOCK			124
215
216#define NX_SUBTYPE_STICKYKEYS_SHIFT_UP			130
217#define NX_SUBTYPE_STICKYKEYS_CONTROL_UP		131
218#define NX_SUBTYPE_STICKYKEYS_ALTERNATE_UP		132
219#define NX_SUBTYPE_STICKYKEYS_COMMAND_UP		133
220#define NX_SUBTYPE_STICKYKEYS_FN_UP			134
221
222
223
224// SlowKeys
225#define NX_SUBTYPE_SLOWKEYS_START			200
226#define NX_SUBTYPE_SLOWKEYS_ABORT			201
227#define NX_SUBTYPE_SLOWKEYS_END				202
228
229// HID Parameter Property Modified
230#define NX_SUBTYPE_HIDPARAMETER_MODIFIED		210
231
232/* Masks for the bits in event.flags */
233
234/* device-independent */
235
236#define	NX_ALPHASHIFTMASK	0x00010000
237#define	NX_SHIFTMASK		0x00020000
238#define	NX_CONTROLMASK		0x00040000
239#define	NX_ALTERNATEMASK	0x00080000
240#define	NX_COMMANDMASK		0x00100000
241#define	NX_NUMERICPADMASK	0x00200000
242#define	NX_HELPMASK		0x00400000
243#define	NX_SECONDARYFNMASK	0x00800000
244#define NX_ALPHASHIFT_STATELESS_MASK    0x01000000
245
246/* device-dependent (really?) */
247
248#define	NX_DEVICELCTLKEYMASK	0x00000001
249#define	NX_DEVICELSHIFTKEYMASK	0x00000002
250#define	NX_DEVICERSHIFTKEYMASK	0x00000004
251#define	NX_DEVICELCMDKEYMASK	0x00000008
252#define	NX_DEVICERCMDKEYMASK	0x00000010
253#define	NX_DEVICELALTKEYMASK	0x00000020
254#define	NX_DEVICERALTKEYMASK	0x00000040
255#define NX_DEVICE_ALPHASHIFT_STATELESS_MASK 0x00000080
256#define NX_DEVICERCTLKEYMASK	0x00002000
257
258/*
259 * Additional reserved bits in event.flags
260 */
261
262#define NX_STYLUSPROXIMITYMASK	0x00000080	/* deprecated */
263#define NX_NONCOALSESCEDMASK	0x00000100
264
265/* click state values
266 * If you have the following events in close succession, the click
267 * field has the indicated value:
268 *
269 *  Event	Click Value	Comments
270 *  mouse-down	1		Not part of any click yet
271 *  mouse-up	1		Aha! A click!
272 *  mouse-down	2		Doing a double-click
273 *  mouse-up	2		It's finished
274 *  mouse-down	3		A triple
275 *  mouse-up	3
276 */
277
278/* Values for the character set in event.data.key.charSet */
279
280#define	NX_ASCIISET		0
281#define NX_SYMBOLSET		1
282#define	NX_DINGBATSSET		2
283
284/* tablet button masks
285 * Mask bits for the tablet barrel buttons placed in tablet.buttons.
286 * The buttons field uses adopts the following convention:
287 *
288 * Bit      Comments
289 * 0        Left Mouse Button ( kHIDUsage_Button_1 )
290 * 1        Right Mouse Button ( kHIDUsage_Button_2 )
291 * 2        Middle Mouse Button ( kHIDUsage_Button_3 )
292 * 3        4th Mouse Button ( kHIDUsage_Button_4 )
293 * ...
294 * 15       15th Mouse Button
295 *
296 * For your convenience, the following mask bits have been defined
297 * for tablet specific application:
298 */
299
300#define NX_TABLET_BUTTON_PENTIPMASK             0x0001
301#define NX_TABLET_BUTTON_PENLOWERSIDEMASK       0x0002
302#define NX_TABLET_BUTTON_PENUPPERSIDEMASK       0x0004
303
304
305/* tablet capability masks
306 * Mask bits for the tablet capabilities field.   Use these
307 * masks with the capabilities field of a proximity event to
308 * determine what fields in a Tablet Event are valid for this
309 * device.
310 */
311#define NX_TABLET_CAPABILITY_DEVICEIDMASK           0x0001
312#define NX_TABLET_CAPABILITY_ABSXMASK               0x0002
313#define NX_TABLET_CAPABILITY_ABSYMASK               0x0004
314#define NX_TABLET_CAPABILITY_VENDOR1MASK            0x0008
315#define NX_TABLET_CAPABILITY_VENDOR2MASK            0x0010
316#define NX_TABLET_CAPABILITY_VENDOR3MASK            0x0020
317#define NX_TABLET_CAPABILITY_BUTTONSMASK            0x0040
318#define NX_TABLET_CAPABILITY_TILTXMASK              0x0080
319#define NX_TABLET_CAPABILITY_TILTYMASK              0x0100
320#define NX_TABLET_CAPABILITY_ABSZMASK               0x0200
321#define NX_TABLET_CAPABILITY_PRESSUREMASK           0x0400
322#define NX_TABLET_CAPABILITY_TANGENTIALPRESSUREMASK 0x0800
323#define NX_TABLET_CAPABILITY_ORIENTINFOMASK         0x1000
324#define NX_TABLET_CAPABILITY_ROTATIONMASK           0x2000
325
326/* proximity pointer types
327 * Value that describes the type of pointing device placed in
328 * proximity.pointerType.
329 */
330
331#define NX_TABLET_POINTER_UNKNOWN               0
332#define NX_TABLET_POINTER_PEN                   1
333#define NX_TABLET_POINTER_CURSOR                2
334#define NX_TABLET_POINTER_ERASER                3
335
336/* TabletPointData type: defines the tablet data for points included
337 * in mouse events created by a tablet driver.
338 */
339
340typedef struct _NXTabletPointData {
341	SInt32  x;  /* absolute x coordinate in tablet space at full tablet resolution */
342    SInt32  y;  /* absolute y coordinate in tablet space at full tablet resolution */
343	SInt32  z;  /* absolute z coordinate in tablet space at full tablet resolution */
344    UInt16  buttons;   /* one bit per button - bit 0 is first button - 1 = closed  */
345    UInt16  pressure;  /* scaled pressure value; MAX=(2^16)-1, MIN=0 */
346    struct {           /* tilt range is -((2^15)-1) to (2^15)-1 (-32767 to 32767)  */
347        SInt16 x;      /* scaled tilt x value */
348        SInt16 y;      /* scaled tilt y value */
349	} tilt;
350	UInt16  rotation;  /* Fixed-point representation of device rotation in a 10.6 format */
351	SInt16  tangentialPressure; /* tangential pressure on the device; same range as tilt */
352	UInt16  deviceID;  /* system-assigned unique device ID */
353	SInt16  vendor1;   /* vendor-defined signed 16-bit integer */
354	SInt16  vendor2;   /* vendor-defined signed 16-bit integer */
355	SInt16  vendor3;   /* vendor-defined signed 16-bit integer */
356} NXTabletPointData, *NXTabletPointDataPtr;
357
358/* TabletProximityData type: defines the tablet data for proximity
359 * events included in mouse events created by a tablet driver.
360 */
361
362typedef struct _NXTabletProximityData {
363    UInt16  vendorID;             /* vendor-defined ID - typically the USB vendor ID */
364	UInt16  tabletID;             /* vendor-defined tablet ID - typically the USB product ID */
365	UInt16  pointerID;            /* vendor-defined ID of the specific pointing device */
366	UInt16  deviceID;             /* system-assigned unique device ID */
367	UInt16  systemTabletID;       /* system-assigned unique tablet ID */
368	UInt16  vendorPointerType;    /* vendor-defined pointer type */
369	UInt32  pointerSerialNumber;  /* vendor-defined serial number */
370	UInt64  uniqueID __attribute__ ((packed));             /* vendor-defined unique ID */
371	UInt32  capabilityMask;       /* capabilities mask of the device */
372	UInt8   pointerType;          /* type of pointing device */
373	UInt8   enterProximity;       /* non-zero = entering; zero = leaving */
374	SInt16  reserved1;
375} NXTabletProximityData, *NXTabletProximityDataPtr;
376
377/* EventData type: defines the data field of an event */
378
379typedef	union {
380    struct {    /* For mouse-down and mouse-up events */
381        UInt8   subx;       /* sub-pixel position for x */
382        UInt8   suby;       /* sub-pixel position for y */
383        SInt16  eventNum;   /* unique identifier for this button */
384        SInt32  click;      /* click state of this event */
385        UInt8   pressure;   /* pressure value: 0=none, 255=full */
386        UInt8   buttonNumber;/* button generating other button event (0-31) */
387        UInt8   subType;
388        UInt8   reserved2;
389        SInt32  reserved3;
390        union {
391            NXTabletPointData      point;     /* tablet point data */
392            NXTabletProximityData  proximity; /* tablet proximity data */
393        } tablet;
394    } mouse;
395    struct {
396        SInt32  dx;
397        SInt32  dy;
398        UInt8   subx;
399        UInt8   suby;
400        UInt8   subType;
401        UInt8   reserved1;
402        SInt32  reserved2;
403        union {
404            NXTabletPointData      point;     /* tablet point data */
405            NXTabletProximityData  proximity; /* tablet proximity data */
406        } tablet;
407    } mouseMove;
408    struct {    /* For key-down and key-up events */
409        UInt16  origCharSet;    /* unmodified character set code */
410        SInt16  repeat;         /* for key-down: nonzero if really a repeat */
411        UInt16  charSet;        /* character set code */
412        UInt16  charCode;       /* character code in that set */
413        UInt16  keyCode;        /* device-dependent key number */
414        UInt16  origCharCode;   /* unmodified character code */
415        SInt32  reserved1;
416        UInt32  keyboardType;
417        SInt32  reserved2;
418        SInt32  reserved3;
419        SInt32  reserved4;
420        SInt32  reserved5[4];
421    } key;
422    struct {    /* For mouse-entered and mouse-exited events */
423        SInt16  reserved;
424        SInt16  eventNum;       /* unique identifier from mouse down event */
425        SInt32  trackingNum;    /* unique identifier from settrackingrect */
426        SInt32  userData;       /* uninterpreted integer from settrackingrect */
427        SInt32  reserved1;
428        SInt32  reserved2;
429        SInt32  reserved3;
430        SInt32  reserved4;
431        SInt32  reserved5;
432        SInt32  reserved6[4];
433    } tracking;
434    struct {
435        SInt16  deltaAxis1;
436        SInt16  deltaAxis2;
437        SInt16  deltaAxis3;
438        SInt16  reserved1;
439        SInt32  fixedDeltaAxis1;
440        SInt32  fixedDeltaAxis2;
441        SInt32  fixedDeltaAxis3;
442        SInt32  pointDeltaAxis1;
443        SInt32  pointDeltaAxis2;
444        SInt32  pointDeltaAxis3;
445        SInt32  reserved8[4];
446    } scrollWheel, zoom;
447    struct {    /* For window-changed, sys-defined, and app-defined events */
448        SInt16  reserved;
449        SInt16  subType;    /* event subtype for compound events */
450        union {
451            float   F[11];  /* for use in compound events */
452            SInt32  L[11];  /* for use in compound events */
453            SInt16  S[22];  /* for use in compound events */
454            char    C[44];  /* for use in compound events */
455        } misc;
456    } compound;
457    struct {
458        SInt32  x;  /* absolute x coordinate in tablet space at full tablet resolution */
459        SInt32  y;  /* absolute y coordinate in tablet space at full tablet resolution */
460        SInt32  z;  /* absolute z coordinate in tablet space at full tablet resolution */
461        UInt16  buttons;   /* one bit per button - bit 0 is first button - 1 = closed  */
462        UInt16  pressure;  /* scaled pressure value; MAX=(2^16)-1, MIN=0 */
463        struct {           /* tilt range is -((2^15)-1) to (2^15)-1 (-32767 to 32767)  */
464            SInt16 x;      /* scaled tilt x value */
465            SInt16 y;      /* scaled tilt y value */
466        } tilt;
467        UInt16  rotation;  /* Fixed-point representation of device rotation in a 10.6 format */
468        SInt16  tangentialPressure; /* tangential pressure on the device; same range as tilt */
469        UInt16  deviceID;  /* system-assigned unique device ID */
470        SInt16  vendor1;   /* vendor-defined signed 16-bit integer */
471        SInt16  vendor2;   /* vendor-defined signed 16-bit integer */
472        SInt16  vendor3;   /* vendor-defined signed 16-bit integer */
473        SInt32  reserved[4];
474    } tablet;
475    struct {
476        UInt16  vendorID;  /* vendor-defined ID - typically the USB vendor ID */
477        UInt16  tabletID;  /* vendor-defined tablet ID - typically the USB product ID */
478        UInt16  pointerID; /* vendor-defined ID of the specific pointing device */
479        UInt16  deviceID;             /* system-assigned unique device ID */
480        UInt16  systemTabletID;       /* system-assigned unique tablet ID */
481        UInt16  vendorPointerType;    /* vendor-defined pointer type */
482        UInt32  pointerSerialNumber;  /* vendor-defined serial number */
483        UInt64  uniqueID __attribute__ ((packed));             /* vendor-defined unique ID */
484        UInt32  capabilityMask;       /* capabilities mask of the device */
485        UInt8   pointerType;          /* type of pointing device */
486        UInt8   enterProximity;       /* non-zero = entering; zero = leaving */
487        SInt16  reserved1;
488        SInt32  reserved2[4];
489    } proximity;
490} NXEventData;
491
492/* The current version number of the NXEventData structure. */
493
494#define kNXEventDataVersion		2
495
496/* Finally! The event record! */
497#ifndef __ppc__
498typedef struct _NXEvent {
499	SInt32              type;		/* An event type from above */
500    struct {
501        SInt32	x, y;					/* Base coordinates in window, */
502    } 					location;	/* from bottom left */
503    UInt64              time __attribute__ ((packed));		/* time since launch */
504    SInt32              flags;		/* key state flags */
505    UInt32              window;		/* window number of assigned window */
506    UInt64              service_id __attribute__ ((packed)); /* service id */
507    SInt32              ext_pid;    /* external pid */
508    NXEventData			data;		/* type-dependent data */
509} NXEvent, *NXEventPtr;
510
511#else
512
513typedef struct _NXEvent {
514	SInt32              type;		/* An event type from above */
515    struct {
516        SInt32	x, y;					/* Base coordinates in window, */
517    } 					location;	/* from bottom left */
518    UInt64              time __attribute__ ((packed));		/* time since launch */
519    SInt32              flags;		/* key state flags */
520    UInt32              window;		/* window number of assigned window */
521    NXEventData			data;		/* type-dependent data */
522    UInt64              service_id __attribute__ ((packed)); /* service id */
523    SInt32              ext_pid;    /* external pid */
524} NXEvent, *NXEventPtr;
525#endif
526
527/* The current version number of the NXEvent structure. */
528
529#define kNXEventVersion		2
530
531/* How to pick window(s) for event (for PostEvent) */
532#define NX_NOWINDOW		-1
533#define NX_BYTYPE		0
534#define NX_BROADCAST		1
535#define NX_TOPWINDOW		2
536#define NX_FIRSTWINDOW		3
537#define NX_MOUSEWINDOW		4
538#define NX_NEXTWINDOW		5
539#define NX_LASTLEFT		6
540#define NX_LASTRIGHT		7
541#define NX_LASTKEY		8
542#define NX_EXPLICIT		9
543#define NX_TRANSMIT		10
544#define NX_BYPSCONTEXT		11
545
546#endif /* EVENT_H */	/* End of defs common with dpsclient/event.h */
547
548/* Mask of events that cause the screen to wake up */
549#define NX_WAKEMASK     (   NX_KEYDOWNMASK | NX_FLAGSCHANGEDMASK | \
550                            NX_LMOUSEDOWNMASK | NX_LMOUSEUPMASK | \
551                            NX_RMOUSEDOWNMASK | NX_RMOUSEUPMASK | \
552                            NX_OMOUSEDOWNMASK | NX_OMOUSEUPMASK   \
553                        )
554
555/* Mask of events that cause screen to undim */
556#define NX_UNDIMMASK    (   NX_WAKEMASK | NX_KEYUPMASK | NX_SCROLLWHEELMOVEDMASK | \
557                            NX_LMOUSEDRAGGEDMASK | NX_RMOUSEDRAGGEDMASK | NX_OMOUSEDRAGGEDMASK | \
558                            NX_MOUSEMOVEDMASK | NX_MOUSEENTEREDMASK | NX_MOUSEEXITEDMASK | \
559                            NX_TABLETPOINTERMASK | NX_TABLETPROXIMITYMASK \
560                        )
561
562#endif /* !_DEV_EVENT_H */
563
564