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