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.

937 lines
28 KiB

  1. /*
  2. File: Events.h
  3. Contains: Event Manager Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1985-2001 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __EVENTS__
  11. #define __EVENTS__
  12. #ifndef __OSUTILS__
  13. #include <OSUtils.h>
  14. #endif
  15. #ifndef __MACTYPES__
  16. #include <MacTypes.h>
  17. #endif
  18. #if !TARGET_OS_MAC || !TARGET_API_MAC_OS8
  19. #ifndef __ENDIAN__
  20. #include <Endian.h>
  21. #endif
  22. #endif /* !TARGET_OS_MAC || !TARGET_API_MAC_OS8 */
  23. #ifndef __QUICKDRAW__
  24. #include <Quickdraw.h>
  25. #endif
  26. #if PRAGMA_ONCE
  27. #pragma once
  28. #endif
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. #if PRAGMA_IMPORT
  33. #pragma import on
  34. #endif
  35. #if PRAGMA_STRUCT_ALIGN
  36. #pragma options align=mac68k
  37. #elif PRAGMA_STRUCT_PACKPUSH
  38. #pragma pack(push, 2)
  39. #elif PRAGMA_STRUCT_PACK
  40. #pragma pack(2)
  41. #endif
  42. typedef UInt16 EventKind;
  43. typedef UInt16 EventMask;
  44. enum {
  45. nullEvent = 0,
  46. mouseDown = 1,
  47. mouseUp = 2,
  48. keyDown = 3,
  49. keyUp = 4,
  50. autoKey = 5,
  51. updateEvt = 6,
  52. diskEvt = 7, /* Not sent in Carbon. See kEventClassVolume in CarbonEvents.h*/
  53. activateEvt = 8,
  54. osEvt = 15,
  55. kHighLevelEvent = 23
  56. };
  57. enum {
  58. mDownMask = 1 << mouseDown, /* mouse button pressed*/
  59. mUpMask = 1 << mouseUp, /* mouse button released*/
  60. keyDownMask = 1 << keyDown, /* key pressed*/
  61. keyUpMask = 1 << keyUp, /* key released*/
  62. autoKeyMask = 1 << autoKey, /* key repeatedly held down*/
  63. updateMask = 1 << updateEvt, /* window needs updating*/
  64. diskMask = 1 << diskEvt, /* disk inserted*/
  65. activMask = 1 << activateEvt, /* activate/deactivate window*/
  66. highLevelEventMask = 0x0400, /* high-level events (includes AppleEvents)*/
  67. osMask = 1 << osEvt, /* operating system events (suspend, resume)*/
  68. everyEvent = 0xFFFF /* all of the above*/
  69. };
  70. enum {
  71. charCodeMask = 0x000000FF,
  72. keyCodeMask = 0x0000FF00,
  73. adbAddrMask = 0x00FF0000,
  74. osEvtMessageMask = (unsigned long)0xFF000000
  75. };
  76. enum {
  77. /* OS event messages. Event (sub)code is in the high byte of the message field.*/
  78. mouseMovedMessage = 0x00FA,
  79. suspendResumeMessage = 0x0001
  80. };
  81. enum {
  82. resumeFlag = 1 /* Bit 0 of message indicates resume vs suspend*/
  83. };
  84. #if CALL_NOT_IN_CARBON
  85. /* convertClipboardFlag is not ever set under Carbon. This is because scrap conversion is */
  86. /* not tied to suspend/resume events any longer. Your application should instead use the */
  87. /* scrap promise mechanism and fulfill scrap requests only when your promise keeper proc */
  88. /* is called. If you need to know if the scrap has changed, you can cache the last */
  89. /* ScrapRef you received and compare it with the current ScrapRef */
  90. enum {
  91. convertClipboardFlag = 2 /* Bit 1 in resume message indicates clipboard change*/
  92. };
  93. #endif /* CALL_NOT_IN_CARBON */
  94. /*
  95. CARBON ALERT! BATTLESTATIONS!
  96. The EventModifiers bits defined here are also used in the newer Carbon Event
  97. key modifiers parameters. There are two main differences:
  98. 1) The Carbon key modifiers parameter is a UInt32, not a UInt16. Never try to
  99. extract the key modifiers parameter from a Carbon Event into an EventModifiers
  100. type. You will probably get your stack trashed.
  101. 2) The Carbon key modifiers is just that: key modifiers. That parameter will
  102. never contain the button state bit.
  103. */
  104. typedef UInt16 EventModifiers;
  105. enum {
  106. /* modifiers */
  107. activeFlagBit = 0, /* activate? (activateEvt and mouseDown)*/
  108. btnStateBit = 7, /* state of button?*/
  109. cmdKeyBit = 8, /* command key down?*/
  110. shiftKeyBit = 9, /* shift key down?*/
  111. alphaLockBit = 10, /* alpha lock down?*/
  112. optionKeyBit = 11, /* option key down?*/
  113. controlKeyBit = 12, /* control key down?*/
  114. rightShiftKeyBit = 13, /* right shift key down?*/
  115. rightOptionKeyBit = 14, /* right Option key down?*/
  116. rightControlKeyBit = 15 /* right Control key down?*/
  117. };
  118. enum {
  119. activeFlag = 1 << activeFlagBit,
  120. btnState = 1 << btnStateBit,
  121. cmdKey = 1 << cmdKeyBit,
  122. shiftKey = 1 << shiftKeyBit,
  123. alphaLock = 1 << alphaLockBit,
  124. optionKey = 1 << optionKeyBit,
  125. controlKey = 1 << controlKeyBit,
  126. rightShiftKey = 1 << rightShiftKeyBit,
  127. rightOptionKey = 1 << rightOptionKeyBit,
  128. rightControlKey = 1 << rightControlKeyBit
  129. };
  130. /* MacRoman character codes*/
  131. enum {
  132. kNullCharCode = 0,
  133. kHomeCharCode = 1,
  134. kEnterCharCode = 3,
  135. kEndCharCode = 4,
  136. kHelpCharCode = 5,
  137. kBellCharCode = 7,
  138. kBackspaceCharCode = 8,
  139. kTabCharCode = 9,
  140. kLineFeedCharCode = 10,
  141. kVerticalTabCharCode = 11,
  142. kPageUpCharCode = 11,
  143. kFormFeedCharCode = 12,
  144. kPageDownCharCode = 12,
  145. kReturnCharCode = 13,
  146. kFunctionKeyCharCode = 16,
  147. kCommandCharCode = 17, /* glyph available only in system fonts*/
  148. kCheckCharCode = 18, /* glyph available only in system fonts*/
  149. kDiamondCharCode = 19, /* glyph available only in system fonts*/
  150. kAppleLogoCharCode = 20, /* glyph available only in system fonts*/
  151. kEscapeCharCode = 27,
  152. kClearCharCode = 27,
  153. kLeftArrowCharCode = 28,
  154. kRightArrowCharCode = 29,
  155. kUpArrowCharCode = 30,
  156. kDownArrowCharCode = 31,
  157. kSpaceCharCode = 32,
  158. kDeleteCharCode = 127,
  159. kBulletCharCode = 165,
  160. kNonBreakingSpaceCharCode = 202
  161. };
  162. /* useful Unicode code points*/
  163. enum {
  164. kShiftUnicode = 0x21E7, /* Unicode UPWARDS WHITE ARROW*/
  165. kControlUnicode = 0x2303, /* Unicode UP ARROWHEAD*/
  166. kOptionUnicode = 0x2325, /* Unicode OPTION KEY*/
  167. kCommandUnicode = 0x2318, /* Unicode PLACE OF INTEREST SIGN*/
  168. kPencilUnicode = 0x270E, /* Unicode LOWER RIGHT PENCIL*/
  169. kCheckUnicode = 0x2713, /* Unicode CHECK MARK*/
  170. kDiamondUnicode = 0x25C6, /* Unicode BLACK DIAMOND*/
  171. kBulletUnicode = 0x2022, /* Unicode BULLET*/
  172. kAppleLogoUnicode = 0xF8FF /* Unicode APPLE LOGO*/
  173. };
  174. struct EventRecord {
  175. EventKind what;
  176. UInt32 message;
  177. UInt32 when;
  178. Point where;
  179. EventModifiers modifiers;
  180. };
  181. typedef struct EventRecord EventRecord;
  182. typedef CALLBACK_API( void , FKEYProcPtr )(void);
  183. typedef STACK_UPP_TYPE(FKEYProcPtr) FKEYUPP;
  184. #if CALL_NOT_IN_CARBON
  185. /*
  186. * NewFKEYUPP()
  187. *
  188. * Availability:
  189. * Non-Carbon CFM: available as macro/inline
  190. * CarbonLib: not available
  191. * Mac OS X: not available
  192. */
  193. EXTERN_API_C( FKEYUPP )
  194. NewFKEYUPP(FKEYProcPtr userRoutine);
  195. #if !OPAQUE_UPP_TYPES
  196. enum { uppFKEYProcInfo = 0x00000000 }; /* pascal no_return_value Func() */
  197. #ifdef __cplusplus
  198. inline DEFINE_API_C(FKEYUPP) NewFKEYUPP(FKEYProcPtr userRoutine) { return (FKEYUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFKEYProcInfo, GetCurrentArchitecture()); }
  199. #else
  200. #define NewFKEYUPP(userRoutine) (FKEYUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFKEYProcInfo, GetCurrentArchitecture())
  201. #endif
  202. #endif
  203. /*
  204. * DisposeFKEYUPP()
  205. *
  206. * Availability:
  207. * Non-Carbon CFM: available as macro/inline
  208. * CarbonLib: not available
  209. * Mac OS X: not available
  210. */
  211. EXTERN_API_C( void )
  212. DisposeFKEYUPP(FKEYUPP userUPP);
  213. #if !OPAQUE_UPP_TYPES
  214. #ifdef __cplusplus
  215. inline DEFINE_API_C(void) DisposeFKEYUPP(FKEYUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  216. #else
  217. #define DisposeFKEYUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  218. #endif
  219. #endif
  220. /*
  221. * InvokeFKEYUPP()
  222. *
  223. * Availability:
  224. * Non-Carbon CFM: available as macro/inline
  225. * CarbonLib: not available
  226. * Mac OS X: not available
  227. */
  228. EXTERN_API_C( void )
  229. InvokeFKEYUPP(FKEYUPP userUPP);
  230. #if !OPAQUE_UPP_TYPES
  231. #ifdef __cplusplus
  232. inline DEFINE_API_C(void) InvokeFKEYUPP(FKEYUPP userUPP) { CALL_ZERO_PARAMETER_UPP(userUPP, uppFKEYProcInfo); }
  233. #else
  234. #define InvokeFKEYUPP(userUPP) CALL_ZERO_PARAMETER_UPP((userUPP), uppFKEYProcInfo)
  235. #endif
  236. #endif
  237. #endif /* CALL_NOT_IN_CARBON */
  238. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  239. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  240. #define NewFKEYProc(userRoutine) NewFKEYUPP(userRoutine)
  241. #define CallFKEYProc(userRoutine) InvokeFKEYUPP(userRoutine)
  242. #endif /* CALL_NOT_IN_CARBON */
  243. /*
  244. * GetMouse()
  245. *
  246. * Availability:
  247. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  248. * CarbonLib: in CarbonLib 1.0 and later
  249. * Mac OS X: in version 10.0 and later
  250. */
  251. EXTERN_API( void )
  252. GetMouse(Point * mouseLoc) ONEWORDINLINE(0xA972);
  253. /*
  254. * Button()
  255. *
  256. * Availability:
  257. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  258. * CarbonLib: in CarbonLib 1.0 and later
  259. * Mac OS X: in version 10.0 and later
  260. */
  261. EXTERN_API( Boolean )
  262. Button(void) ONEWORDINLINE(0xA974);
  263. /*
  264. * StillDown()
  265. *
  266. * Availability:
  267. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  268. * CarbonLib: in CarbonLib 1.0 and later
  269. * Mac OS X: in version 10.0 and later
  270. */
  271. EXTERN_API( Boolean )
  272. StillDown(void) ONEWORDINLINE(0xA973);
  273. /*
  274. * WaitMouseUp()
  275. *
  276. * Availability:
  277. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  278. * CarbonLib: in CarbonLib 1.0 and later
  279. * Mac OS X: in version 10.0 and later
  280. */
  281. EXTERN_API( Boolean )
  282. WaitMouseUp(void) ONEWORDINLINE(0xA977);
  283. /*
  284. * KeyTranslate()
  285. *
  286. * Availability:
  287. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  288. * CarbonLib: in CarbonLib 1.0 and later
  289. * Mac OS X: in version 10.0 and later
  290. */
  291. EXTERN_API( UInt32 )
  292. KeyTranslate(
  293. const void * transData,
  294. UInt16 keycode,
  295. UInt32 * state) ONEWORDINLINE(0xA9C3);
  296. /*
  297. * GetCaretTime()
  298. *
  299. * Availability:
  300. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  301. * CarbonLib: in CarbonLib 1.0 and later
  302. * Mac OS X: in version 10.0 and later
  303. */
  304. EXTERN_API( UInt32 )
  305. GetCaretTime(void) TWOWORDINLINE(0x2EB8, 0x02F4);
  306. /*
  307. QuickTime 3.0 supports GetKeys() on win32.
  308. But, on little endian machines you will have to be
  309. careful about bit numberings and/or use a KeyMapByteArray
  310. instead.
  311. */
  312. #if TARGET_OS_MAC && TARGET_API_MAC_OS8
  313. typedef UInt32 KeyMap[4];
  314. #else
  315. typedef BigEndianLong KeyMap[4];
  316. #endif /* TARGET_OS_MAC && TARGET_API_MAC_OS8 */
  317. typedef UInt8 KeyMapByteArray[16];
  318. /*
  319. * GetKeys()
  320. *
  321. * Availability:
  322. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  323. * CarbonLib: in CarbonLib 1.0 and later
  324. * Mac OS X: in version 10.0 and later
  325. */
  326. EXTERN_API( void )
  327. GetKeys(KeyMap theKeys) ONEWORDINLINE(0xA976);
  328. /* Obsolete event types & masks */
  329. enum {
  330. networkEvt = 10,
  331. driverEvt = 11,
  332. app1Evt = 12,
  333. app2Evt = 13,
  334. app3Evt = 14,
  335. app4Evt = 15,
  336. networkMask = 0x0400,
  337. driverMask = 0x0800,
  338. app1Mask = 0x1000,
  339. app2Mask = 0x2000,
  340. app3Mask = 0x4000,
  341. app4Mask = 0x8000
  342. };
  343. struct EvQEl {
  344. QElemPtr qLink;
  345. SInt16 qType;
  346. EventKind evtQWhat; /* this part is identical to the EventRecord as defined above */
  347. UInt32 evtQMessage;
  348. UInt32 evtQWhen;
  349. Point evtQWhere;
  350. EventModifiers evtQModifiers;
  351. };
  352. typedef struct EvQEl EvQEl;
  353. typedef EvQEl * EvQElPtr;
  354. typedef CALLBACK_API_REGISTER68K( void , GetNextEventFilterProcPtr, (EventRecord *theEvent, Boolean *result) );
  355. typedef REGISTER_UPP_TYPE(GetNextEventFilterProcPtr) GetNextEventFilterUPP;
  356. #if CALL_NOT_IN_CARBON
  357. /*
  358. * NewGetNextEventFilterUPP()
  359. *
  360. * Availability:
  361. * Non-Carbon CFM: available as macro/inline
  362. * CarbonLib: not available
  363. * Mac OS X: not available
  364. */
  365. EXTERN_API_C( GetNextEventFilterUPP )
  366. NewGetNextEventFilterUPP(GetNextEventFilterProcPtr userRoutine);
  367. #if !OPAQUE_UPP_TYPES
  368. enum { uppGetNextEventFilterProcInfo = 0x000000BF }; /* SPECIAL_CASE_PROCINFO(11) */
  369. #ifdef __cplusplus
  370. inline DEFINE_API_C(GetNextEventFilterUPP) NewGetNextEventFilterUPP(GetNextEventFilterProcPtr userRoutine) { return (GetNextEventFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppGetNextEventFilterProcInfo, GetCurrentArchitecture()); }
  371. #else
  372. #define NewGetNextEventFilterUPP(userRoutine) (GetNextEventFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppGetNextEventFilterProcInfo, GetCurrentArchitecture())
  373. #endif
  374. #endif
  375. /*
  376. * DisposeGetNextEventFilterUPP()
  377. *
  378. * Availability:
  379. * Non-Carbon CFM: available as macro/inline
  380. * CarbonLib: not available
  381. * Mac OS X: not available
  382. */
  383. EXTERN_API_C( void )
  384. DisposeGetNextEventFilterUPP(GetNextEventFilterUPP userUPP);
  385. #if !OPAQUE_UPP_TYPES
  386. #ifdef __cplusplus
  387. inline DEFINE_API_C(void) DisposeGetNextEventFilterUPP(GetNextEventFilterUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  388. #else
  389. #define DisposeGetNextEventFilterUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  390. #endif
  391. #endif
  392. /*
  393. * InvokeGetNextEventFilterUPP()
  394. *
  395. * Availability:
  396. * Non-Carbon CFM: available as macro/inline
  397. * CarbonLib: not available
  398. * Mac OS X: not available
  399. */
  400. EXTERN_API_C( void )
  401. InvokeGetNextEventFilterUPP(
  402. EventRecord * theEvent,
  403. Boolean * result,
  404. GetNextEventFilterUPP userUPP);
  405. #if !OPAQUE_UPP_TYPES && (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
  406. #ifdef __cplusplus
  407. inline DEFINE_API_C(void) InvokeGetNextEventFilterUPP(EventRecord * theEvent, Boolean * result, GetNextEventFilterUPP userUPP) { CALL_TWO_PARAMETER_UPP(userUPP, uppGetNextEventFilterProcInfo, theEvent, result); }
  408. #else
  409. #define InvokeGetNextEventFilterUPP(theEvent, result, userUPP) CALL_TWO_PARAMETER_UPP((userUPP), uppGetNextEventFilterProcInfo, (theEvent), (result))
  410. #endif
  411. #endif
  412. #endif /* CALL_NOT_IN_CARBON */
  413. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  414. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  415. #define NewGetNextEventFilterProc(userRoutine) NewGetNextEventFilterUPP(userRoutine)
  416. #define CallGetNextEventFilterProc(userRoutine, theEvent, result) InvokeGetNextEventFilterUPP(theEvent, result, userRoutine)
  417. #endif /* CALL_NOT_IN_CARBON */
  418. typedef GetNextEventFilterUPP GNEFilterUPP;
  419. /*
  420. * GetDblTime()
  421. *
  422. * Availability:
  423. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  424. * CarbonLib: in CarbonLib 1.0 and later
  425. * Mac OS X: in version 10.0 and later
  426. */
  427. EXTERN_API( UInt32 )
  428. GetDblTime(void) TWOWORDINLINE(0x2EB8, 0x02F0);
  429. /*
  430. * SetEventMask()
  431. *
  432. * Availability:
  433. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  434. * CarbonLib: in CarbonLib 1.0 and later
  435. * Mac OS X: in version 10.0 and later
  436. */
  437. EXTERN_API( void )
  438. SetEventMask(EventMask value) TWOWORDINLINE(0x31DF, 0x0144);
  439. #if CALL_NOT_IN_CARBON
  440. /*
  441. * GetEvQHdr()
  442. *
  443. * Availability:
  444. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  445. * CarbonLib: not available
  446. * Mac OS X: not available
  447. */
  448. EXTERN_API( QHdrPtr )
  449. GetEvQHdr(void) THREEWORDINLINE(0x2EBC, 0x0000, 0x014A);
  450. #endif /* CALL_NOT_IN_CARBON */
  451. #if CALL_NOT_IN_CARBON
  452. /*
  453. * PPostEvent()
  454. *
  455. * Availability:
  456. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  457. * CarbonLib: not available
  458. * Mac OS X: not available
  459. */
  460. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  461. #pragma parameter __D0 PPostEvent(__A0, __D0, __A1)
  462. #endif
  463. EXTERN_API( OSErr )
  464. PPostEvent(
  465. EventKind eventCode,
  466. UInt32 eventMsg,
  467. EvQElPtr * qEl) TWOWORDINLINE(0xA12F, 0x2288);
  468. #endif /* CALL_NOT_IN_CARBON */
  469. /*
  470. * GetNextEvent()
  471. *
  472. * Availability:
  473. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  474. * CarbonLib: in CarbonLib 1.0 and later
  475. * Mac OS X: in version 10.0 and later
  476. */
  477. EXTERN_API( Boolean )
  478. GetNextEvent(
  479. EventMask eventMask,
  480. EventRecord * theEvent) ONEWORDINLINE(0xA970);
  481. /*
  482. * WaitNextEvent()
  483. *
  484. * Availability:
  485. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  486. * CarbonLib: in CarbonLib 1.0 and later
  487. * Mac OS X: in version 10.0 and later
  488. */
  489. EXTERN_API( Boolean )
  490. WaitNextEvent(
  491. EventMask eventMask,
  492. EventRecord * theEvent,
  493. UInt32 sleep,
  494. RgnHandle mouseRgn) /* can be NULL */ ONEWORDINLINE(0xA860);
  495. /*
  496. * EventAvail()
  497. *
  498. * Availability:
  499. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  500. * CarbonLib: in CarbonLib 1.0 and later
  501. * Mac OS X: in version 10.0 and later
  502. */
  503. EXTERN_API( Boolean )
  504. EventAvail(
  505. EventMask eventMask,
  506. EventRecord * theEvent) ONEWORDINLINE(0xA971);
  507. /*
  508. * PostEvent()
  509. *
  510. * Availability:
  511. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  512. * CarbonLib: in CarbonLib 1.0 and later
  513. * Mac OS X: in version 10.0 and later
  514. */
  515. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  516. #pragma parameter __D0 PostEvent(__A0, __D0)
  517. #endif
  518. EXTERN_API( OSErr )
  519. PostEvent(
  520. EventKind eventNum,
  521. UInt32 eventMsg) ONEWORDINLINE(0xA02F);
  522. /*
  523. For Carbon, use EventAvail, TickCount, GetGlobalMouse,
  524. GetKeys, or GetCurrentKeyModifiers instead of
  525. OSEventAvail, and use GetNextEvent or WaitNextEvent
  526. instead of GetOSEvent.
  527. */
  528. #if CALL_NOT_IN_CARBON
  529. /*
  530. * OSEventAvail()
  531. *
  532. * Availability:
  533. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  534. * CarbonLib: not available
  535. * Mac OS X: not available
  536. */
  537. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  538. #pragma parameter __D0 OSEventAvail(__D0, __A0)
  539. #endif
  540. EXTERN_API( Boolean )
  541. OSEventAvail(
  542. EventMask mask,
  543. EventRecord * theEvent) TWOWORDINLINE(0xA030, 0x5240);
  544. /*
  545. * GetOSEvent()
  546. *
  547. * Availability:
  548. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  549. * CarbonLib: not available
  550. * Mac OS X: not available
  551. */
  552. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  553. #pragma parameter __D0 GetOSEvent(__D0, __A0)
  554. #endif
  555. EXTERN_API( Boolean )
  556. GetOSEvent(
  557. EventMask mask,
  558. EventRecord * theEvent) TWOWORDINLINE(0xA031, 0x5240);
  559. #endif /* CALL_NOT_IN_CARBON */
  560. /*
  561. * FlushEvents()
  562. *
  563. * Availability:
  564. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  565. * CarbonLib: in CarbonLib 1.0 and later
  566. * Mac OS X: in version 10.0 and later
  567. */
  568. EXTERN_API( void )
  569. FlushEvents(
  570. EventMask whichMask,
  571. EventMask stopMask) TWOWORDINLINE(0x201F, 0xA032);
  572. #if CALL_NOT_IN_CARBON
  573. /*
  574. * SystemClick()
  575. *
  576. * Availability:
  577. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  578. * CarbonLib: not available
  579. * Mac OS X: not available
  580. */
  581. EXTERN_API( void )
  582. SystemClick(
  583. const EventRecord * theEvent,
  584. WindowRef theWindow) ONEWORDINLINE(0xA9B3);
  585. /*
  586. * SystemTask()
  587. *
  588. * Availability:
  589. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  590. * CarbonLib: not available
  591. * Mac OS X: not available
  592. */
  593. EXTERN_API( void )
  594. SystemTask(void) ONEWORDINLINE(0xA9B4);
  595. /*
  596. * SystemEvent()
  597. *
  598. * Availability:
  599. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  600. * CarbonLib: not available
  601. * Mac OS X: not available
  602. */
  603. EXTERN_API( Boolean )
  604. SystemEvent(const EventRecord * theEvent) ONEWORDINLINE(0xA9B2);
  605. #endif /* CALL_NOT_IN_CARBON */
  606. #if OLDROUTINENAMES
  607. #define KeyTrans(transData, keycode, state) KeyTranslate(transData, keycode, state)
  608. #endif /* OLDROUTINENAMES */
  609. /*
  610. GetGlobalMouse, GetCurrentKeyModifiers, and CheckEventQueueForUserCancel
  611. are only available as part of the Carbon API.
  612. */
  613. /*
  614. * GetGlobalMouse()
  615. *
  616. * Summary:
  617. * Returns the position of the mouse in global coordinates.
  618. *
  619. * Parameters:
  620. *
  621. * globalMouse:
  622. * On exit, contains the mouse position in global coordinates.
  623. *
  624. * Availability:
  625. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  626. * CarbonLib: in CarbonLib 1.0 and later
  627. * Mac OS X: in version 10.0 and later
  628. */
  629. EXTERN_API( void )
  630. GetGlobalMouse(Point * globalMouse);
  631. /*
  632. * GetCurrentKeyModifiers()
  633. *
  634. * Summary:
  635. * Returns the current hardware keyboard modifier state.
  636. *
  637. * Discussion:
  638. * In most cases, you should not use GetCurrentKeyModifiers, but
  639. * should use the GetCurrentEventKeyModifiers function instead.
  640. * GetCurrentEventKeyModifiers is much faster than
  641. * GetCurrentKeyModifiers because it returns the locally cached
  642. * modifier state; GetCurrentKeyModifiers must get the modifier
  643. * state from the window server, which is slower. Using
  644. * GetCurrentKeyModifiers also can prevent your application from
  645. * being operated by remote posting of events, since the hardware
  646. * input device is not actually changing state in that case. Most
  647. * commonly, you might need to use GetCurrentKeyModifiers when your
  648. * application is not the active application (as determined by the
  649. * Process Manager function GetFrontProcess). In that case, the
  650. * cached modifier state returned by GetCurrentEventKeyModifiers is
  651. * not valid because modifier-changed events are not flowing to your
  652. * application, and you must use GetCurrentKeyModifiers to determine
  653. * the current hardware state.
  654. *
  655. * Result:
  656. * The hardware state of the keyboard modifiers. The format of the
  657. * return value is the same as the modifiers field of an EventRecord
  658. * (but only includes keyboard modifiers and not the other modifier
  659. * flags included in an EventRecord).
  660. *
  661. * Availability:
  662. * Non-Carbon CFM: not available
  663. * CarbonLib: in CarbonLib 1.0 and later
  664. * Mac OS X: in version 10.0 and later
  665. */
  666. EXTERN_API( UInt32 )
  667. GetCurrentKeyModifiers(void);
  668. /*
  669. * CheckEventQueueForUserCancel()
  670. *
  671. * Summary:
  672. * Determines if there is a cancel event in the main thread's event
  673. * queue.
  674. *
  675. * Discussion:
  676. * This API supports two cancel events: Escape and Cmd-Period. The
  677. * cancel event itself, as well as mouse or keyboard events in front
  678. * of the cancel event in the event queue, will be removed from the
  679. * queue.
  680. *
  681. * Availability:
  682. * Non-Carbon CFM: not available
  683. * CarbonLib: in CarbonLib 1.0.2 and later
  684. * Mac OS X: in version 10.0 and later
  685. */
  686. EXTERN_API( Boolean )
  687. CheckEventQueueForUserCancel(void);
  688. /*
  689. * KeyScript()
  690. *
  691. * Availability:
  692. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  693. * CarbonLib: in CarbonLib 1.0 and later
  694. * Mac OS X: in version 10.0 and later
  695. */
  696. EXTERN_API( void )
  697. KeyScript(short code) FOURWORDINLINE(0x2F3C, 0x8002, 0x0004, 0xA8B5);
  698. /*
  699. * IsCmdChar()
  700. *
  701. * Availability:
  702. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  703. * CarbonLib: in CarbonLib 1.0 and later
  704. * Mac OS X: in version 10.0 and later
  705. */
  706. EXTERN_API( Boolean )
  707. IsCmdChar(
  708. const EventRecord * event,
  709. short test) FOURWORDINLINE(0x2F3C, 0x8206, 0xFFD0, 0xA8B5);
  710. /*
  711. LowMem accessor functions previously in LowMem.h
  712. */
  713. /*
  714. * LMGetKeyThresh()
  715. *
  716. * Availability:
  717. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  718. * CarbonLib: in CarbonLib 1.0 and later
  719. * Mac OS X: in version 10.0 and later
  720. */
  721. EXTERN_API( SInt16 )
  722. LMGetKeyThresh(void) TWOWORDINLINE(0x3EB8, 0x018E);
  723. /*
  724. * LMSetKeyThresh()
  725. *
  726. * Availability:
  727. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  728. * CarbonLib: in CarbonLib 1.0 and later
  729. * Mac OS X: in version 10.0 and later
  730. */
  731. EXTERN_API( void )
  732. LMSetKeyThresh(SInt16 value) TWOWORDINLINE(0x31DF, 0x018E);
  733. /*
  734. * LMGetKeyRepThresh()
  735. *
  736. * Availability:
  737. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  738. * CarbonLib: in CarbonLib 1.0 and later
  739. * Mac OS X: in version 10.0 and later
  740. */
  741. EXTERN_API( SInt16 )
  742. LMGetKeyRepThresh(void) TWOWORDINLINE(0x3EB8, 0x0190);
  743. /*
  744. * LMSetKeyRepThresh()
  745. *
  746. * Availability:
  747. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  748. * CarbonLib: in CarbonLib 1.0 and later
  749. * Mac OS X: in version 10.0 and later
  750. */
  751. EXTERN_API( void )
  752. LMSetKeyRepThresh(SInt16 value) TWOWORDINLINE(0x31DF, 0x0190);
  753. /*
  754. * LMGetKbdLast()
  755. *
  756. * Availability:
  757. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  758. * CarbonLib: in CarbonLib 1.0 and later
  759. * Mac OS X: in version 10.0 and later
  760. */
  761. EXTERN_API( UInt8 )
  762. LMGetKbdLast(void) TWOWORDINLINE(0x1EB8, 0x0218);
  763. /*
  764. * LMSetKbdLast()
  765. *
  766. * Availability:
  767. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  768. * CarbonLib: in CarbonLib 1.0 and later
  769. * Mac OS X: in version 10.0 and later
  770. */
  771. EXTERN_API( void )
  772. LMSetKbdLast(UInt8 value) TWOWORDINLINE(0x11DF, 0x0218);
  773. /*
  774. * LMGetKbdType()
  775. *
  776. * Availability:
  777. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  778. * CarbonLib: in CarbonLib 1.0 and later
  779. * Mac OS X: in version 10.0 and later
  780. */
  781. EXTERN_API( UInt8 )
  782. LMGetKbdType(void) TWOWORDINLINE(0x1EB8, 0x021E);
  783. /*
  784. * LMSetKbdType()
  785. *
  786. * Availability:
  787. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  788. * CarbonLib: in CarbonLib 1.0 and later
  789. * Mac OS X: in version 10.0 and later
  790. */
  791. EXTERN_API( void )
  792. LMSetKbdType(UInt8 value) TWOWORDINLINE(0x11DF, 0x021E);
  793. #if PRAGMA_STRUCT_ALIGN
  794. #pragma options align=reset
  795. #elif PRAGMA_STRUCT_PACKPUSH
  796. #pragma pack(pop)
  797. #elif PRAGMA_STRUCT_PACK
  798. #pragma pack()
  799. #endif
  800. #ifdef PRAGMA_IMPORT_OFF
  801. #pragma import off
  802. #elif PRAGMA_IMPORT
  803. #pragma import reset
  804. #endif
  805. #ifdef __cplusplus
  806. }
  807. #endif
  808. #endif /* __EVENTS__ */