CGSession.pas 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. {
  2. * CGSession.h
  3. * CoreGraphics
  4. *
  5. * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
  6. *
  7. }
  8. { Pascal Translation: 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 CGSession;
  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,CFDictionary,CGBase;
  90. {$ALIGN POWER}
  91. {
  92. * Fetch the current session's dictionary
  93. * Returns NULL if the caller is not within a GUI session, as when the caller is a UNIX daemon,
  94. * or if a system is configured to not run a Quartz GUI (window server disabled)
  95. }
  96. function CGSessionCopyCurrentDictionary: CFDictionaryRef; external name '_CGSessionCopyCurrentDictionary';
  97. {
  98. * Predefined keys for the Session dictionaries
  99. * Values are provided as CFSTR() macros rather than extern C data for PEF/CFM support.
  100. * Constant values will remain unchanged in future releases for PEF/CFM compatibility.
  101. *
  102. * These keys are guaranteed by the system to be present in a session dictionary.
  103. * Additional keys and values may be defined and added to the dictionary by
  104. * other system components as needed.
  105. }
  106. {$ifc USE_CFSTR_CONSTANT_MACROS}
  107. {$definec kCGSessionUserIDKey CFSTRP('kCGSSessionUserIDKey')}
  108. {$endc}
  109. { value is a CFNumber encoding a uid_t for the session's current user. }
  110. {$ifc USE_CFSTR_CONSTANT_MACROS}
  111. {$definec kCGSessionUserNameKey CFSTRP('kCGSSessionUserNameKey')}
  112. {$endc}
  113. { value is a CFString encoding the session's short user name as set by loginwindow }
  114. {$ifc USE_CFSTR_CONSTANT_MACROS}
  115. {$definec kCGSessionConsoleSetKey CFSTRP('kCGSSessionConsoleSetKey')}
  116. {$endc}
  117. { value is a CFNumber encoding a 32 bit unsigned integer value representing a set of hardware composing a console }
  118. {$ifc USE_CFSTR_CONSTANT_MACROS}
  119. {$definec kCGSessionOnConsoleKey CFSTRP('kCGSSessionOnConsoleKey')}
  120. {$endc}
  121. { value is a CFBoolean, kCFBooleanTrue if the session is on a console, otherwise kCFBooleanFalse }
  122. {$ifc USE_CFSTR_CONSTANT_MACROS}
  123. {$definec kCGSessionLoginDoneKey CFSTRP('kCGSessionLoginDoneKey')}
  124. {$endc}
  125. { value is a CFBoolean, kCFBooleanTrue if login operation has been done, otherwise kCFBooleanFalse }
  126. {
  127. * When the GUI session on a console changes, a notification
  128. * is posted via the notify_post() API. See notify (3) and
  129. * notify.h for details.
  130. }
  131. const
  132. kCGNotifyGUIConsoleSessionChanged = 'com.apple.coregraphics.GUIConsoleSessionChanged';
  133. { When a user logs in or out of a session we post a notification via notify_post() }
  134. const
  135. kCGNotifyGUISessionUserChanged = 'com.apple.coregraphics.GUISessionUserChanged';
  136. end.