CGRemoteOperation.pas 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. {
  2. * CGRemoteOperation.h
  3. * CoreGraphics
  4. *
  5. * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  6. *
  7. }
  8. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, August 2005 }
  9. {
  10. Modified for use with Free Pascal
  11. Version 200
  12. Please report any bugs to <[email protected]>
  13. }
  14. {$mode macpas}
  15. {$packenum 1}
  16. {$macro on}
  17. {$inline on}
  18. {$CALLING MWPASCAL}
  19. unit CGRemoteOperation;
  20. interface
  21. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  22. {$setc GAP_INTERFACES_VERSION := $0200}
  23. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  24. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  25. {$endc}
  26. {$ifc defined CPUPOWERPC and defined CPUI386}
  27. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  28. {$endc}
  29. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  30. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  31. {$endc}
  32. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  33. {$setc __ppc__ := 1}
  34. {$elsec}
  35. {$setc __ppc__ := 0}
  36. {$endc}
  37. {$ifc not defined __i386__ and defined CPUI386}
  38. {$setc __i386__ := 1}
  39. {$elsec}
  40. {$setc __i386__ := 0}
  41. {$endc}
  42. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  43. {$error Conflicting definitions for __ppc__ and __i386__}
  44. {$endc}
  45. {$ifc defined __ppc__ and __ppc__}
  46. {$setc TARGET_CPU_PPC := TRUE}
  47. {$setc TARGET_CPU_X86 := FALSE}
  48. {$elifc defined __i386__ and __i386__}
  49. {$setc TARGET_CPU_PPC := FALSE}
  50. {$setc TARGET_CPU_X86 := TRUE}
  51. {$elsec}
  52. {$error Neither __ppc__ nor __i386__ is defined.}
  53. {$endc}
  54. {$setc TARGET_CPU_PPC_64 := FALSE}
  55. {$ifc defined FPC_BIG_ENDIAN}
  56. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  57. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  58. {$elifc defined FPC_LITTLE_ENDIAN}
  59. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  60. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  61. {$elsec}
  62. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  63. {$endc}
  64. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  65. {$setc CALL_NOT_IN_CARBON := FALSE}
  66. {$setc OLDROUTINENAMES := FALSE}
  67. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  68. {$setc OPAQUE_UPP_TYPES := TRUE}
  69. {$setc OTCARBONAPPLICATION := TRUE}
  70. {$setc OTKERNEL := FALSE}
  71. {$setc PM_USE_SESSION_APIS := TRUE}
  72. {$setc TARGET_API_MAC_CARBON := TRUE}
  73. {$setc TARGET_API_MAC_OS8 := FALSE}
  74. {$setc TARGET_API_MAC_OSX := TRUE}
  75. {$setc TARGET_CARBON := TRUE}
  76. {$setc TARGET_CPU_68K := FALSE}
  77. {$setc TARGET_CPU_MIPS := FALSE}
  78. {$setc TARGET_CPU_SPARC := FALSE}
  79. {$setc TARGET_OS_MAC := TRUE}
  80. {$setc TARGET_OS_UNIX := FALSE}
  81. {$setc TARGET_OS_WIN32 := FALSE}
  82. {$setc TARGET_RT_MAC_68881 := FALSE}
  83. {$setc TARGET_RT_MAC_CFM := FALSE}
  84. {$setc TARGET_RT_MAC_MACHO := TRUE}
  85. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  86. {$setc TYPE_BOOL := FALSE}
  87. {$setc TYPE_EXTENDED := FALSE}
  88. {$setc TYPE_LONGLONG := TRUE}
  89. uses MacTypes,CFMachPort,CGBase,CGGeometry,CGErrors,CFDate;
  90. {$ALIGN POWER}
  91. type
  92. CGEventErr = CGError;
  93. const
  94. CGEventNoErr = 0;
  95. { Screen refresh or drawing notification }
  96. {
  97. * Callback function pointer;
  98. * Declare your callback function in this form. When an area of the display is
  99. * modified or refreshed, your callback function will be invoked with a count
  100. * of the number of rectangles in the refreshed areas, and a list of the refreshed
  101. * rectangles. The rectangles are in global coordinates.
  102. *
  103. * Your function should not modify, deallocate or free memory pointed to by rectArray.
  104. *
  105. * The system continues to accumulate refreshed areas constantly. Whenever new
  106. * information is available, your callback function is invoked.The list of rects
  107. * passed to the callback function are cleared from the accumulated refreshed area
  108. * when the callback is made.
  109. *
  110. * This callback may be triggered by drawing operations, window movement, and
  111. * display reconfiguration.
  112. *
  113. * Bear in mind that a single rectangle may occupy multiple displays,
  114. * either by overlapping the displays, or by residing on coincident displays
  115. * when mirroring is active. Use the CGGetDisplaysWithRect() to determine
  116. * the displays a rectangle occupies.
  117. }
  118. type
  119. CGRectCount = UInt32;
  120. type
  121. CGScreenRefreshCallback = procedure( count: CGRectCount; {const} rectArray: {variable-size-array} CGRectPtr; userParameter: UnivPtr);
  122. { Begin Old API }
  123. {
  124. * Register a callback function to be invoked when an area of the display
  125. * is refreshed, or modified. The function is invoked on the same thread
  126. * of execution that is processing events within your application.
  127. * userParameter is passed back with each invocation of the callback function.
  128. }
  129. function CGRegisterScreenRefreshCallback( func: CGScreenRefreshCallback; userParameter: UnivPtr ): CGError; external name '_CGRegisterScreenRefreshCallback';
  130. {
  131. * Remove a previously registered calback function.
  132. * Both the function and the userParameter must match the registered entry to be removed.
  133. }
  134. procedure CGUnregisterScreenRefreshCallback( func: CGScreenRefreshCallback; userParameter: UnivPtr ); external name '_CGUnregisterScreenRefreshCallback';
  135. {
  136. * In some applications it may be preferable to have a seperate thread wait for screen refresh data.
  137. * This function should be called on a thread seperate from the event processing thread.
  138. * If screen refresh callback functions are registered, this function should not be used.
  139. * The mechanisms are mutually exclusive.
  140. *
  141. * Deallocate screen refresh rects using CGReleaseScreenRefreshRects().
  142. *
  143. * Returns an error code if parameters are invalid or an error occurs in retrieving
  144. * dirty screen rects from the server.
  145. }
  146. function CGWaitForScreenRefreshRects( var pRectArray: {variable-size-array} CGRectPtr; var pCount: CGRectCount ): CGEventErr; external name '_CGWaitForScreenRefreshRects';
  147. { End Old API }
  148. { Begin New API }
  149. {
  150. * Screen refresh operation types.
  151. * Operations are encoded as bits.
  152. * All users of this API must support a simple refresh, kCGScreenUpdateOperationRefresh.
  153. }
  154. type
  155. CGScreenUpdateOperation = SInt32;
  156. const
  157. kCGScreenUpdateOperationRefresh = 0;
  158. kCGScreenUpdateOperationMove = 1 shl 0;
  159. kCGScreenUpdateOperationReducedDirtyRectangleCount = 1 shl 31;
  160. {
  161. * Move operation notifications are restricted to changes that move a region by
  162. * an integer number of pixels.
  163. *
  164. * dX and dY describe the direction of movement.
  165. * Positive values of dX indicate movement to the right.
  166. * Negative values of dX indicate movement to the left.
  167. * Positive values of dY indicate movement downward.
  168. * Negative values of dY indicate movement upward.
  169. }
  170. type
  171. CGScreenUpdateMoveDelta = record
  172. dX, dY: SInt32;
  173. end;
  174. {
  175. * Move operation callback function pointer;
  176. * Declare your callback function in this form. When an area of the display is
  177. * moved, your callback function will be invoked with a count
  178. * of the number of rectangles in the moved area, and a list of the moved.
  179. * The rectangles are in global coordinates, and describe the area prior to the move
  180. * operation.
  181. *
  182. * dX and dY describe the direction of movement.
  183. * Positive values of dX indicate movement to the right.
  184. * Negative values of dX indicate movement to the left.
  185. * Positive values of dY indicate movement downward.
  186. * Negative values of dY indicate movement upward.
  187. *
  188. * Your function should not modify, deallocate or free memory pointed to by rectArray.
  189. *
  190. * This callback may be triggered by window movement or scrolling operations.
  191. *
  192. * Bear in mind that a single rectangle may occupy multiple displays,
  193. * either by overlapping the displays, or by residing on coincident displays
  194. * when mirroring is active. Use the CGGetDisplaysWithRect() function to determine
  195. * the displays a rectangle occupies.
  196. *
  197. * If no move callback function pointer is registered, then move operations are remapped to
  198. * refresh operations, and the CGScreenRefreshCallback function, if any, is called.
  199. }
  200. type
  201. CGScreenUpdateMoveCallback = procedure( delta: CGScreenUpdateMoveDelta; count: size_t; {const} rectArray: {variable-size-array} CGRectPtr; userParameter: UnivPtr );
  202. {
  203. * Register a callback function to be invoked when an area of the display
  204. * is moved. The function is invoked on the same thread
  205. * of execution that is processing events within your application.
  206. * userParameter is passed back with each invocation of the callback function.
  207. }
  208. function CGScreenRegisterMoveCallback( func: CGScreenUpdateMoveCallback; userParameter: UnivPtr ): CGError; external name '_CGScreenRegisterMoveCallback'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  209. {
  210. * Remove a previously registered callback function.
  211. }
  212. procedure CGScreenUnregisterMoveCallback( func: CGScreenUpdateMoveCallback; userParameter: UnivPtr ); external name '_CGScreenUnregisterMoveCallback'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  213. {
  214. * In some applications it may be preferable to have a seperate thread wait for screen update operations.
  215. * This function should be called on a thread seperate from the event processing thread.
  216. * If screen refresh callback functions are registered, this function should not be used.
  217. * The mechanisms are mutually exclusive.
  218. *
  219. * Deallocate screen update rects using CGReleaseScreenRefreshRects().
  220. *
  221. * requestedOperations may be:
  222. * kCGScreenUpdateOperationRefresh
  223. * All move operations are converted to refresh operations
  224. * currentOperation will always be returned as kCGScreenUpdateOperationRefresh
  225. * (kCGScreenUpdateOperationRefresh | kCGScreenUpdateOperationMove)
  226. * Wait for move or refresh operations.
  227. * currentOperation will be either kCGScreenUpdateOperationRefresh or kCGScreenUpdateOperationMove
  228. *
  229. * pDelta is updated with valid content if the currentOperation is kCGScreenUpdateOperationMove
  230. *
  231. * Returns an error code if parameters are invalid or an error occurs in retrieving
  232. * the screen rect data from the server.
  233. }
  234. function CGWaitForScreenUpdateRects( requestedOperations: CGScreenUpdateOperation; var currentOperation: CGScreenUpdateOperation; var pRectArray: {variable-size-array} CGRectPtr; var pCount: size_t; var pDelta: CGScreenUpdateMoveDelta ): CGError; external name '_CGWaitForScreenUpdateRects'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  235. { End New API }
  236. {
  237. * Deallocate the list of rects recieved from CGWaitForScreenRefreshRects()
  238. }
  239. procedure CGReleaseScreenRefreshRects( pRectArray: {variable-size-array} CGRectPtr); external name '_CGReleaseScreenRefreshRects';
  240. {
  241. * Programs reading the frame buffer content may want to hide the cursor, if it is visible and
  242. * drawn in framebuffer memory. A cursor may also be generated in an overlay plane of some form.
  243. *
  244. * These APIs provide basic cursor visibility and drawing information.
  245. * The cursor may be hidden or shown using the CGDisplayHideCursor() and CGDisplayShowCursor() API.
  246. }
  247. function CGCursorIsVisible: boolean_t; external name '_CGCursorIsVisible'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  248. function CGCursorIsDrawnInFramebuffer: boolean_t; external name '_CGCursorIsDrawnInFramebuffer'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  249. {
  250. * Posting events: These functions post events into the system. Use for remote
  251. * operation and virtualization.
  252. *
  253. * Note that remote operation requires a valid connection to the server, which
  254. * must be owned by either the root/Administrator user or the logged in console
  255. * user. This means that your application must be running as root/Administrator
  256. * user or the logged in console user.
  257. }
  258. {
  259. * Synthesize mouse events.
  260. * mouseCursorPosition should be the global coordinates the mouse is at for the event.
  261. * updateMouseCursor should be TRUE if the on-screen cursor
  262. * should be moved to mouseCursorPosition.
  263. *
  264. * Based on the values entered, the appropriate mouse-down, mouse-up, mouse-move,
  265. * or mouse-drag events are generated, by comparing the new state with the current state.
  266. *
  267. * The current implemementation of the event system supports a maximum of thirty-two buttons.
  268. * The buttonCount parameter should be followed by 'buttonCount' boolean_t values
  269. * indicating button state. The first value should reflect the state of the primary
  270. * button on the mouse. The second value, if any, should reflect the state of the secondary
  271. * mouse button (right), if any. A third value woule be the center button, and the remaining
  272. * buttons would be in USB device order.
  273. }
  274. type
  275. CGButtonCount = UInt32;
  276. function CGPostMouseEvent( mouseCursorPosition: CGPoint; updateMouseCursorPosition: boolean_t; buttonCount: CGButtonCount; mouseButtonDown: boolean_t; ... ): CGError; external name '_CGPostMouseEvent';
  277. {
  278. * Synthesize scroll wheel events.
  279. *
  280. * The current implemementation of the event system supports a maximum of three wheels.
  281. *
  282. * The wheelCount parameter should be followed by 'wheelCount' 32 bit integer values
  283. * indicating wheel movements. The first value should reflect the state of the primary
  284. * wheel on the mouse. The second value, if any, should reflect the state of a secondary
  285. * mouse wheel, if any.
  286. *
  287. * Wheel movement is represented by small signed integer values,
  288. * typically in a range from -10 to +10. Large values may have unexpected results,
  289. * depending on the application that processes the event.
  290. }
  291. type
  292. CGWheelCount = UInt32;
  293. function CGPostScrollWheelEvent( wheelCount: CGWheelCount; wheel1: SInt32; ... ): CGError; external name '_CGPostScrollWheelEvent';
  294. {
  295. * Synthesize keyboard events. Based on the values entered,
  296. * the appropriate key down, key up, and flags changed events are generated.
  297. * If keyChar is NUL (0), an appropriate value will be guessed at, based on the
  298. * default keymapping.
  299. *
  300. * All keystrokes needed to generate a character must be entered, including
  301. * SHIFT, CONTROL, OPTION, and COMMAND keys. For example, to produce a 'Z',
  302. * the SHIFT key must be down, the 'z' key must go down, and then the SHIFT
  303. * and 'z' key must be released:
  304. * CGPostKeyboardEvent( (CGCharCode)0, (CGKeyCode)56, true ); // shift down
  305. * CGPostKeyboardEvent( (CGCharCode)'Z', (CGKeyCode)6, true ); // 'z' down
  306. * CGPostKeyboardEvent( (CGCharCode)'Z', (CGKeyCode)6, false ); // 'z' up
  307. * CGPostKeyboardEvent( (CGCharCode)0, (CGKeyCode)56, false ); // 'shift up
  308. }
  309. type
  310. CGCharCode = UInt16; { Character represented by event, if any }
  311. type
  312. CGKeyCode = UInt16; { Virtual keycode for event }
  313. function CGPostKeyboardEvent( keyChar: CGCharCode; virtualKey: CGKeyCode; keyDown: boolean_t ): CGError; external name '_CGPostKeyboardEvent';
  314. {
  315. * Warp the mouse cursor to the desired position in global
  316. * coordinates without generating events
  317. }
  318. function CGWarpMouseCursorPosition( newCursorPosition: CGPoint ): CGError; external name '_CGWarpMouseCursorPosition';
  319. {
  320. * Remote operation may want to inhibit local events (events from
  321. * the machine's keyboard and mouse). This may be done either as a
  322. * explicit request (tracked per app) or as a short term side effect of
  323. * posting an event.
  324. *
  325. * CGInhibitLocalEvents() is typically used for long term remote operation
  326. * of a system, as in automated system testing or telecommuting applications.
  327. * Local device state changes are discarded.
  328. *
  329. * Local event inhibition is turned off if the app that requested it terminates.
  330. }
  331. function CGInhibitLocalEvents( doInhibit: boolean_t ): CGError; external name '_CGInhibitLocalEvents';
  332. {
  333. * Set the period of time in seconds that local hardware events (keyboard and mouse)
  334. * are suppressed after posting an event. Defaults to 0.25 second.
  335. }
  336. function CGSetLocalEventsSuppressionInterval( seconds: CFTimeInterval ): CGError; external name '_CGSetLocalEventsSuppressionInterval';
  337. {
  338. * By default, the flags that indicate modifier key state (Command, Alt, Shift, etc.)
  339. * from the system's keyboard and from other event sources are ORed together as an event is
  340. * posted into the system, and current key and mouse button state is considered in generating new events.
  341. * This function allows your application to enable or disable the
  342. * merging of event state. When combining is turned off, the event state propagated in the events
  343. * posted by your app reflect state built up only by your app. The state within your app's generated
  344. * event will not be combined with the system's current state, so the system-wide state reflecting key
  345. * and mouse button state will remain unchanged
  346. *
  347. * When called with doCombineState equal to FALSE, this function initializes local (per application)
  348. * state tracking information to a state of all keys, modifiers, and mouse buttons up.
  349. *
  350. * When called with doCombineState equal to TRUE, the current global state of keys, modifiers,
  351. * and mouse buttons are used in generating events.
  352. }
  353. function CGEnableEventStateCombining( doCombineState: boolean_t ): CGError; external name '_CGEnableEventStateCombining';
  354. {
  355. * By default the system suppresses local hardware events from the keyboard and mouse during
  356. * a short interval after a synthetic event is posted (see CGSetLocalEventsSuppressionInterval())
  357. * and while a synthetic mouse drag (mouse movement with the left/only mouse button down).
  358. *
  359. * Some classes of applications may want to enable events from some of the local hardware.
  360. * For example, an app may want to post only mouse events, and so may wish to permit local
  361. * keyboard hardware events to pass through. Set the filter state to permit keyboard events
  362. * prior to posting the mouse event after which you want to get keyboard events.
  363. *
  364. * This interface lets an app specify a state (event suppression interval, or mouse drag), and
  365. * a mask of event categories to be passed through. The new filter state takes effect
  366. * with the next event your app posts.
  367. }
  368. const
  369. kCGEventFilterMaskPermitLocalMouseEvents = $00000001; { Mouse, scroll wheel }
  370. kCGEventFilterMaskPermitLocalKeyboardEvents = $00000002; { Alphanumeric keys and Command, Option, Control, Shift, AlphaLock }
  371. kCGEventFilterMaskPermitSystemDefinedEvents = $00000004; { Power key, bezel buttons, sticky keys }
  372. type
  373. CGEventFilterMask = UInt32;
  374. const
  375. kCGEventSuppressionStateSuppressionInterval = 0;
  376. kCGEventSuppressionStateRemoteMouseDrag = 1;
  377. kCGNumberOfEventSuppressionStates = 2;
  378. type
  379. CGEventSuppressionState = UInt32;
  380. const
  381. kCGEventFilterMaskPermitAllEvents = $00000007;
  382. function CGSetLocalEventsFilterDuringSuppressionState( filter: CGEventFilterMask; state: CGEventSuppressionState ): CGError; external name '_CGSetLocalEventsFilterDuringSuppressionState';
  383. {
  384. * After posting a left mouse down, with remote mouse drag suppressing hardware mouse
  385. * move events, after some time with no remote mouse drag events, a warning is logged
  386. * to aid in diagnosing 'my hardware mouse is dead' problems.
  387. * No mechanism is provided to defeat this timeout.
  388. *
  389. * Mouse-down conditions of arbitrary length may be produced deliberately, as when scrolling
  390. * through a lengthly document.
  391. }
  392. const
  393. kCGMouseDownEventMaskingDeadSwitchTimeout = 60.0;
  394. {
  395. * Helper function to connect or disconnect the mouse and mouse cursor while the calling app
  396. * is in the foreground.
  397. *
  398. * While disconnected, mouse move and drag events will reflect the current position of
  399. * the mouse cursor position, which will not change with mouse movement. Use the
  400. * <CoreGraphics/CGDirectDisplay.h> function:
  401. *
  402. * void CGGetLastMouseDelta( CGMouseDelta * deltaX, CGMouseDelta * deltaY );
  403. *
  404. * This will report mouse movement associated with the last mouse move or drag event.
  405. *
  406. * To update the display cursor position, use the function defined in this module:
  407. *
  408. * CGError CGWarpMouseCursorPosition( CGPoint newCursorPosition );
  409. *
  410. * Note: The Force Quit key combination (CMD-OPT-ESC by default) will reconnect the mouse and cursor.
  411. }
  412. function CGAssociateMouseAndMouseCursorPosition( connected: boolean_t ): CGError; external name '_CGAssociateMouseAndMouseCursorPosition';
  413. {
  414. * Some classes of applications need to detect when the window server process dies, or
  415. * is not running. The easiest way to do this is to use a CFMachPortRef.
  416. *
  417. * If the CoreGraphics window server is not running, this function returns NULL.
  418. * If the server is running, a CFMachPortRef is returned.
  419. *
  420. * A program can register a callback function to use a CFMachPortRef to determine
  421. * when the CoreGraphics window server exits:
  422. *
  423. * static void handleWindowServerDeath( CFMachPortRef port, void *info )
  424. * (
  425. * printf( "Window Server port death detected!\n" );
  426. * CFRelease( port );
  427. * exit( 1 );
  428. * )
  429. *
  430. * static void watchForServerDeath()
  431. * (
  432. * CFMachPortRef port;
  433. *
  434. * port = CGWindowServerCFMachPort();
  435. * CFMachPortSetInvalidationCallBack( port, handleWindowServerDeath );
  436. * )
  437. *
  438. * Note that when the window server exits, there may be a few seconds during which
  439. * no window server is running, until the operating system starts a new
  440. * window server/loginwindow pair of processes. This function will return NULL
  441. * until a new window server is running.
  442. *
  443. * Multiple calls to this function may return multiple CFMachPortRefs, each referring
  444. * to the same Mach port. Multiple callbacks registered on multiple CFMachPortRefs
  445. * obtained in this way may fire in a nondetermanistic manner.
  446. *
  447. * Your program will need to run a CFRunLoop for the port death
  448. * callback to function. A program which does not use a CFRunLoop may use
  449. * CFMachPortIsValid(CFMachPortRef port) periodically to check if the port is valid.
  450. }
  451. function CGWindowServerCFMachPort: CFMachPortRef; external name '_CGWindowServerCFMachPort';
  452. {
  453. * OBSOLETE!
  454. *
  455. * Present for backwards compatibility with old header typos.
  456. }
  457. {
  458. #define kCGEventSupressionStateSupressionInterval kCGEventSuppressionStateSuppressionInterval
  459. #define kCGEventSupressionStateRemoteMouseDrag kCGEventSuppressionStateRemoteMouseDrag
  460. #define kCGNumberOfEventSupressionStates kCGNumberOfEventSuppressionStates
  461. #define CGEventSupressionState CGEventSuppressionState
  462. #define CGSetLocalEventsFilterDuringSupressionState(filter, state) \
  463. CGSetLocalEventsFilterDuringSuppressionState(filter, state)
  464. }
  465. end.