Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

CGPrivateAPI.h (8650B)


      1 /*
      2 ===========================================================================
      3 Copyright (C) 1999-2005 Id Software, Inc.
      4 
      5 This file is part of Quake III Arena source code.
      6 
      7 Quake III Arena source code is free software; you can redistribute it
      8 and/or modify it under the terms of the GNU General Public License as
      9 published by the Free Software Foundation; either version 2 of the License,
     10 or (at your option) any later version.
     11 
     12 Quake III Arena source code is distributed in the hope that it will be
     13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 GNU General Public License for more details.
     16 
     17 You should have received a copy of the GNU General Public License
     18 along with Foobar; if not, write to the Free Software
     19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     20 ===========================================================================
     21 */
     22 
     23 
     24 typedef unsigned long CGSNotificationType;
     25 typedef void * CGSNotificationData;
     26 typedef void * CGSNotificationArg;
     27 typedef void * CGSWindowID;
     28 typedef void * CGSConnectionID;
     29 
     30 typedef unsigned long long      CGSUInt64;
     31 typedef long long               CGSInt64;
     32 typedef unsigned long           CGSUInt32;
     33 typedef long                    CGSInt32;
     34 typedef unsigned short          CGSUInt16;
     35 typedef short                   CGSInt16;
     36 typedef unsigned char           CGSUInt8;
     37 typedef char                    CGSInt8;
     38 typedef float                   CGSFloat32;
     39 
     40 typedef CGSUInt32 CGSByteCount;
     41 typedef CGSUInt16 CGSEventRecordVersion;
     42 typedef unsigned long CGSEventType;
     43 typedef CGSUInt64 CGSEventRecordTime;  /* nanosecond timer */
     44 typedef unsigned long CGSEventFlag;
     45 typedef CGSUInt32  CGSError;
     46 
     47 
     48 typedef	union {
     49     struct {	/* For mouse events */
     50         CGSUInt8	subx;			/* sub-pixel position for x */
     51         CGSUInt8	suby;			/* sub-pixel position for y */
     52         CGSInt16	eventNum;		/* unique identifier for this button */
     53         CGSInt32	click;			/* click state of this event */
     54         CGSUInt8	pressure;	/* pressure value: 0=none, 255=full */
     55         CGSInt8		_reserved1;
     56         CGSInt16	_reserved2;
     57         CGSInt16	deltaX;
     58         CGSInt16	deltaY;
     59         CGSInt32	_padding[8];
     60     } mouse;
     61     struct {	/* For pointer movement events */
     62         CGSInt16	_obsolete_deltaX;	/* Revert to subX, subY, eventNum */
     63         CGSInt16	_obsolete_deltaY;	/* for Gonzo 1H */
     64         CGSInt32	click;			/* click state of this event */
     65         CGSUInt8	pressure;	/* pressure value: 0=none, 255=full */
     66         CGSInt8		_reserved1;
     67         CGSInt16	_reserved2;
     68         CGSInt16	deltaX;
     69         CGSInt16	deltaY;
     70         CGSInt32	_padding[8];
     71     } move;
     72     struct {	/* For key-down and key-up events */
     73         CGSInt16	reserved;
     74         CGSInt16	repeat;		/* for key-down: nonzero if really a repeat */
     75         CGSUInt16	charSet;	/* character set code */
     76         CGSUInt16	charCode;	/* character code in that set */
     77         CGSUInt16	keyCode;	/* device-dependent virtual key code */
     78         CGSInt16	keyData;	/* device-dependent info */
     79         CGSInt16	specialKey;	/* CPSSpecialKeyID if kCGSFlagsMaskSpecialKey is set */
     80         CGSInt16	_pad;
     81         CGSInt32	_padding[8];
     82     } key;
     83     struct {	/* For mouse-entered and mouse-exited events */
     84         CGSInt16	reserved;
     85         CGSInt16	eventNum;	/* unique identifier from mouse down event */
     86         CGSInt32	trackingNum;	/* unique identifier from settrackingrect */
     87         CGSInt32	userData;	/* unCGSInt32erpreted CGSInt32eger from settrackingrect */
     88         CGSInt32	_padding[9];
     89     } tracking;
     90     struct {	/* For process-related events */
     91         CGSUInt16	notifyCode;	/* CPSNotificationCodes in CPSProcesses.h */
     92         CGSUInt16	flags;		/* CPSEventFlags in CPSProcesses.h */
     93         CGSUInt32	targetHiPSN;	/* hiword of PSN */
     94         CGSUInt32	targetLoPSN;	/* loword of PSN */
     95         CGSInt32	status;		/* operation result */
     96         CGSInt32	_padding[8];
     97     } process;
     98     struct {		/* For scroll wheel events */
     99         CGSInt16	deltaAxis1;
    100         CGSInt16	deltaAxis2;
    101         CGSInt16	deltaAxis3;
    102         CGSInt16	reserved1;
    103         CGSInt32	reserved2;
    104         CGSInt32	_padding[9];
    105     } scrollWheel;
    106     struct {
    107         CGSInt32	x;	/* absolute x coordinate in tablet space at full tablet resolution */
    108         CGSInt32	y;	/* absolute y coordinate in tablet space at full tablet resolution */
    109         CGSInt32	z;	/* absolute z coordinate in tablet space at full tablet resolution */
    110         CGSUInt16	buttons;	/* one bit per button - bit 0 is first button - 1 = closed */
    111         CGSUInt16	pressure;	/* scaled pressure value; MAXPRESSURE=(2^16)-1, MINPRESSURE=0 */
    112         struct {
    113             CGSInt16 x;	/* scaled tilt x value; range is -((2^15)-1) to (2^15)-1 (-32767 to 32767) */
    114             CGSInt16 y;	/* scaled tilt y value; range is -((2^15)-1) to (2^15)-1 (-32767 to 32767) */
    115         } tilt;
    116         CGSUInt16	rotation;	/* Fixed-point representation of device rotation in a 10.6 format */
    117         CGSInt16	tangentialPressure;	/* tangential pressure on the device; range same as tilt */
    118         CGSUInt16	deviceID;	/* system-assigned unique device ID - matches to deviceID field in proximity event */
    119         CGSInt16	vendor1;	/* vendor-defined signed 16-bit integer */
    120         CGSInt16	vendor2;	/* vendor-defined signed 16-bit integer */
    121         CGSInt16	vendor3;	/* vendor-defined signed 16-bit integer */
    122         CGSInt32	_padding[4];
    123     } tablet;
    124     struct {
    125         CGSUInt16	vendorID;	/* vendor-defined ID - typically will be USB vendor ID */
    126         CGSUInt16	tabletID;	/* vendor-defined tablet ID - typically will be USB product ID for the tablet */
    127         CGSUInt16	pointerID;	/* vendor-defined ID of the specific pointing device */
    128         CGSUInt16	deviceID;	/* system-assigned unique device ID - matches to deviceID field in tablet event */
    129         CGSUInt16	systemTabletID;	/* system-assigned unique tablet ID */
    130         CGSUInt16	vendorPointerType;	/* vendor-defined pointer type */
    131         CGSUInt32  pointerSerialNumber;	/* vendor-defined serial number of the specific pointing device */
    132         CGSUInt64	uniqueID;	/* vendor-defined unique ID for this pointer */
    133         CGSUInt32	capabilityMask;	/* mask representing the capabilities of the device */
    134         CGSUInt8	pointerType;	/* type of pointing device - enum to be defined */
    135         CGSUInt8	enterProximity;	/* non-zero = entering; zero = leaving */
    136         CGSInt16	reserved1;
    137         CGSInt32	_padding[4];
    138     } proximity;
    139     struct {	/* For AppKit-defined, sys-defined, and app-defined events */
    140         CGSInt16	reserved;
    141         CGSInt16	subtype;	/* event subtype for compound events */
    142         union {
    143             CGSFloat32	F[11];	/* for use in compound events */
    144             CGSInt32	L[11];	/* for use in compound events */
    145             CGSInt16	S[22];	/* for use in compound events */
    146             CGSInt8	C[44];	/* for use in compound events */
    147         } misc;
    148     } compound;
    149 } CGSEventRecordData;
    150 
    151 
    152 struct _CGSEventRecord {
    153     CGSEventRecordVersion major;
    154     CGSEventRecordVersion minor;
    155     CGSByteCount length;	/* Length of complete event record */
    156     CGSEventType type;		/* An event type from above */
    157     CGPoint location;		/* Base coordinates (global), from upper-left */
    158     CGPoint windowLocation;	/* Coordinates relative to window */
    159     CGSEventRecordTime time;	/* nanoseconds since startup */
    160     CGSEventFlag flags;		/* key state flags */
    161     CGSWindowID	window;		/* window number of assigned window */
    162     CGSConnectionID connection;	/* connection the event came from */
    163     CGSEventRecordData data;	/* type-dependent data: 40 bytes */
    164 };
    165 typedef struct _CGSEventRecord CGSEventRecord;
    166 typedef CGSEventRecord *CGSEventRecordPtr;
    167 
    168 
    169 typedef void (*CGSNotifyProcPtr)(CGSNotificationType type,
    170                                 CGSNotificationData data,
    171                                 CGSByteCount dataLength,
    172                                 CGSNotificationArg arg);
    173 
    174 // Define a type for the 'CGSRegisterNotifyProc' call.  Don't reference it explicitly since we don't want link errors if Apple removes this private function.
    175 typedef CGSError (*CGSRegisterNotifyProcType)(CGSNotifyProcPtr proc,
    176                                               CGSNotificationType type,
    177                                               CGSNotificationArg arg);
    178 
    179 
    180 #define kCGSEventNotificationMouseMoved                    (710 + 5)
    181 #define kCGSEventNotificationLeftMouseDragged              (710 + 6)
    182 #define kCGSEventNotificationRightMouseDragged             (710 + 7)
    183 #define kCGSEventNotificationNotificationOtherMouseDragged (710 + 27)
    184 
    185