root / trunk / Windows / libs / quicktime / include / CursorDevices.h @ 3
View | Annotate | Download (11.3 KB)
| 1 | /*
|
|---|---|
| 2 | File: CursorDevices.h |
| 3 | |
| 4 | Contains: Cursor Devices (mouse/trackball/etc) Interfaces. |
| 5 | |
| 6 | Version: Technology: System 7.5 |
| 7 | Release: QuickTime 6.0.2 |
| 8 | |
| 9 | Copyright: (c) 1993-2001 by Apple Computer, Inc., all rights reserved. |
| 10 | |
| 11 | Bugs?: For bug reports, consult the following page on |
| 12 | the World Wide Web: |
| 13 | |
| 14 | http://developer.apple.com/bugreporter/ |
| 15 | |
| 16 | */ |
| 17 | #ifndef __CURSORDEVICES__
|
| 18 | #define __CURSORDEVICES__
|
| 19 | |
| 20 | #ifndef __MACTYPES__
|
| 21 | #include <MacTypes.h> |
| 22 | #endif
|
| 23 | |
| 24 | #ifndef __MIXEDMODE__
|
| 25 | #include <MixedMode.h> |
| 26 | #endif
|
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | #if PRAGMA_ONCE
|
| 32 | #pragma once
|
| 33 | #endif
|
| 34 | |
| 35 | #ifdef __cplusplus
|
| 36 | extern "C" { |
| 37 | #endif
|
| 38 | |
| 39 | #if PRAGMA_IMPORT
|
| 40 | #pragma import on
|
| 41 | #endif
|
| 42 | |
| 43 | #if PRAGMA_STRUCT_ALIGN
|
| 44 | #pragma options align=mac68k
|
| 45 | #elif PRAGMA_STRUCT_PACKPUSH
|
| 46 | #pragma pack(push, 2) |
| 47 | #elif PRAGMA_STRUCT_PACK
|
| 48 | #pragma pack(2) |
| 49 | #endif
|
| 50 | |
| 51 | /*
|
| 52 | * * * I M P O R T A N T * * * |
| 53 | |
| 54 | You will need CursorDevicesGlue.o to use CDM from PowerPC |
| 55 | |
| 56 | |
| 57 | In order to use the Cursor Devices Manager (CDM) on PowerPC systems, you must |
| 58 | link with the file CursorDevicesGlue.o and InterfaceLib 1.1.3. This is necessary |
| 59 | because the original MixedMode transition code for CDM in InterfaceLib in ROM |
| 60 | was wrong. The code in CursorDevicesGlue.o will check to see if the ROM has |
| 61 | been fixed and calls through to it if so. If it detects that the ROM has not |
| 62 | been fixed, it uses its own implementation of the CDM MixedMode transition |
| 63 | routines. |
| 64 | |
| 65 | */ |
| 66 | |
| 67 | typedef short ButtonOpcode; |
| 68 | /* ButtonOpcodes */
|
| 69 | enum {
|
| 70 | kButtonNoOp = 0, /* No action for this button */ |
| 71 | kButtonSingleClick = 1, /* Normal mouse button */ |
| 72 | kButtonDoubleClick = 2, /* Click-release-click when pressed */ |
| 73 | kButtonClickLock = 3 /* Click on press, release on next press */ |
| 74 | }; |
| 75 | |
| 76 | enum {
|
| 77 | kButtonCustom = 6 /* Custom behavior, data = CursorDeviceCustomButtonUPP */ |
| 78 | }; |
| 79 | |
| 80 | /* Device Classes */
|
| 81 | enum {
|
| 82 | kDeviceClassAbsolute = 0, /* a flat-response device */ |
| 83 | kDeviceClassMouse = 1, /* mechanical or optical mouse */ |
| 84 | kDeviceClassTrackball = 2, /* trackball */ |
| 85 | kDeviceClassTrackPad = 3
|
| 86 | }; |
| 87 | |
| 88 | enum {
|
| 89 | kDeviceClass3D = 6 /* a 3D pointing device */ |
| 90 | }; |
| 91 | |
| 92 | /* Structures used in Cursor Device Manager calls */
|
| 93 | |
| 94 | struct CursorData {
|
| 95 | struct CursorData * nextCursorData; /* next in global list */ |
| 96 | Ptr displayInfo; /* unused (reserved for future) */
|
| 97 | Fixed whereX; /* horizontal position */
|
| 98 | Fixed whereY; /* vertical position */
|
| 99 | Point where; /* the pixel position */
|
| 100 | Boolean isAbs; /* has been stuffed with absolute coords */
|
| 101 | UInt8 buttonCount; /* number of buttons currently pressed */
|
| 102 | long screenRes; /* pixels per inch on the current display */ |
| 103 | short privateFields[22]; /* fields use internally by CDM */ |
| 104 | }; |
| 105 | typedef struct CursorData CursorData; |
| 106 | typedef CursorData * CursorDataPtr;
|
| 107 | |
| 108 | struct CursorDevice {
|
| 109 | struct CursorDevice * nextCursorDevice; /* pointer to next record in linked list */ |
| 110 | CursorData * whichCursor; /* pointer to data for target cursor */
|
| 111 | long refCon; /* application-defined */ |
| 112 | long unused; /* reserved for future */ |
| 113 | OSType devID; /* device identifier (from ADB reg 1) */
|
| 114 | Fixed resolution; /* units/inch (orig. from ADB reg 1) */
|
| 115 | UInt8 devClass; /* device class (from ADB reg 1) */
|
| 116 | UInt8 cntButtons; /* number of buttons (from ADB reg 1) */
|
| 117 | UInt8 filler1; /* reserved for future */
|
| 118 | UInt8 buttons; /* state of all buttons */
|
| 119 | UInt8 buttonOp[8]; /* action performed per button */ |
| 120 | unsigned long buttonTicks[8]; /* ticks when button last went up (for debounce) */ |
| 121 | long buttonData[8]; /* data for the button operation */ |
| 122 | unsigned long doubleClickTime; /* device-specific double click speed */ |
| 123 | Fixed acceleration; /* current acceleration */
|
| 124 | short privateFields[15]; /* fields used internally to CDM */ |
| 125 | }; |
| 126 | typedef struct CursorDevice CursorDevice; |
| 127 | typedef CursorDevice * CursorDevicePtr;
|
| 128 | /* for use with CursorDeviceButtonOp when opcode = kButtonCustom */
|
| 129 | typedef CALLBACK_API( void , CursorDeviceCustomButtonProcPtr )(CursorDevicePtr ourDevice, short button); |
| 130 | /*
|
| 131 | WARNING: CursorDeviceCustomButtonProcPtr uses register based parameters under classic 68k |
| 132 | and cannot be written in a high-level language without |
| 133 | the help of mixed mode or assembly glue. |
| 134 | */ |
| 135 | typedef REGISTER_UPP_TYPE(CursorDeviceCustomButtonProcPtr) CursorDeviceCustomButtonUPP;
|
| 136 | #if OPAQUE_UPP_TYPES
|
| 137 | #if CALL_NOT_IN_CARBON
|
| 138 | EXTERN_API(CursorDeviceCustomButtonUPP) |
| 139 | NewCursorDeviceCustomButtonUPP (CursorDeviceCustomButtonProcPtr userRoutine); |
| 140 | |
| 141 | EXTERN_API(void)
|
| 142 | DisposeCursorDeviceCustomButtonUPP (CursorDeviceCustomButtonUPP userUPP); |
| 143 | |
| 144 | EXTERN_API(void)
|
| 145 | InvokeCursorDeviceCustomButtonUPP (CursorDevicePtr ourDevice, |
| 146 | short button,
|
| 147 | CursorDeviceCustomButtonUPP userUPP); |
| 148 | |
| 149 | #endif /* CALL_NOT_IN_CARBON */ |
| 150 | |
| 151 | #else
|
| 152 | enum { uppCursorDeviceCustomButtonProcInfo = 0x000ED802 }; /* register no_return_value Func(4_bytes:A2, 2_bytes:D3) */ |
| 153 | #define NewCursorDeviceCustomButtonUPP(userRoutine) (CursorDeviceCustomButtonUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCursorDeviceCustomButtonProcInfo, GetCurrentArchitecture())
|
| 154 | #define DisposeCursorDeviceCustomButtonUPP(userUPP) DisposeRoutineDescriptor(userUPP)
|
| 155 | #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
|
| 156 | /* InvokeCursorDeviceCustomButtonUPP can't be called from classic 68k without glue code */
|
| 157 | #else
|
| 158 | #define InvokeCursorDeviceCustomButtonUPP(ourDevice, button, userUPP) CALL_TWO_PARAMETER_UPP((userUPP), uppCursorDeviceCustomButtonProcInfo, (ourDevice), (button))
|
| 159 | #endif
|
| 160 | #endif
|
| 161 | /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
|
| 162 | #define NewCursorDeviceCustomButtonProc(userRoutine) NewCursorDeviceCustomButtonUPP(userRoutine)
|
| 163 | #define CallCursorDeviceCustomButtonProc(userRoutine, ourDevice, button) InvokeCursorDeviceCustomButtonUPP(ourDevice, button, userRoutine)
|
| 164 | #if CALL_NOT_IN_CARBON
|
| 165 | EXTERN_API( OSErr ) |
| 166 | CursorDeviceMove (CursorDevicePtr ourDevice, |
| 167 | long deltaX,
|
| 168 | long deltaY) TWOWORDINLINE(0x7000, 0xAADB); |
| 169 | |
| 170 | EXTERN_API( OSErr ) |
| 171 | CursorDeviceMoveTo (CursorDevicePtr ourDevice, |
| 172 | long absX,
|
| 173 | long absY) TWOWORDINLINE(0x7001, 0xAADB); |
| 174 | |
| 175 | EXTERN_API( OSErr ) |
| 176 | CursorDeviceFlush (CursorDevicePtr ourDevice) TWOWORDINLINE(0x7002, 0xAADB); |
| 177 | |
| 178 | EXTERN_API( OSErr ) |
| 179 | CursorDeviceButtons (CursorDevicePtr ourDevice, |
| 180 | short buttons) TWOWORDINLINE(0x7003, 0xAADB); |
| 181 | |
| 182 | EXTERN_API( OSErr ) |
| 183 | CursorDeviceButtonDown (CursorDevicePtr ourDevice) TWOWORDINLINE(0x7004, 0xAADB); |
| 184 | |
| 185 | EXTERN_API( OSErr ) |
| 186 | CursorDeviceButtonUp (CursorDevicePtr ourDevice) TWOWORDINLINE(0x7005, 0xAADB); |
| 187 | |
| 188 | EXTERN_API( OSErr ) |
| 189 | CursorDeviceButtonOp (CursorDevicePtr ourDevice, |
| 190 | short buttonNumber,
|
| 191 | ButtonOpcode opcode, |
| 192 | long data) TWOWORDINLINE(0x7006, 0xAADB); |
| 193 | |
| 194 | EXTERN_API( OSErr ) |
| 195 | CursorDeviceSetButtons (CursorDevicePtr ourDevice, |
| 196 | short numberOfButtons) TWOWORDINLINE(0x7007, 0xAADB); |
| 197 | |
| 198 | EXTERN_API( OSErr ) |
| 199 | CursorDeviceSetAcceleration (CursorDevicePtr ourDevice, |
| 200 | Fixed acceleration) TWOWORDINLINE(0x7008, 0xAADB); |
| 201 | |
| 202 | EXTERN_API( OSErr ) |
| 203 | CursorDeviceDoubleTime (CursorDevicePtr ourDevice, |
| 204 | long durationTicks) TWOWORDINLINE(0x7009, 0xAADB); |
| 205 | |
| 206 | EXTERN_API( OSErr ) |
| 207 | CursorDeviceUnitsPerInch (CursorDevicePtr ourDevice, |
| 208 | Fixed resolution) TWOWORDINLINE(0x700A, 0xAADB); |
| 209 | |
| 210 | EXTERN_API( OSErr ) |
| 211 | CursorDeviceNextDevice (CursorDevicePtr * ourDevice) TWOWORDINLINE(0x700B, 0xAADB); |
| 212 | |
| 213 | EXTERN_API( OSErr ) |
| 214 | CursorDeviceNewDevice (CursorDevicePtr * ourDevice) TWOWORDINLINE(0x700C, 0xAADB); |
| 215 | |
| 216 | EXTERN_API( OSErr ) |
| 217 | CursorDeviceDisposeDevice (CursorDevicePtr ourDevice) TWOWORDINLINE(0x700D, 0xAADB); |
| 218 | |
| 219 | |
| 220 | /*
|
| 221 | * * * W A R N I N G * * * |
| 222 | |
| 223 | The routines CrsrDevMoveTo and CrsrDevNextDevice are no longer needed. |
| 224 | They were added as a work around until the glue code CursorDevicesGlue.o |
| 225 | was created. Please use the functions CursorDeviceMoveTo and |
| 226 | CursorDeviceNextDevice instead. |
| 227 | |
| 228 | */ |
| 229 | #endif /* CALL_NOT_IN_CARBON */ |
| 230 | |
| 231 | #if OLDROUTINENAMES
|
| 232 | #if CALL_NOT_IN_CARBON
|
| 233 | EXTERN_API( OSErr ) |
| 234 | CrsrDevMoveTo (CursorDevicePtr ourDevice, |
| 235 | long absX,
|
| 236 | long absY) TWOWORDINLINE(0x7001, 0xAADB); |
| 237 | |
| 238 | EXTERN_API( OSErr ) |
| 239 | CrsrDevNextDevice (CursorDevicePtr * ourDevice) TWOWORDINLINE(0x700B, 0xAADB); |
| 240 | |
| 241 | #endif /* CALL_NOT_IN_CARBON */ |
| 242 | |
| 243 | #endif /* OLDROUTINENAMES */ |
| 244 | |
| 245 | |
| 246 | |
| 247 | #if PRAGMA_STRUCT_ALIGN
|
| 248 | #pragma options align=reset
|
| 249 | #elif PRAGMA_STRUCT_PACKPUSH
|
| 250 | #pragma pack(pop)
|
| 251 | #elif PRAGMA_STRUCT_PACK
|
| 252 | #pragma pack()
|
| 253 | #endif
|
| 254 | |
| 255 | #ifdef PRAGMA_IMPORT_OFF
|
| 256 | #pragma import off
|
| 257 | #elif PRAGMA_IMPORT
|
| 258 | #pragma import reset
|
| 259 | #endif
|
| 260 | |
| 261 | #ifdef __cplusplus
|
| 262 | } |
| 263 | #endif
|
| 264 | |
| 265 | #endif /* __CURSORDEVICES__ */ |
| 266 |
