Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

451 lines
14 KiB

  1. /*
  2. File: CursorDevices.h
  3. Contains: Cursor Devices (mouse/trackball/etc) Interfaces.
  4. Version: Technology: System 7.5
  5. Release: QuickTime 7.3
  6. Copyright: (c) 2007 (c) 1993-1999 by Apple Computer, Inc., all rights reserved.
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://developer.apple.com/bugreporter/
  10. */
  11. #ifndef __CURSORDEVICES__
  12. #define __CURSORDEVICES__
  13. #ifndef __MACTYPES__
  14. #include <MacTypes.h>
  15. #endif
  16. #ifndef __MIXEDMODE__
  17. #include <MixedMode.h>
  18. #endif
  19. #if PRAGMA_ONCE
  20. #pragma once
  21. #endif
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #if PRAGMA_IMPORT
  26. #pragma import on
  27. #endif
  28. #if PRAGMA_STRUCT_ALIGN
  29. #pragma options align=mac68k
  30. #elif PRAGMA_STRUCT_PACKPUSH
  31. #pragma pack(push, 2)
  32. #elif PRAGMA_STRUCT_PACK
  33. #pragma pack(2)
  34. #endif
  35. /*
  36. * * * I M P O R T A N T * * *
  37. You will need CursorDevicesGlue.o to use CDM from PowerPC
  38. In order to use the Cursor Devices Manager (CDM) on PowerPC systems, you must
  39. link with the file CursorDevicesGlue.o and InterfaceLib 1.1.3. This is necessary
  40. because the original MixedMode transition code for CDM in InterfaceLib in ROM
  41. was wrong. The code in CursorDevicesGlue.o will check to see if the ROM has
  42. been fixed and calls through to it if so. If it detects that the ROM has not
  43. been fixed, it uses its own implementation of the CDM MixedMode transition
  44. routines.
  45. */
  46. typedef short ButtonOpcode;
  47. /* ButtonOpcodes */
  48. enum {
  49. kButtonNoOp = 0, /* No action for this button */
  50. kButtonSingleClick = 1, /* Normal mouse button */
  51. kButtonDoubleClick = 2, /* Click-release-click when pressed */
  52. kButtonClickLock = 3 /* Click on press, release on next press */
  53. };
  54. enum {
  55. kButtonCustom = 6 /* Custom behavior, data = CursorDeviceCustomButtonUPP */
  56. };
  57. /* Device Classes */
  58. enum {
  59. kDeviceClassAbsolute = 0, /* a flat-response device */
  60. kDeviceClassMouse = 1, /* mechanical or optical mouse */
  61. kDeviceClassTrackball = 2, /* trackball */
  62. kDeviceClassTrackPad = 3
  63. };
  64. enum {
  65. kDeviceClass3D = 6 /* a 3D pointing device */
  66. };
  67. /* Structures used in Cursor Device Manager calls */
  68. struct CursorData {
  69. struct CursorData * nextCursorData; /* next in global list */
  70. Ptr displayInfo; /* unused (reserved for future) */
  71. Fixed whereX; /* horizontal position */
  72. Fixed whereY; /* vertical position */
  73. Point where; /* the pixel position */
  74. Boolean isAbs; /* has been stuffed with absolute coords */
  75. UInt8 buttonCount; /* number of buttons currently pressed */
  76. long screenRes; /* pixels per inch on the current display */
  77. short privateFields[22]; /* fields use internally by CDM */
  78. };
  79. typedef struct CursorData CursorData;
  80. typedef CursorData * CursorDataPtr;
  81. struct CursorDevice {
  82. struct CursorDevice * nextCursorDevice; /* pointer to next record in linked list */
  83. CursorData * whichCursor; /* pointer to data for target cursor */
  84. long refCon; /* application-defined */
  85. long unused; /* reserved for future */
  86. OSType devID; /* device identifier (from ADB reg 1) */
  87. Fixed resolution; /* units/inch (orig. from ADB reg 1) */
  88. UInt8 devClass; /* device class (from ADB reg 1) */
  89. UInt8 cntButtons; /* number of buttons (from ADB reg 1) */
  90. UInt8 filler1; /* reserved for future */
  91. UInt8 buttons; /* state of all buttons */
  92. UInt8 buttonOp[8]; /* action performed per button */
  93. unsigned long buttonTicks[8]; /* ticks when button last went up (for debounce) */
  94. long buttonData[8]; /* data for the button operation */
  95. unsigned long doubleClickTime; /* device-specific double click speed */
  96. Fixed acceleration; /* current acceleration */
  97. short privateFields[15]; /* fields used internally to CDM */
  98. };
  99. typedef struct CursorDevice CursorDevice;
  100. typedef CursorDevice * CursorDevicePtr;
  101. /* for use with CursorDeviceButtonOp when opcode = kButtonCustom */
  102. typedef CALLBACK_API_REGISTER68K( void , CursorDeviceCustomButtonProcPtr, (CursorDevicePtr ourDevice, short button) );
  103. typedef REGISTER_UPP_TYPE(CursorDeviceCustomButtonProcPtr) CursorDeviceCustomButtonUPP;
  104. #if CALL_NOT_IN_CARBON
  105. /*
  106. * NewCursorDeviceCustomButtonUPP()
  107. *
  108. * Availability:
  109. * Non-Carbon CFM: available as macro/inline
  110. * CarbonLib: not available
  111. * Mac OS X: not available
  112. */
  113. EXTERN_API_C( CursorDeviceCustomButtonUPP )
  114. NewCursorDeviceCustomButtonUPP(CursorDeviceCustomButtonProcPtr userRoutine);
  115. #if !OPAQUE_UPP_TYPES
  116. enum { uppCursorDeviceCustomButtonProcInfo = 0x000ED802 }; /* register no_return_value Func(4_bytes:A2, 2_bytes:D3) */
  117. #ifdef __cplusplus
  118. inline DEFINE_API_C(CursorDeviceCustomButtonUPP) NewCursorDeviceCustomButtonUPP(CursorDeviceCustomButtonProcPtr userRoutine) { return (CursorDeviceCustomButtonUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCursorDeviceCustomButtonProcInfo, GetCurrentArchitecture()); }
  119. #else
  120. #define NewCursorDeviceCustomButtonUPP(userRoutine) (CursorDeviceCustomButtonUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCursorDeviceCustomButtonProcInfo, GetCurrentArchitecture())
  121. #endif
  122. #endif
  123. /*
  124. * DisposeCursorDeviceCustomButtonUPP()
  125. *
  126. * Availability:
  127. * Non-Carbon CFM: available as macro/inline
  128. * CarbonLib: not available
  129. * Mac OS X: not available
  130. */
  131. EXTERN_API_C( void )
  132. DisposeCursorDeviceCustomButtonUPP(CursorDeviceCustomButtonUPP userUPP);
  133. #if !OPAQUE_UPP_TYPES
  134. #ifdef __cplusplus
  135. inline DEFINE_API_C(void) DisposeCursorDeviceCustomButtonUPP(CursorDeviceCustomButtonUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  136. #else
  137. #define DisposeCursorDeviceCustomButtonUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  138. #endif
  139. #endif
  140. /*
  141. * InvokeCursorDeviceCustomButtonUPP()
  142. *
  143. * Availability:
  144. * Non-Carbon CFM: available as macro/inline
  145. * CarbonLib: not available
  146. * Mac OS X: not available
  147. */
  148. EXTERN_API_C( void )
  149. InvokeCursorDeviceCustomButtonUPP(
  150. CursorDevicePtr ourDevice,
  151. short button,
  152. CursorDeviceCustomButtonUPP userUPP);
  153. #if !OPAQUE_UPP_TYPES && (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
  154. #ifdef __cplusplus
  155. inline DEFINE_API_C(void) InvokeCursorDeviceCustomButtonUPP(CursorDevicePtr ourDevice, short button, CursorDeviceCustomButtonUPP userUPP) { CALL_TWO_PARAMETER_UPP(userUPP, uppCursorDeviceCustomButtonProcInfo, ourDevice, button); }
  156. #else
  157. #define InvokeCursorDeviceCustomButtonUPP(ourDevice, button, userUPP) CALL_TWO_PARAMETER_UPP((userUPP), uppCursorDeviceCustomButtonProcInfo, (ourDevice), (button))
  158. #endif
  159. #endif
  160. #endif /* CALL_NOT_IN_CARBON */
  161. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  162. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  163. #define NewCursorDeviceCustomButtonProc(userRoutine) NewCursorDeviceCustomButtonUPP(userRoutine)
  164. #define CallCursorDeviceCustomButtonProc(userRoutine, ourDevice, button) InvokeCursorDeviceCustomButtonUPP(ourDevice, button, userRoutine)
  165. #endif /* CALL_NOT_IN_CARBON */
  166. #if CALL_NOT_IN_CARBON
  167. /*
  168. * CursorDeviceMove()
  169. *
  170. * Availability:
  171. * Non-Carbon CFM: not available
  172. * CarbonLib: not available
  173. * Mac OS X: not available
  174. */
  175. EXTERN_API( OSErr )
  176. CursorDeviceMove(
  177. CursorDevicePtr ourDevice,
  178. long deltaX,
  179. long deltaY) TWOWORDINLINE(0x7000, 0xAADB);
  180. /*
  181. * CursorDeviceMoveTo()
  182. *
  183. * Availability:
  184. * Non-Carbon CFM: not available
  185. * CarbonLib: not available
  186. * Mac OS X: not available
  187. */
  188. EXTERN_API( OSErr )
  189. CursorDeviceMoveTo(
  190. CursorDevicePtr ourDevice,
  191. long absX,
  192. long absY) TWOWORDINLINE(0x7001, 0xAADB);
  193. /*
  194. * CursorDeviceFlush()
  195. *
  196. * Availability:
  197. * Non-Carbon CFM: not available
  198. * CarbonLib: not available
  199. * Mac OS X: not available
  200. */
  201. EXTERN_API( OSErr )
  202. CursorDeviceFlush(CursorDevicePtr ourDevice) TWOWORDINLINE(0x7002, 0xAADB);
  203. /*
  204. * CursorDeviceButtons()
  205. *
  206. * Availability:
  207. * Non-Carbon CFM: not available
  208. * CarbonLib: not available
  209. * Mac OS X: not available
  210. */
  211. EXTERN_API( OSErr )
  212. CursorDeviceButtons(
  213. CursorDevicePtr ourDevice,
  214. short buttons) TWOWORDINLINE(0x7003, 0xAADB);
  215. /*
  216. * CursorDeviceButtonDown()
  217. *
  218. * Availability:
  219. * Non-Carbon CFM: not available
  220. * CarbonLib: not available
  221. * Mac OS X: not available
  222. */
  223. EXTERN_API( OSErr )
  224. CursorDeviceButtonDown(CursorDevicePtr ourDevice) TWOWORDINLINE(0x7004, 0xAADB);
  225. /*
  226. * CursorDeviceButtonUp()
  227. *
  228. * Availability:
  229. * Non-Carbon CFM: not available
  230. * CarbonLib: not available
  231. * Mac OS X: not available
  232. */
  233. EXTERN_API( OSErr )
  234. CursorDeviceButtonUp(CursorDevicePtr ourDevice) TWOWORDINLINE(0x7005, 0xAADB);
  235. /*
  236. * CursorDeviceButtonOp()
  237. *
  238. * Availability:
  239. * Non-Carbon CFM: not available
  240. * CarbonLib: not available
  241. * Mac OS X: not available
  242. */
  243. EXTERN_API( OSErr )
  244. CursorDeviceButtonOp(
  245. CursorDevicePtr ourDevice,
  246. short buttonNumber,
  247. ButtonOpcode opcode,
  248. long data) TWOWORDINLINE(0x7006, 0xAADB);
  249. /*
  250. * CursorDeviceSetButtons()
  251. *
  252. * Availability:
  253. * Non-Carbon CFM: not available
  254. * CarbonLib: not available
  255. * Mac OS X: not available
  256. */
  257. EXTERN_API( OSErr )
  258. CursorDeviceSetButtons(
  259. CursorDevicePtr ourDevice,
  260. short numberOfButtons) TWOWORDINLINE(0x7007, 0xAADB);
  261. /*
  262. * CursorDeviceSetAcceleration()
  263. *
  264. * Availability:
  265. * Non-Carbon CFM: not available
  266. * CarbonLib: not available
  267. * Mac OS X: not available
  268. */
  269. EXTERN_API( OSErr )
  270. CursorDeviceSetAcceleration(
  271. CursorDevicePtr ourDevice,
  272. Fixed acceleration) TWOWORDINLINE(0x7008, 0xAADB);
  273. /*
  274. * CursorDeviceDoubleTime()
  275. *
  276. * Availability:
  277. * Non-Carbon CFM: not available
  278. * CarbonLib: not available
  279. * Mac OS X: not available
  280. */
  281. EXTERN_API( OSErr )
  282. CursorDeviceDoubleTime(
  283. CursorDevicePtr ourDevice,
  284. long durationTicks) TWOWORDINLINE(0x7009, 0xAADB);
  285. /*
  286. * CursorDeviceUnitsPerInch()
  287. *
  288. * Availability:
  289. * Non-Carbon CFM: not available
  290. * CarbonLib: not available
  291. * Mac OS X: not available
  292. */
  293. EXTERN_API( OSErr )
  294. CursorDeviceUnitsPerInch(
  295. CursorDevicePtr ourDevice,
  296. Fixed resolution) TWOWORDINLINE(0x700A, 0xAADB);
  297. /*
  298. * CursorDeviceNextDevice()
  299. *
  300. * Availability:
  301. * Non-Carbon CFM: not available
  302. * CarbonLib: not available
  303. * Mac OS X: not available
  304. */
  305. EXTERN_API( OSErr )
  306. CursorDeviceNextDevice(CursorDevicePtr * ourDevice) TWOWORDINLINE(0x700B, 0xAADB);
  307. /*
  308. * CursorDeviceNewDevice()
  309. *
  310. * Availability:
  311. * Non-Carbon CFM: not available
  312. * CarbonLib: not available
  313. * Mac OS X: not available
  314. */
  315. EXTERN_API( OSErr )
  316. CursorDeviceNewDevice(CursorDevicePtr * ourDevice) TWOWORDINLINE(0x700C, 0xAADB);
  317. /*
  318. * CursorDeviceDisposeDevice()
  319. *
  320. * Availability:
  321. * Non-Carbon CFM: not available
  322. * CarbonLib: not available
  323. * Mac OS X: not available
  324. */
  325. EXTERN_API( OSErr )
  326. CursorDeviceDisposeDevice(CursorDevicePtr ourDevice) TWOWORDINLINE(0x700D, 0xAADB);
  327. /*
  328. * * * W A R N I N G * * *
  329. The routines CrsrDevMoveTo and CrsrDevNextDevice are no longer needed.
  330. They were added as a work around until the glue code CursorDevicesGlue.o
  331. was created. Please use the functions CursorDeviceMoveTo and
  332. CursorDeviceNextDevice instead.
  333. */
  334. #endif /* CALL_NOT_IN_CARBON */
  335. #if OLDROUTINENAMES
  336. #if CALL_NOT_IN_CARBON
  337. /*
  338. * CrsrDevMoveTo()
  339. *
  340. * Availability:
  341. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  342. * CarbonLib: not available
  343. * Mac OS X: not available
  344. */
  345. EXTERN_API( OSErr )
  346. CrsrDevMoveTo(
  347. CursorDevicePtr ourDevice,
  348. long absX,
  349. long absY) TWOWORDINLINE(0x7001, 0xAADB);
  350. /*
  351. * CrsrDevNextDevice()
  352. *
  353. * Availability:
  354. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  355. * CarbonLib: not available
  356. * Mac OS X: not available
  357. */
  358. EXTERN_API( OSErr )
  359. CrsrDevNextDevice(CursorDevicePtr * ourDevice) TWOWORDINLINE(0x700B, 0xAADB);
  360. #endif /* CALL_NOT_IN_CARBON */
  361. #endif /* OLDROUTINENAMES */
  362. #if PRAGMA_STRUCT_ALIGN
  363. #pragma options align=reset
  364. #elif PRAGMA_STRUCT_PACKPUSH
  365. #pragma pack(pop)
  366. #elif PRAGMA_STRUCT_PACK
  367. #pragma pack()
  368. #endif
  369. #ifdef PRAGMA_IMPORT_OFF
  370. #pragma import off
  371. #elif PRAGMA_IMPORT
  372. #pragma import reset
  373. #endif
  374. #ifdef __cplusplus
  375. }
  376. #endif
  377. #endif /* __CURSORDEVICES__ */