CGRemoteOperation.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. { CoreGraphics - CGRemoteOperation.h
  2. Copyright (c) 2000-2011 Apple Inc.
  3. All rights reserved. }
  4. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, August 2005 }
  5. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  6. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  7. {
  8. Modified for use with Free Pascal
  9. Version 308
  10. Please report any bugs to <[email protected]>
  11. }
  12. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  13. {$mode macpas}
  14. {$packenum 1}
  15. {$macro on}
  16. {$inline on}
  17. {$calling mwpascal}
  18. unit CGRemoteOperation;
  19. interface
  20. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  21. {$setc GAP_INTERFACES_VERSION := $0308}
  22. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  23. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  24. {$endc}
  25. {$ifc defined CPUPOWERPC and defined CPUI386}
  26. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  27. {$endc}
  28. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  29. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  30. {$endc}
  31. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  32. {$setc __ppc__ := 1}
  33. {$elsec}
  34. {$setc __ppc__ := 0}
  35. {$endc}
  36. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  37. {$setc __ppc64__ := 1}
  38. {$elsec}
  39. {$setc __ppc64__ := 0}
  40. {$endc}
  41. {$ifc not defined __i386__ and defined CPUI386}
  42. {$setc __i386__ := 1}
  43. {$elsec}
  44. {$setc __i386__ := 0}
  45. {$endc}
  46. {$ifc not defined __x86_64__ and defined CPUX86_64}
  47. {$setc __x86_64__ := 1}
  48. {$elsec}
  49. {$setc __x86_64__ := 0}
  50. {$endc}
  51. {$ifc not defined __arm__ and defined CPUARM}
  52. {$setc __arm__ := 1}
  53. {$elsec}
  54. {$setc __arm__ := 0}
  55. {$endc}
  56. {$ifc defined cpu64}
  57. {$setc __LP64__ := 1}
  58. {$elsec}
  59. {$setc __LP64__ := 0}
  60. {$endc}
  61. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  62. {$error Conflicting definitions for __ppc__ and __i386__}
  63. {$endc}
  64. {$ifc defined __ppc__ and __ppc__}
  65. {$setc TARGET_CPU_PPC := TRUE}
  66. {$setc TARGET_CPU_PPC64 := FALSE}
  67. {$setc TARGET_CPU_X86 := FALSE}
  68. {$setc TARGET_CPU_X86_64 := FALSE}
  69. {$setc TARGET_CPU_ARM := FALSE}
  70. {$setc TARGET_OS_MAC := TRUE}
  71. {$setc TARGET_OS_IPHONE := FALSE}
  72. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  73. {$setc TARGET_OS_EMBEDDED := FALSE}
  74. {$elifc defined __ppc64__ and __ppc64__}
  75. {$setc TARGET_CPU_PPC := FALSE}
  76. {$setc TARGET_CPU_PPC64 := TRUE}
  77. {$setc TARGET_CPU_X86 := FALSE}
  78. {$setc TARGET_CPU_X86_64 := FALSE}
  79. {$setc TARGET_CPU_ARM := FALSE}
  80. {$setc TARGET_OS_MAC := TRUE}
  81. {$setc TARGET_OS_IPHONE := FALSE}
  82. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  83. {$setc TARGET_OS_EMBEDDED := FALSE}
  84. {$elifc defined __i386__ and __i386__}
  85. {$setc TARGET_CPU_PPC := FALSE}
  86. {$setc TARGET_CPU_PPC64 := FALSE}
  87. {$setc TARGET_CPU_X86 := TRUE}
  88. {$setc TARGET_CPU_X86_64 := FALSE}
  89. {$setc TARGET_CPU_ARM := FALSE}
  90. {$ifc defined(iphonesim)}
  91. {$setc TARGET_OS_MAC := FALSE}
  92. {$setc TARGET_OS_IPHONE := TRUE}
  93. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  94. {$elsec}
  95. {$setc TARGET_OS_MAC := TRUE}
  96. {$setc TARGET_OS_IPHONE := FALSE}
  97. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  98. {$endc}
  99. {$setc TARGET_OS_EMBEDDED := FALSE}
  100. {$elifc defined __x86_64__ and __x86_64__}
  101. {$setc TARGET_CPU_PPC := FALSE}
  102. {$setc TARGET_CPU_PPC64 := FALSE}
  103. {$setc TARGET_CPU_X86 := FALSE}
  104. {$setc TARGET_CPU_X86_64 := TRUE}
  105. {$setc TARGET_CPU_ARM := FALSE}
  106. {$setc TARGET_OS_MAC := TRUE}
  107. {$setc TARGET_OS_IPHONE := FALSE}
  108. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  109. {$setc TARGET_OS_EMBEDDED := FALSE}
  110. {$elifc defined __arm__ and __arm__}
  111. {$setc TARGET_CPU_PPC := FALSE}
  112. {$setc TARGET_CPU_PPC64 := FALSE}
  113. {$setc TARGET_CPU_X86 := FALSE}
  114. {$setc TARGET_CPU_X86_64 := FALSE}
  115. {$setc TARGET_CPU_ARM := TRUE}
  116. { will require compiler define when/if other Apple devices with ARM cpus ship }
  117. {$setc TARGET_OS_MAC := FALSE}
  118. {$setc TARGET_OS_IPHONE := TRUE}
  119. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  120. {$setc TARGET_OS_EMBEDDED := TRUE}
  121. {$elsec}
  122. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.}
  123. {$endc}
  124. {$ifc defined __LP64__ and __LP64__ }
  125. {$setc TARGET_CPU_64 := TRUE}
  126. {$elsec}
  127. {$setc TARGET_CPU_64 := FALSE}
  128. {$endc}
  129. {$ifc defined FPC_BIG_ENDIAN}
  130. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  131. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  132. {$elifc defined FPC_LITTLE_ENDIAN}
  133. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  134. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  135. {$elsec}
  136. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  137. {$endc}
  138. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  139. {$setc CALL_NOT_IN_CARBON := FALSE}
  140. {$setc OLDROUTINENAMES := FALSE}
  141. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  142. {$setc OPAQUE_UPP_TYPES := TRUE}
  143. {$setc OTCARBONAPPLICATION := TRUE}
  144. {$setc OTKERNEL := FALSE}
  145. {$setc PM_USE_SESSION_APIS := TRUE}
  146. {$setc TARGET_API_MAC_CARBON := TRUE}
  147. {$setc TARGET_API_MAC_OS8 := FALSE}
  148. {$setc TARGET_API_MAC_OSX := TRUE}
  149. {$setc TARGET_CARBON := TRUE}
  150. {$setc TARGET_CPU_68K := FALSE}
  151. {$setc TARGET_CPU_MIPS := FALSE}
  152. {$setc TARGET_CPU_SPARC := FALSE}
  153. {$setc TARGET_OS_UNIX := FALSE}
  154. {$setc TARGET_OS_WIN32 := FALSE}
  155. {$setc TARGET_RT_MAC_68881 := FALSE}
  156. {$setc TARGET_RT_MAC_CFM := FALSE}
  157. {$setc TARGET_RT_MAC_MACHO := TRUE}
  158. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  159. {$setc TYPE_BOOL := FALSE}
  160. {$setc TYPE_EXTENDED := FALSE}
  161. {$setc TYPE_LONGLONG := TRUE}
  162. uses MacTypes,CFMachPort,CGBase,CGGeometry,CGErrors,CFDate;
  163. {$endc} {not MACOSALLINCLUDE}
  164. {$ALIGN POWER}
  165. type
  166. CGEventErr = CGError;
  167. const
  168. CGEventNoErr = kCGErrorSuccess;
  169. { A type representing the number of buttons being set in a synthetic mouse
  170. event. }
  171. type
  172. CGButtonCount = UInt32;
  173. { A type representing the number of scrolling devices being set in a
  174. synthetic scrolling event. }
  175. type
  176. CGWheelCount = UInt32;
  177. { A type representing a character generated by pressing one or more keys on
  178. a keyboard. }
  179. type
  180. CGCharCode = UInt16;
  181. { A type representing the virtual key codes used in keyboard events. }
  182. type
  183. CGKeyCode = UInt16;
  184. { A client-supplied callback function that’s invoked when an area of the
  185. display is modified or refreshed.
  186. When an area of the display is modified or refreshed, your callback
  187. function will be invoked with a count of the number of rectangles in the
  188. refreshed areas, and a list of the refreshed rectangles. The rectangles
  189. are in global coordinates.
  190. To register a screen refresh callback function, call the function
  191. `CGRegisterScreenRefreshCallback'. Quartz invokes your callback function
  192. when operations such as drawing, window movement, scrolling, or display
  193. reconfiguration occur on local displays. When you are finished using a
  194. callback registration, call `CGUnregisterScreenRefreshCallback' to remove
  195. it.
  196. Note that a single rectangle may occupy multiple displays, either by
  197. overlapping the displays or by residing on coincident displays when
  198. mirroring is active. You can use the function `CGGetDisplaysWithRect' to
  199. determine the displays a rectangle occupies. }
  200. type
  201. CGScreenRefreshCallback = procedure( count: UInt32; {const} rectArray: {variable-size-array} CGRectPtr; userParameter: UnivPtr);
  202. {$ifc TARGET_OS_MAC}
  203. { Register a callback function to be invoked when local displays are
  204. refreshed or modified.
  205. The callback function you register is invoked only if your application
  206. has an active event loop. The callback is invoked in the same thread of
  207. execution that is processing events within your application. }
  208. function CGRegisterScreenRefreshCallback( callback: CGScreenRefreshCallback; userInfo: UnivPtr ): CGError; external name '_CGRegisterScreenRefreshCallback';
  209. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_8,
  210. __IPHONE_NA, __IPHONE_NA) *)
  211. { Remove a previously registered callback function invoked when local
  212. displays are refreshed or modified.
  213. Both the callback function and the `userInfo' argument must match the
  214. registered entry to be removed. }
  215. procedure CGUnregisterScreenRefreshCallback( callback: CGScreenRefreshCallback; userInfo: UnivPtr ); external name '_CGUnregisterScreenRefreshCallback';
  216. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_8,
  217. __IPHONE_NA, __IPHONE_NA) *)
  218. { Wait for screen refresh operations.
  219. In some applications it may be preferable to wait for screen refresh data
  220. synchronously, using this function. You should call this function in a
  221. thread other than the main event-processing thread.
  222. As an alternative, Quartz also supports asynchronous notification --- see
  223. `CGRegisterScreenRefreshCallback'. If refresh callback functions are
  224. registered, this function should not be used.
  225. You must deallocate the returned rectangle array with the function
  226. `CGReleaseScreenRefreshRects'. }
  227. function CGWaitForScreenRefreshRects( var pRectArray: {variable-size-array} CGRectPtr; var count: UInt32 ): CGError; external name '_CGWaitForScreenRefreshRects';
  228. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  229. {$endc}
  230. { A type for `CGWaitForScreenUpdateRects' specifying the desired types of
  231. screen update operations. }
  232. const
  233. kCGScreenUpdateOperationRefresh = 0;
  234. kCGScreenUpdateOperationMove = 1 shl 0;
  235. kCGScreenUpdateOperationReducedDirtyRectangleCount = 1 shl 31;
  236. type
  237. CGScreenUpdateOperation = UInt32;
  238. { A type representing the distance a region on the screen moves in pixel
  239. units.
  240. The fields `dX' and `dY' describe the direction of movement. Positive
  241. values of `dX' indicate movement to the right; negative values indicate
  242. movement to the left. Positive values of `dY' indicate movement downward;
  243. negative values indicate movement upward. }
  244. type
  245. CGScreenUpdateMoveDelta = record
  246. dX, dY: SInt32;
  247. end;
  248. { A type specifying a client-supplied callback function that’s invoked when
  249. an area of the display is moved.
  250. When an area of the display is moved, your callback function will be
  251. invoked with a count of the number of rectangles in the moved area, and a
  252. list of the moved rectangles. The rectangles are in global coordinates,
  253. and describe the area prior to the move operation.
  254. Your function should not modify, deallocate or free memory pointed to by
  255. `rectArray'.
  256. A single rectangle may occupy multiple displays, either by overlapping
  257. the displays or by residing on coincident displays when mirroring is
  258. active. Use `CGGetDisplaysWithRect' to determine the displays a rectangle
  259. occupies. }
  260. type
  261. CGScreenUpdateMoveCallback = procedure( delta: CGScreenUpdateMoveDelta; count: size_t; {const} rectArray: {variable-size-array} CGRectPtr; userParameter: UnivPtr );
  262. {$ifc TARGET_OS_MAC}
  263. { Register a callback function to be invoked when an area of the display is
  264. moved. The callback is invoked on the same thread of execution that is
  265. processing events within your application. }
  266. function CGScreenRegisterMoveCallback( callback: CGScreenUpdateMoveCallback; userInfo: UnivPtr ): CGError; external name '_CGScreenRegisterMoveCallback';
  267. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_3,__MAC_10_8,
  268. __IPHONE_NA, __IPHONE_NA) *)
  269. { Remove a previously registered screen update callback function. }
  270. procedure CGScreenUnregisterMoveCallback( callback: CGScreenUpdateMoveCallback; userInfo: UnivPtr ); external name '_CGScreenUnregisterMoveCallback';
  271. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_3,__MAC_10_8,
  272. __IPHONE_NA, __IPHONE_NA) *)
  273. { Wait for screen update operations.
  274. The parameter `requestedOperations' specifies the desired types of screen
  275. update operations. There are several possible choices:
  276. -- Specify `kCGScreenUpdateOperationRefresh' if you want all move
  277. operations to be returned as refresh operations.
  278. -- Specify `(kCGScreenUpdateOperationRefresh|kCGScreenUpdateOperationMove)'
  279. if you want to distinguish between move and refresh operations.
  280. -- Add `kCGScreenUpdateOperationReducedDirtyRectangleCount' to the screen
  281. operations if you want to minimize the number of rectangles returned
  282. to represent changed areas of the display.
  283. You should deallocate the returned screen update rects by calling
  284. `CGReleaseScreenRefreshRects'.
  285. In some applications it may be preferable to wait for screen update data
  286. synchronously. You should call this function in a thread other than the
  287. main event-processing thread.
  288. As an alternative, Quartz also supports asynchronous notification --- see
  289. `CGRegisterScreenRefreshCallback' and `CGScreenRegisterMoveCallback'. If
  290. refresh or move callback functions are registered, this function should
  291. not be used. }
  292. function CGWaitForScreenUpdateRects( requestedOperations: CGScreenUpdateOperation; var currentOperation: CGScreenUpdateOperation; var pRectArray: {variable-size-array} CGRectPtr; var pCount: size_t; var pDelta: CGScreenUpdateMoveDelta ): CGError; external name '_CGWaitForScreenUpdateRects';
  293. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_3,__MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  294. { Deallocate the list of rectangles received from
  295. `CGWaitForScreenRefreshRects' or `CGWaitForScreenUpdateRects'. }
  296. procedure CGReleaseScreenRefreshRects( pRectArray: {variable-size-array} CGRectPtr); external name '_CGReleaseScreenRefreshRects';
  297. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  298. { Return true if the mouse cursor is visible, false otherwise. }
  299. function CGCursorIsVisible: boolean_t; external name '_CGCursorIsVisible';
  300. (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA) *)
  301. { Return true if the mouse cursor is drawn in frame buffer memory, false
  302. otherwise. (The cursor could exist in an overlay plane or a similar
  303. mechanism that puts pixels on-screen without altering frame buffer
  304. content.) If the cursor is drawn in the frame buffer, it is read back
  305. along with window data.
  306. The return value is based on the union of the state of the cursor on all
  307. displays. If the cursor is drawn in the frame buffer on any display, this
  308. function returns true. }
  309. function CGCursorIsDrawnInFramebuffer: boolean_t; external name '_CGCursorIsDrawnInFramebuffer';
  310. (* CG_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA) *)
  311. { Move the mouse cursor to the desired position in global display
  312. coordinates without generating events. }
  313. function CGWarpMouseCursorPosition( newCursorPosition: CGPoint ): CGError; external name '_CGWarpMouseCursorPosition';
  314. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  315. { After posting a left mouse down with remote mouse drag suppressing
  316. hardware mouse move events, after some time with no remote mouse drag
  317. events a warning is logged to aid in diagnosing "my hardware mouse is
  318. dead" problems.
  319. Mouse-down conditions of arbitrary length may be produced deliberately,
  320. as when scrolling through a lengthly document. }
  321. {$endc}
  322. const
  323. kCGMouseDownEventMaskingDeadSwitchTimeout = 60.0;
  324. {$ifc TARGET_OS_MAC}
  325. { Connect or disconnect the mouse and cursor while an application is in the
  326. foreground.
  327. When you call this function to disconnect the cursor and mouse, all
  328. events received by your application have a constant absolute location but
  329. contain mouse delta (change in X and Y) data. You may hide the cursor or
  330. change it into something appropriate for your application. You can
  331. reposition the cursor by using the function `CGDisplayMoveCursorToPoint'
  332. or `CGWarpMouseCursorPosition'. }
  333. function CGAssociateMouseAndMouseCursorPosition( connected: boolean_t ): CGError; external name '_CGAssociateMouseAndMouseCursorPosition';
  334. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  335. { Return a CFMachPort that corresponds to the Mac OS X Window Server's
  336. server port.
  337. Use this function to detect if the window server process exits or is not
  338. running. If this function returns NULL, the window server is not running.
  339. This code example shows how to register a callback function to detect
  340. when the window server exits:
  341. static void handleWindowServerDeath(CFMachPortRef port, void *info) (
  342. printf("Window Server port death detected!\n");
  343. CFRelease(port);
  344. exit(1);
  345. )
  346. static void watchForServerDeath() (
  347. CFMachPortRef port = CGWindowServerCreateServerPort();
  348. CFMachPortSetInvalidationCallBack(port, handleWindowServerDeath);
  349. )
  350. Note that when the window server exits, there may be a few seconds during
  351. which no window server is running. This function will return NULL until a
  352. new window server is running.
  353. Your program must run a CFRunLoop for the port death callback to occur. A
  354. program which does not use a CFRunLoop may periodically call
  355. `CFMachPortIsValid' to check whether the port is valid. }
  356. function CGWindowServerCreateServerPort: CFMachPortRef; external name '_CGWindowServerCreateServerPort';
  357. (* CG_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA) *)
  358. {
  359. * By default, the flags that indicate modifier key state (Command, Alt, Shift, etc.)
  360. * from the system's keyboard and from other event sources are ORed together as an event is
  361. * posted into the system, and current key and mouse button state is considered in generating new events.
  362. * This function allows your application to enable or disable the
  363. * merging of event state. When combining is turned off, the event state propagated in the events
  364. * posted by your app reflect state built up only by your app. The state within your app's generated
  365. * event will not be combined with the system's current state, so the system-wide state reflecting key
  366. * and mouse button state will remain unchanged
  367. *
  368. * When called with doCombineState equal to FALSE, this function initializes local (per application)
  369. * state tracking information to a state of all keys, modifiers, and mouse buttons up.
  370. *
  371. * When called with doCombineState equal to TRUE, the current global state of keys, modifiers,
  372. * and mouse buttons are used in generating events.
  373. }
  374. { This function is obsolete. Use Quartz events and Quartz event sources
  375. instead. }
  376. function CGEnableEventStateCombining( combineState: boolean_t ): CGError; external name '_CGEnableEventStateCombining';
  377. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_6,
  378. __IPHONE_NA, __IPHONE_NA) *)
  379. {
  380. * Remote operation may want to inhibit local events (events from
  381. * the machine's keyboard and mouse). This may be done either as a
  382. * explicit request (tracked per app) or as a short term side effect of
  383. * posting an event.
  384. *
  385. * CGInhibitLocalEvents() is typically used for long term remote operation
  386. * of a system, as in automated system testing or telecommuting applications.
  387. * Local device state changes are discarded.
  388. *
  389. * Local event inhibition is turned off if the app that requested it terminates.
  390. }
  391. { This function obsolete. Use
  392. `CGEventSourceSetLocalEventsFilterDuringSuppressionState' instead. }
  393. function CGInhibitLocalEvents( inhibit: boolean_t ): CGError; external name '_CGInhibitLocalEvents';
  394. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6,
  395. __IPHONE_NA, __IPHONE_NA) *)
  396. { This function is obsolete. Use `CGEventCreateMouseEvent' instead.
  397. Synthesize a low-level mouse-button event on the local machine.
  398. The parameter `mouseCursorPosition' specifies the new coordinates of the
  399. mouse in global display space.
  400. Pass true for `updateMouseCursorPosition' if the on-screen cursor should
  401. be moved to the location specified in the `mouseCursorPosition'
  402. parameter; otherwise, pass false.
  403. The parameter `buttonCount' specifies the number of mouse buttons, up to
  404. a maximum of 32.
  405. Pass true for `mouseButtonDown' to specify that the primary or left mouse
  406. button is down; otherwise, pass false. The remaining parameters are
  407. Boolean values that specify whether the remaining mouse buttons are down
  408. (true) or up (false). The second value, if any, should specify the state
  409. of the secondary mouse button (right). A third value should specify the
  410. state of the center button, and the remaining buttons should be in USB
  411. device order.
  412. Based on the values entered, the appropriate mouse-down, mouse-up,
  413. mouse-move, or mouse-drag events are generated, by comparing the new
  414. state with the current state. }
  415. function CGPostMouseEvent( mouseCursorPosition: CGPoint; updateMouseCursorPosition: boolean_t; buttonCount: CGButtonCount; mouseButtonDown: boolean_t; ... ): CGError; external name '_CGPostMouseEvent';
  416. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6,
  417. __IPHONE_NA, __IPHONE_NA) *)
  418. { This function is obsolete. Use `CGEventCreateScrollWheelEvent' instead.
  419. Synthesize scroll wheel events.
  420. The parameter `wheelCount' specifies the number of scrolling devices, up
  421. to a maximum of 3.
  422. The parameter `wheel1' specifies a value that reflects the movement of
  423. the primary scrolling device on the mouse. The second and third values,
  424. if any, reflect the movements of the other scrolling devices on the
  425. mouse.
  426. Scrolling movement is represented by small signed integer values,
  427. typically in a range from -10 to +10. Large values may have unexpected
  428. results, depending on the application that processes the event. }
  429. function CGPostScrollWheelEvent( wheelCount: CGWheelCount; wheel1: SInt32; ... ): CGError; external name '_CGPostScrollWheelEvent';
  430. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
  431. {
  432. * Synthesize keyboard events. Based on the values entered,
  433. * the appropriate key down, key up, and flags changed events are generated.
  434. * If keyChar is NUL (0), an appropriate value will be guessed at, based on the
  435. * default keymapping.
  436. *
  437. * All keystrokes needed to generate a character must be entered, including
  438. * SHIFT, CONTROL, OPTION, and COMMAND keys. For example, to produce a 'Z',
  439. * the SHIFT key must be down, the 'z' key must go down, and then the SHIFT
  440. * and 'z' key must be released:
  441. * CGPostKeyboardEvent( (CGCharCode)0, (CGKeyCode)56, true ); // shift down
  442. * CGPostKeyboardEvent( (CGCharCode)'Z', (CGKeyCode)6, true ); // 'z' down
  443. * CGPostKeyboardEvent( (CGCharCode)'Z', (CGKeyCode)6, false ); // 'z' up
  444. * CGPostKeyboardEvent( (CGCharCode)0, (CGKeyCode)56, false ); // 'shift up
  445. }
  446. { This function is obsolete. Use `CGEventCreateKeyboardEvent' instead. }
  447. function CGPostKeyboardEvent( keyChar: CGCharCode; virtualKey: CGKeyCode; keyDown: boolean_t ): CGError; external name '_CGPostKeyboardEvent';
  448. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6,
  449. __IPHONE_NA, __IPHONE_NA) *)
  450. {$endc}
  451. {
  452. * By default the system suppresses local hardware events from the keyboard and mouse during
  453. * a short interval after a synthetic event is posted (see CGSetLocalEventsSuppressionInterval())
  454. * and while a synthetic mouse drag (mouse movement with the left/only mouse button down).
  455. *
  456. * Some classes of applications may want to enable events from some of the local hardware.
  457. * For example, an app may want to post only mouse events, and so may wish to permit local
  458. * keyboard hardware events to pass through. Set the filter state to permit keyboard events
  459. * prior to posting the mouse event after which you want to get keyboard events.
  460. *
  461. * This interface lets an app specify a state (event suppression interval, or mouse drag), and
  462. * a mask of event categories to be passed through. The new filter state takes effect
  463. * with the next event your app posts.
  464. }
  465. { A type specifying masks for classes of low-level events that can be
  466. filtered during event suppression states. }
  467. const
  468. kCGEventFilterMaskPermitLocalMouseEvents = $00000001; { Mouse, scroll wheel }
  469. kCGEventFilterMaskPermitLocalKeyboardEvents = $00000002; { Alphanumeric keys and Command, Option, Control, Shift, AlphaLock }
  470. kCGEventFilterMaskPermitSystemDefinedEvents = $00000004; { Power key, bezel buttons, sticky keys }
  471. type
  472. CGEventFilterMask = UInt32;
  473. const
  474. kCGEventFilterMaskPermitAllEvents = $00000007;
  475. { A type specifying the event suppression states that can occur after
  476. posting an event. }
  477. const
  478. kCGEventSuppressionStateSuppressionInterval = 0;
  479. kCGEventSuppressionStateRemoteMouseDrag = 1;
  480. kCGNumberOfEventSuppressionStates = 2;
  481. type
  482. CGEventSuppressionState = UInt32;
  483. {$ifc TARGET_OS_MAC}
  484. { This function is obsolete. Use
  485. `CGEventSourceSetLocalEventsFilterDuringSuppressionState' instead. }
  486. function CGSetLocalEventsFilterDuringSuppressionState( filter: CGEventFilterMask; state: CGEventSuppressionState ): CGError; external name '_CGSetLocalEventsFilterDuringSuppressionState';
  487. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
  488. {
  489. * Set the period of time in seconds that local hardware events (keyboard and mouse)
  490. * are suppressed after posting an event. Defaults to 0.25 second.
  491. }
  492. { This function is obsolete. Use
  493. `CGEventSourceSetLocalEventsSuppressionInterval' instead. }
  494. function CGSetLocalEventsSuppressionInterval( seconds: CFTimeInterval ): CGError; external name '_CGSetLocalEventsSuppressionInterval';
  495. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6,
  496. __IPHONE_NA, __IPHONE_NA) *)
  497. { This function is obsolete. Use `CGWindowServerCreateServerPort'
  498. instead. }
  499. function CGWindowServerCFMachPort: CFMachPortRef; external name '_CGWindowServerCFMachPort';
  500. (* CG_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  501. {$endc}
  502. { Obsolete. Present for backwards compatibility with old header typos. }
  503. {
  504. #define kCGEventSupressionStateSupressionInterval \
  505. kCGEventSuppressionStateSuppressionInterval
  506. #define kCGEventSupressionStateRemoteMouseDrag \
  507. kCGEventSuppressionStateRemoteMouseDrag
  508. #define kCGNumberOfEventSupressionStates \
  509. kCGNumberOfEventSuppressionStates
  510. #define CGEventSupressionState \
  511. CGEventSuppressionState
  512. #define CGSetLocalEventsFilterDuringSupressionState(filter, state) \
  513. CGSetLocalEventsFilterDuringSuppressionState(filter, state)
  514. }
  515. { A type representing the count of items in an array of Quartz rectangles. }
  516. type
  517. CGRectCount = UInt32;
  518. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  519. end.
  520. {$endc} {not MACOSALLINCLUDE}