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.

913 lines
24 KiB

  1. /*
  2. File: CGDirectDisplay.h
  3. Contains: CoreGraphics direct display
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 2000-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 CGDIRECTDISPLAY_H_
  11. #define CGDIRECTDISPLAY_H_
  12. #ifndef __CGBASE__
  13. #include <CGBase.h>
  14. #endif
  15. #ifndef __CGGEOMETRY__
  16. #include <CGGeometry.h>
  17. #endif
  18. #ifndef __CGERROR__
  19. #include <CGError.h>
  20. #endif
  21. #ifndef __CFARRAY__
  22. #include <CFArray.h>
  23. #endif
  24. #ifndef __CFSTRING__
  25. #include <CFString.h>
  26. #endif
  27. #ifndef __CFDICTIONARY__
  28. #include <CFDictionary.h>
  29. #endif
  30. #include <stdint.h>
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40. typedef struct _CGDirectDisplayID* CGDirectDisplayID;
  41. typedef struct _CGDirectPaletteRef* CGDirectPaletteRef;
  42. typedef uint32_t CGDisplayCount;
  43. typedef uint32_t CGTableCount;
  44. typedef int32_t CGDisplayCoord;
  45. typedef uint8_t CGByteValue;
  46. typedef uint32_t CGOpenGLDisplayMask;
  47. typedef uint32_t CGBeamPosition;
  48. typedef int32_t CGMouseDelta;
  49. typedef double CGRefreshRate;
  50. typedef CGError CGDisplayErr;
  51. enum {
  52. CGDisplayNoErr = kCGErrorSuccess
  53. };
  54. /* A NULL value points to the main display device as a programming convention */
  55. #define kCGDirectMainDisplay ((CGDirectDisplayID)NULL)
  56. /*
  57. * Mechanisms used to find screen IDs
  58. * An array length (maxDisplays) and array of CGDirectDisplayIDs are passed in.
  59. * Up to maxDisplays of the array are filled in with the displays meeting the
  60. * specified criteria. The actual number of displays filled in is returned in
  61. * dspyCnt.
  62. *
  63. * If the dspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled
  64. * in with the number of displays meeting the function's requirements.
  65. */
  66. /*
  67. * CGGetDisplaysWithPoint()
  68. *
  69. * Availability:
  70. * Non-Carbon CFM: not available
  71. * CarbonLib: not available
  72. * Mac OS X: in version 10.0 and later
  73. */
  74. EXTERN_API_C( CGDisplayErr )
  75. CGGetDisplaysWithPoint(
  76. CGPoint point,
  77. CGDisplayCount maxDisplays,
  78. CGDirectDisplayID * dspys,
  79. CGDisplayCount * dspyCnt);
  80. /*
  81. * CGGetDisplaysWithRect()
  82. *
  83. * Availability:
  84. * Non-Carbon CFM: not available
  85. * CarbonLib: not available
  86. * Mac OS X: in version 10.0 and later
  87. */
  88. EXTERN_API_C( CGDisplayErr )
  89. CGGetDisplaysWithRect(
  90. CGRect rect,
  91. CGDisplayCount maxDisplays,
  92. CGDirectDisplayID * dspys,
  93. CGDisplayCount * dspyCnt);
  94. /*
  95. * CGGetDisplaysWithOpenGLDisplayMask()
  96. *
  97. * Availability:
  98. * Non-Carbon CFM: not available
  99. * CarbonLib: not available
  100. * Mac OS X: in version 10.0 and later
  101. */
  102. EXTERN_API_C( CGDisplayErr )
  103. CGGetDisplaysWithOpenGLDisplayMask(
  104. CGOpenGLDisplayMask mask,
  105. CGDisplayCount maxDisplays,
  106. CGDirectDisplayID * dspys,
  107. CGDisplayCount * dspyCnt);
  108. /*
  109. * Get lists of displays. Use this to determine display IDs
  110. *
  111. * If the activeDspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled
  112. * in with the number of displays meeting the function's requirements.
  113. *
  114. * The first display returned in the list is the main display,
  115. * the one with the menu bar.
  116. * When mirroring, this will be the largest display,
  117. * or if all are the same size, the one with the deepest pixel depth.
  118. */
  119. /*
  120. * CGGetActiveDisplayList()
  121. *
  122. * Availability:
  123. * Non-Carbon CFM: not available
  124. * CarbonLib: not available
  125. * Mac OS X: in version 10.0 and later
  126. */
  127. EXTERN_API_C( CGDisplayErr )
  128. CGGetActiveDisplayList(
  129. CGDisplayCount maxDisplays,
  130. CGDirectDisplayID * activeDspys,
  131. CGDisplayCount * dspyCnt);
  132. /* Map a display to an OpenGL display mask; returns 0 on invalid display */
  133. /*
  134. * CGDisplayIDToOpenGLDisplayMask()
  135. *
  136. * Availability:
  137. * Non-Carbon CFM: not available
  138. * CarbonLib: not available
  139. * Mac OS X: in version 10.0 and later
  140. */
  141. EXTERN_API_C( CGOpenGLDisplayMask )
  142. CGDisplayIDToOpenGLDisplayMask(CGDirectDisplayID display);
  143. /* Return screen size and origin in global coords; Empty rect if display is invalid */
  144. /*
  145. * CGDisplayBounds()
  146. *
  147. * Availability:
  148. * Non-Carbon CFM: not available
  149. * CarbonLib: not available
  150. * Mac OS X: in version 10.0 and later
  151. */
  152. EXTERN_API_C( CGRect )
  153. CGDisplayBounds(CGDirectDisplayID display);
  154. /*
  155. * CGDisplayPixelsWide()
  156. *
  157. * Availability:
  158. * Non-Carbon CFM: not available
  159. * CarbonLib: not available
  160. * Mac OS X: in version 10.0 and later
  161. */
  162. EXTERN_API_C( size_t )
  163. CGDisplayPixelsWide(CGDirectDisplayID display);
  164. /*
  165. * CGDisplayPixelsHigh()
  166. *
  167. * Availability:
  168. * Non-Carbon CFM: not available
  169. * CarbonLib: not available
  170. * Mac OS X: in version 10.0 and later
  171. */
  172. EXTERN_API_C( size_t )
  173. CGDisplayPixelsHigh(CGDirectDisplayID display);
  174. /*
  175. * Display mode selection
  176. * Display modes are represented as CFDictionaries
  177. * All dictionaries and arrays returned via these mechanisms are
  178. * owned by the framework and should not be released. The framework
  179. * will not release them out from under your application.
  180. *
  181. * Values associated with the following keys are CFNumber types.
  182. * With CFNumberGetValue(), use kCFNumberLongType for best results.
  183. */
  184. /*
  185. * Keys used in mode dictionaries. Source C strings shown won't change.
  186. * Some CFM environments cannot import data variables, and so
  187. * duplicate these CFStringRefs locally.
  188. */
  189. /*
  190. * kCGDisplayWidth
  191. *
  192. * Availability:
  193. * Non-Carbon CFM: not available
  194. * CarbonLib: not available
  195. * Mac OS X: in version 10.0 and later
  196. */
  197. extern CFStringRef kCGDisplayWidth;
  198. /*
  199. * kCGDisplayHeight
  200. *
  201. * Availability:
  202. * Non-Carbon CFM: not available
  203. * CarbonLib: not available
  204. * Mac OS X: in version 10.0 and later
  205. */
  206. extern CFStringRef kCGDisplayHeight;
  207. /*
  208. * kCGDisplayMode
  209. *
  210. * Availability:
  211. * Non-Carbon CFM: not available
  212. * CarbonLib: not available
  213. * Mac OS X: in version 10.0 and later
  214. */
  215. extern CFStringRef kCGDisplayMode;
  216. /*
  217. * kCGDisplayBitsPerPixel
  218. *
  219. * Availability:
  220. * Non-Carbon CFM: not available
  221. * CarbonLib: not available
  222. * Mac OS X: in version 10.0 and later
  223. */
  224. extern CFStringRef kCGDisplayBitsPerPixel;
  225. /*
  226. * kCGDisplayBitsPerSample
  227. *
  228. * Availability:
  229. * Non-Carbon CFM: not available
  230. * CarbonLib: not available
  231. * Mac OS X: in version 10.0 and later
  232. */
  233. extern CFStringRef kCGDisplayBitsPerSample;
  234. /*
  235. * kCGDisplaySamplesPerPixel
  236. *
  237. * Availability:
  238. * Non-Carbon CFM: not available
  239. * CarbonLib: not available
  240. * Mac OS X: in version 10.0 and later
  241. */
  242. extern CFStringRef kCGDisplaySamplesPerPixel;
  243. /*
  244. * kCGDisplayRefreshRate
  245. *
  246. * Availability:
  247. * Non-Carbon CFM: not available
  248. * CarbonLib: not available
  249. * Mac OS X: in version 10.0 and later
  250. */
  251. extern CFStringRef kCGDisplayRefreshRate;
  252. /*
  253. * kCGDisplayModeUsableForDesktopGUI
  254. *
  255. * Availability:
  256. * Non-Carbon CFM: not available
  257. * CarbonLib: not available
  258. * Mac OS X: in version 10.0 and later
  259. */
  260. extern CFStringRef kCGDisplayModeUsableForDesktopGUI;
  261. /*
  262. * kCGDisplayIOFlags
  263. *
  264. * Availability:
  265. * Non-Carbon CFM: not available
  266. * CarbonLib: not available
  267. * Mac OS X: in version 10.0 and later
  268. */
  269. extern CFStringRef kCGDisplayIOFlags;
  270. /*
  271. * Return a CFArray of CFDictionaries describing all display modes.
  272. * Returns NULL if the display is invalid.
  273. */
  274. /*
  275. * CGDisplayAvailableModes()
  276. *
  277. * Availability:
  278. * Non-Carbon CFM: not available
  279. * CarbonLib: not available
  280. * Mac OS X: in version 10.0 and later
  281. */
  282. EXTERN_API_C( CFArrayRef )
  283. CGDisplayAvailableModes(CGDirectDisplayID display);
  284. /*
  285. * Try to find a display mode of specified depth with dimensions equal or greater than
  286. * specified.
  287. * If no depth match is found, try for the next larger depth with dimensions equal or greater
  288. * than specified. If no luck, then just return the current mode.
  289. *
  290. * exactmatch, if not NULL, is set to 'true' if an exact match in width, height, and depth is found,
  291. * and 'false' otherwise.
  292. * Returns NULL if display is invalid.
  293. */
  294. /*
  295. * CGDisplayBestModeForParameters()
  296. *
  297. * Availability:
  298. * Non-Carbon CFM: not available
  299. * CarbonLib: not available
  300. * Mac OS X: in version 10.0 and later
  301. */
  302. EXTERN_API_C( CFDictionaryRef )
  303. CGDisplayBestModeForParameters(
  304. CGDirectDisplayID display,
  305. size_t bitsPerPixel,
  306. size_t width,
  307. size_t height,
  308. boolean_t * exactMatch);
  309. /*
  310. * CGDisplayBestModeForParametersAndRefreshRate()
  311. *
  312. * Availability:
  313. * Non-Carbon CFM: not available
  314. * CarbonLib: not available
  315. * Mac OS X: in version 10.0 and later
  316. */
  317. EXTERN_API_C( CFDictionaryRef )
  318. CGDisplayBestModeForParametersAndRefreshRate(
  319. CGDirectDisplayID display,
  320. size_t bitsPerPixel,
  321. size_t width,
  322. size_t height,
  323. CGRefreshRate refresh,
  324. boolean_t * exactMatch);
  325. /*
  326. * Return a CFDictionary describing the current display mode.
  327. * Returns NULL if display is invalid.
  328. */
  329. /*
  330. * CGDisplayCurrentMode()
  331. *
  332. * Availability:
  333. * Non-Carbon CFM: not available
  334. * CarbonLib: not available
  335. * Mac OS X: in version 10.0 and later
  336. */
  337. EXTERN_API_C( CFDictionaryRef )
  338. CGDisplayCurrentMode(CGDirectDisplayID display);
  339. /*
  340. * Switch display mode. Note that after switching,
  341. * display parameters and addresses may change.
  342. * The selected display mode persists for the life of the program, and automatically
  343. * reverts to the permanent setting made by Preferences when the program terminates.
  344. * The mode dictionary passed in must be a dictionary vended by other CGDirectDisplay
  345. * APIs such as CGDisplayBestModeForParameters() and CGDisplayAvailableModes().
  346. */
  347. /*
  348. * CGDisplaySwitchToMode()
  349. *
  350. * Availability:
  351. * Non-Carbon CFM: not available
  352. * CarbonLib: not available
  353. * Mac OS X: in version 10.0 and later
  354. */
  355. EXTERN_API_C( CGDisplayErr )
  356. CGDisplaySwitchToMode(
  357. CGDirectDisplayID display,
  358. CFDictionaryRef mode);
  359. /* Query parameters for current mode */
  360. /*
  361. * CGDisplayBitsPerPixel()
  362. *
  363. * Availability:
  364. * Non-Carbon CFM: not available
  365. * CarbonLib: not available
  366. * Mac OS X: in version 10.0 and later
  367. */
  368. EXTERN_API_C( size_t )
  369. CGDisplayBitsPerPixel(CGDirectDisplayID display);
  370. /*
  371. * CGDisplayBitsPerSample()
  372. *
  373. * Availability:
  374. * Non-Carbon CFM: not available
  375. * CarbonLib: not available
  376. * Mac OS X: in version 10.0 and later
  377. */
  378. EXTERN_API_C( size_t )
  379. CGDisplayBitsPerSample(CGDirectDisplayID display);
  380. /*
  381. * CGDisplaySamplesPerPixel()
  382. *
  383. * Availability:
  384. * Non-Carbon CFM: not available
  385. * CarbonLib: not available
  386. * Mac OS X: in version 10.0 and later
  387. */
  388. EXTERN_API_C( size_t )
  389. CGDisplaySamplesPerPixel(CGDirectDisplayID display);
  390. /*
  391. * CGDisplayBytesPerRow()
  392. *
  393. * Availability:
  394. * Non-Carbon CFM: not available
  395. * CarbonLib: not available
  396. * Mac OS X: in version 10.0 and later
  397. */
  398. EXTERN_API_C( size_t )
  399. CGDisplayBytesPerRow(CGDirectDisplayID display);
  400. /*
  401. * Set a display gamma/transfer function from a formula specifying
  402. * min and max values and a gamma for each channel.
  403. * Gamma values must be greater than 0.0.
  404. * To get an antigamma of 1.6, one would specify a value of (1.0 / 1.6)
  405. * Min values must be greater than or equal to 0.0 and less than 1.0.
  406. * Max values must be greater than 0.0 and less than or equal to 1.0.
  407. * Out of range values, or Max greater than or equal to Min result
  408. * in a kCGSRangeCheck error.
  409. *
  410. * Values are computed by sampling a function for a range of indices from 0 through 1:
  411. * value = Min + ((Max - Min) * pow(index, Gamma))
  412. * The resulting values are converted to a machine specific format
  413. * and loaded into hardware.
  414. */
  415. typedef float CGGammaValue;
  416. /*
  417. * CGSetDisplayTransferByFormula()
  418. *
  419. * Availability:
  420. * Non-Carbon CFM: not available
  421. * CarbonLib: not available
  422. * Mac OS X: in version 10.0 and later
  423. */
  424. EXTERN_API_C( CGDisplayErr )
  425. CGSetDisplayTransferByFormula(
  426. CGDirectDisplayID display,
  427. CGGammaValue redMin,
  428. CGGammaValue redMax,
  429. CGGammaValue redGamma,
  430. CGGammaValue greenMin,
  431. CGGammaValue greenMax,
  432. CGGammaValue greenGamma,
  433. CGGammaValue blueMin,
  434. CGGammaValue blueMax,
  435. CGGammaValue blueGamma);
  436. /*
  437. * CGGetDisplayTransferByFormula()
  438. *
  439. * Availability:
  440. * Non-Carbon CFM: not available
  441. * CarbonLib: not available
  442. * Mac OS X: in version 10.0 and later
  443. */
  444. EXTERN_API_C( CGDisplayErr )
  445. CGGetDisplayTransferByFormula(
  446. CGDirectDisplayID display,
  447. CGGammaValue * redMin,
  448. CGGammaValue * redMax,
  449. CGGammaValue * redGamma,
  450. CGGammaValue * greenMin,
  451. CGGammaValue * greenMax,
  452. CGGammaValue * greenGamma,
  453. CGGammaValue * blueMin,
  454. CGGammaValue * blueMax,
  455. CGGammaValue * blueGamma);
  456. /*
  457. * Set a display gamma/transfer function using tables of data for each channel.
  458. * Values within each table should have values in the range of 0.0 through 1.0.
  459. * The same table may be passed in for red, green, and blue channels. 'tableSize'
  460. * indicates the number of entries in each table.
  461. * The tables are interpolated as needed to generate the number of samples needed
  462. * by hardware.
  463. */
  464. /*
  465. * CGSetDisplayTransferByTable()
  466. *
  467. * Availability:
  468. * Non-Carbon CFM: not available
  469. * CarbonLib: not available
  470. * Mac OS X: in version 10.0 and later
  471. */
  472. EXTERN_API_C( CGDisplayErr )
  473. CGSetDisplayTransferByTable(
  474. CGDirectDisplayID display,
  475. CGTableCount tableSize,
  476. const CGGammaValue * redTable,
  477. const CGGammaValue * greenTable,
  478. const CGGammaValue * blueTable);
  479. /*
  480. * Get transfer tables. Capacity should contain the number of samples each
  481. * array can hold, and *sampleCount is filled in with the number of samples
  482. * actually copied in.
  483. */
  484. /*
  485. * CGGetDisplayTransferByTable()
  486. *
  487. * Availability:
  488. * Non-Carbon CFM: not available
  489. * CarbonLib: not available
  490. * Mac OS X: in version 10.0 and later
  491. */
  492. EXTERN_API_C( CGDisplayErr )
  493. CGGetDisplayTransferByTable(
  494. CGDirectDisplayID display,
  495. CGTableCount capacity,
  496. CGGammaValue * redTable,
  497. CGGammaValue * greenTable,
  498. CGGammaValue * blueTable,
  499. CGTableCount * sampleCount);
  500. /* As a convenience, allow setting of the gamma table by byte values */
  501. /*
  502. * CGSetDisplayTransferByByteTable()
  503. *
  504. * Availability:
  505. * Non-Carbon CFM: not available
  506. * CarbonLib: not available
  507. * Mac OS X: in version 10.0 and later
  508. */
  509. EXTERN_API_C( CGDisplayErr )
  510. CGSetDisplayTransferByByteTable(
  511. CGDirectDisplayID display,
  512. CGTableCount tableSize,
  513. const CGByteValue * redTable,
  514. const CGByteValue * greenTable,
  515. const CGByteValue * blueTable);
  516. /* Restore gamma tables of system displays to the user's ColorSync specified values */
  517. /*
  518. * CGDisplayRestoreColorSyncSettings()
  519. *
  520. * Availability:
  521. * Non-Carbon CFM: not available
  522. * CarbonLib: not available
  523. * Mac OS X: in version 10.0 and later
  524. */
  525. EXTERN_API_C( void )
  526. CGDisplayRestoreColorSyncSettings(void);
  527. /* Display capture and release */
  528. /*
  529. * CGDisplayIsCaptured()
  530. *
  531. * Availability:
  532. * Non-Carbon CFM: not available
  533. * CarbonLib: not available
  534. * Mac OS X: in version 10.0 and later
  535. */
  536. EXTERN_API_C( boolean_t )
  537. CGDisplayIsCaptured(CGDirectDisplayID display);
  538. /*
  539. * CGDisplayCapture()
  540. *
  541. * Availability:
  542. * Non-Carbon CFM: not available
  543. * CarbonLib: not available
  544. * Mac OS X: in version 10.0 and later
  545. */
  546. EXTERN_API_C( CGDisplayErr )
  547. CGDisplayCapture(CGDirectDisplayID display);
  548. /*
  549. * CGDisplayRelease()
  550. *
  551. * Availability:
  552. * Non-Carbon CFM: not available
  553. * CarbonLib: not available
  554. * Mac OS X: in version 10.0 and later
  555. */
  556. EXTERN_API_C( CGDisplayErr )
  557. CGDisplayRelease(CGDirectDisplayID display);
  558. /*
  559. * Capture all displays; this has the nice effect of providing an immersive
  560. * environment, and preventing other apps from trying to adjust themselves
  561. * to display changes only needed by your app.
  562. */
  563. /*
  564. * CGCaptureAllDisplays()
  565. *
  566. * Availability:
  567. * Non-Carbon CFM: not available
  568. * CarbonLib: not available
  569. * Mac OS X: in version 10.0 and later
  570. */
  571. EXTERN_API_C( CGDisplayErr )
  572. CGCaptureAllDisplays(void);
  573. /*
  574. * Release all captured displays, and restore the display modes to the
  575. * user's preferences. May be used in conjunction with CGDisplayCapture()
  576. * or CGCaptureAllDisplays().
  577. */
  578. /*
  579. * CGReleaseAllDisplays()
  580. *
  581. * Availability:
  582. * Non-Carbon CFM: not available
  583. * CarbonLib: not available
  584. * Mac OS X: in version 10.0 and later
  585. */
  586. EXTERN_API_C( CGDisplayErr )
  587. CGReleaseAllDisplays(void);
  588. /*
  589. * Returns CoreGraphics raw shield window ID or NULL if not shielded
  590. * This value may be used with drawing surface APIs.
  591. */
  592. /*
  593. * CGShieldingWindowID()
  594. *
  595. * Availability:
  596. * Non-Carbon CFM: not available
  597. * CarbonLib: not available
  598. * Mac OS X: in version 10.0 and later
  599. */
  600. EXTERN_API_C( void * )
  601. CGShieldingWindowID(CGDirectDisplayID display);
  602. /*
  603. * Returns the window level used for the shield window.
  604. * This value may be used with Cocoa windows to position the
  605. * Cocoa window in the same window level as the shield window.
  606. */
  607. /*
  608. * CGShieldingWindowLevel()
  609. *
  610. * Availability:
  611. * Non-Carbon CFM: not available
  612. * CarbonLib: not available
  613. * Mac OS X: in version 10.0 and later
  614. */
  615. EXTERN_API_C( int32_t )
  616. CGShieldingWindowLevel(void);
  617. /*
  618. * Returns base address of display or NULL for an invalid display.
  619. * If the display has not been captured, the returned address may refer
  620. * to read-only memory.
  621. */
  622. /*
  623. * CGDisplayBaseAddress()
  624. *
  625. * Availability:
  626. * Non-Carbon CFM: not available
  627. * CarbonLib: not available
  628. * Mac OS X: in version 10.0 and later
  629. */
  630. EXTERN_API_C( void * )
  631. CGDisplayBaseAddress(CGDirectDisplayID display);
  632. /*
  633. * return address for X,Y in screen coordinates;
  634. * (0,0) represents the upper left corner of the display.
  635. * returns NULL for an invalid display or out of bounds coordinates
  636. * If the display has not been captured, the returned address may refer
  637. * to read-only memory.
  638. */
  639. /*
  640. * CGDisplayAddressForPosition()
  641. *
  642. * Availability:
  643. * Non-Carbon CFM: not available
  644. * CarbonLib: not available
  645. * Mac OS X: in version 10.0 and later
  646. */
  647. EXTERN_API_C( void * )
  648. CGDisplayAddressForPosition(
  649. CGDirectDisplayID display,
  650. CGDisplayCoord x,
  651. CGDisplayCoord y);
  652. /* Mouse Cursor controls */
  653. /*
  654. * CGDisplayHideCursor()
  655. *
  656. * Availability:
  657. * Non-Carbon CFM: not available
  658. * CarbonLib: not available
  659. * Mac OS X: in version 10.0 and later
  660. */
  661. EXTERN_API_C( CGDisplayErr )
  662. CGDisplayHideCursor(CGDirectDisplayID display);
  663. /* increments hide cursor count */
  664. /*
  665. * CGDisplayShowCursor()
  666. *
  667. * Availability:
  668. * Non-Carbon CFM: not available
  669. * CarbonLib: not available
  670. * Mac OS X: in version 10.0 and later
  671. */
  672. EXTERN_API_C( CGDisplayErr )
  673. CGDisplayShowCursor(CGDirectDisplayID display);
  674. /* decrements hide cursor count */
  675. /*
  676. * Move the cursor to the specified point relative to the display origin
  677. * (the upper left corner of the display). Returns CGDisplayNoErr on success.
  678. * No events are generated as a result of this move.
  679. * Points that would lie outside the desktop are clipped to the desktop.
  680. */
  681. /*
  682. * CGDisplayMoveCursorToPoint()
  683. *
  684. * Availability:
  685. * Non-Carbon CFM: not available
  686. * CarbonLib: not available
  687. * Mac OS X: in version 10.0 and later
  688. */
  689. EXTERN_API_C( CGDisplayErr )
  690. CGDisplayMoveCursorToPoint(
  691. CGDirectDisplayID display,
  692. CGPoint point);
  693. /*
  694. * Report the mouse position change associated with the last mouse move event
  695. * recieved by this application.
  696. */
  697. /*
  698. * CGGetLastMouseDelta()
  699. *
  700. * Availability:
  701. * Non-Carbon CFM: not available
  702. * CarbonLib: not available
  703. * Mac OS X: in version 10.0 and later
  704. */
  705. EXTERN_API_C( void )
  706. CGGetLastMouseDelta(
  707. CGMouseDelta * deltaX,
  708. CGMouseDelta * deltaY);
  709. /* Palette controls (8 bit pseudocolor only) */
  710. /*
  711. * Returns TRUE if the current display mode supports palettes
  712. */
  713. /*
  714. * CGDisplayCanSetPalette()
  715. *
  716. * Availability:
  717. * Non-Carbon CFM: not available
  718. * CarbonLib: not available
  719. * Mac OS X: in version 10.0 and later
  720. */
  721. EXTERN_API_C( boolean_t )
  722. CGDisplayCanSetPalette(CGDirectDisplayID display);
  723. /*
  724. * Set a palette. The current gamma function is applied to the palette
  725. * elements before being loaded into hardware.
  726. */
  727. /*
  728. * CGDisplaySetPalette()
  729. *
  730. * Availability:
  731. * Non-Carbon CFM: not available
  732. * CarbonLib: not available
  733. * Mac OS X: in version 10.0 and later
  734. */
  735. EXTERN_API_C( CGDisplayErr )
  736. CGDisplaySetPalette(
  737. CGDirectDisplayID display,
  738. CGDirectPaletteRef palette);
  739. /*
  740. * Wait until the beam position is outside the range specified by upperScanLine and lowerScanLine.
  741. * Note that if upperScanLine and lowerScanLine encompass the entire display height,
  742. * the function returns an error.
  743. * lowerScanLine must be greater than or equal to upperScanLine.
  744. *
  745. * Some display systems may not conventional video vertical and horizontal sweep in painting.
  746. * These displays report a kCGDisplayRefreshRate of 0 in the CFDictionaryRef returned by
  747. * CGDisplayCurrentMode(). On such displays, this function returns at once.
  748. *
  749. * Some drivers may not implement support for this mechanism.
  750. * On such displays, this function returns at once.
  751. *
  752. * Returns CGDisplayNoErr on success, and an error if display or upperScanLine and
  753. * lowerScanLine are invalid.
  754. *
  755. * The app should set the values of upperScanLine and lowerScanLine to allow enough lead time
  756. * for the drawing operation to complete. A common strategy is to wait for the beam to pass
  757. * the bottom of the drawing area, allowing almost a full vertical sweep period to perform drawing.
  758. * To do this, set upperScanLine to 0, and set lowerScanLine to the bottom of the bounding box:
  759. * lowerScanLine = (CGBeamPosition)(cgrect.origin.y + cgrect.size.height);
  760. *
  761. * IOKit may implement this as a spin-loop on the beam position call used for CGDisplayBeamPosition().
  762. * On such system the function is CPU bound, and subject to all the usual scheduling pre-emption.
  763. * In particular, attempting to wait for the beam to hit a specific scanline may be an exercise in frustration.
  764. *
  765. * These functions are advisary in nature, and depend on IOKit and hardware specific drivers to implement
  766. * support. If you need extremely precise timing, or access to vertical blanking interrupts,
  767. * you should consider writing a device driver to tie into hardware-specific capabilities.
  768. */
  769. /*
  770. * CGDisplayWaitForBeamPositionOutsideLines()
  771. *
  772. * Availability:
  773. * Non-Carbon CFM: not available
  774. * CarbonLib: not available
  775. * Mac OS X: in version 10.0 and later
  776. */
  777. EXTERN_API_C( CGDisplayErr )
  778. CGDisplayWaitForBeamPositionOutsideLines(
  779. CGDirectDisplayID display,
  780. CGBeamPosition upperScanLine,
  781. CGBeamPosition lowerScanLine);
  782. /*
  783. * Returns the current beam position on the display. If display is invalid,
  784. * or the display does not implement conventional video vertical and horizontal
  785. * sweep in painting, or the driver does not implement this functionality, 0 is returned.
  786. */
  787. /*
  788. * CGDisplayBeamPosition()
  789. *
  790. * Availability:
  791. * Non-Carbon CFM: not available
  792. * CarbonLib: not available
  793. * Mac OS X: in version 10.0 and later
  794. */
  795. EXTERN_API_C( CGBeamPosition )
  796. CGDisplayBeamPosition(CGDirectDisplayID display);
  797. #ifdef PRAGMA_IMPORT_OFF
  798. #pragma import off
  799. #elif PRAGMA_IMPORT
  800. #pragma import reset
  801. #endif
  802. #ifdef __cplusplus
  803. }
  804. #endif
  805. #endif /* CGDIRECTDISPLAY_H_ */