gegl_xrandr.pas 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. unit gegl_xrandr;
  2. // для Unix с поддержкой Xrandr.
  3. // данный модуль может содержать ошибки!!!
  4. interface
  5. uses
  6. x, xlib, ctypes, xrender;
  7. const
  8. libXrandr = 'Xrandr';
  9. RANDR_NAME = 'RANDR';
  10. RANDR_MAJOR = 1;
  11. RANDR_MINOR = 6;
  12. RRNumberErrors = 5;
  13. RRNumberEvents = 2;
  14. RRNumberRequests = 47;
  15. X_RRQueryVersion = 0;
  16. { we skip 1 to make old clients fail pretty immediately }
  17. X_RROldGetScreenInfo = 1;
  18. X_RR1_0SetScreenConfig = 2;
  19. { V1.0 apps share the same set screen config request id }
  20. X_RRSetScreenConfig = 2;
  21. X_RROldScreenChangeSelectInput = 3;
  22. { 3 used to be ScreenChangeSelectInput; deprecated }
  23. X_RRSelectInput = 4;
  24. X_RRGetScreenInfo = 5;
  25. (* V1.2 additions *)
  26. X_RRGetScreenSizeRange = 6;
  27. X_RRSetScreenSize = 7;
  28. X_RRGetScreenResources = 8;
  29. X_RRGetOutputInfo = 9;
  30. X_RRListOutputProperties = 10;
  31. X_RRQueryOutputProperty = 11;
  32. X_RRConfigureOutputProperty = 12;
  33. X_RRChangeOutputProperty = 13;
  34. X_RRDeleteOutputProperty = 14;
  35. X_RRGetOutputProperty = 15;
  36. X_RRCreateMode = 16;
  37. X_RRDestroyMode = 17;
  38. X_RRAddOutputMode = 18;
  39. X_RRDeleteOutputMode = 19;
  40. X_RRGetCrtcInfo = 20;
  41. X_RRSetCrtcConfig = 21;
  42. X_RRGetCrtcGammaSize = 22;
  43. X_RRGetCrtcGamma = 23;
  44. X_RRSetCrtcGamma = 24;
  45. (* V1.3 additions *)
  46. X_RRGetScreenResourcesCurrent = 25;
  47. X_RRSetCrtcTransform = 26;
  48. X_RRGetCrtcTransform = 27;
  49. X_RRGetPanning = 28;
  50. X_RRSetPanning = 29;
  51. X_RRSetOutputPrimary = 30;
  52. X_RRGetOutputPrimary = 31;
  53. RRTransformUnit = 1 shl 0;
  54. RRTransformScaleUp = 1 shl 1;
  55. RRTransformScaleDown = 1 shl 2;
  56. RRTransformProjective = 1 shl 3;
  57. (* v1.4 *)
  58. X_RRGetProviders = 32;
  59. X_RRGetProviderInfo = 33;
  60. X_RRSetProviderOffloadSink = 34;
  61. X_RRSetProviderOutputSource = 35;
  62. X_RRListProviderProperties = 36;
  63. X_RRQueryProviderProperty = 37;
  64. X_RRConfigureProviderProperty = 38;
  65. X_RRChangeProviderProperty = 39;
  66. X_RRDeleteProviderProperty = 40;
  67. X_RRGetProviderProperty = 41;
  68. (* v1.5 *)
  69. X_RRGetMonitors = 42;
  70. X_RRSetMonitor = 43;
  71. X_RRDeleteMonitor = 44;
  72. (* v1.6 *)
  73. X_RRCreateLease = 45;
  74. X_RRFreeLease = 46;
  75. (* Event selection bits *)
  76. RRScreenChangeNotifyMask = 1 shl 0;
  77. (* V1.2 additions *)
  78. RRCrtcChangeNotifyMask = 1 shl 1;
  79. RROutputChangeNotifyMask = 1 shl 2;
  80. RROutputPropertyNotifyMask = 1 shl 3;
  81. (* V1.4 additions *)
  82. RRProviderChangeNotifyMask = 1 shl 4;
  83. RRProviderPropertyNotifyMask = 1 shl 5;
  84. RRResourceChangeNotifyMask = 1 shl 6;
  85. (* V1.6 additions *)
  86. RRLeaseNotifyMask = 1 shl 7;
  87. (* Event codes *)
  88. RRScreenChangeNotify = 0;
  89. (* V1.2 additions *)
  90. RRNotify = 1;
  91. (* RRNotify Subcodes *)
  92. RRNotify_CrtcChange = 0;
  93. RRNotify_OutputChange = 1;
  94. RRNotify_OutputProperty = 2;
  95. RRNotify_ProviderChange = 3;
  96. RRNotify_ProviderProperty = 4;
  97. RRNotify_ResourceChange = 5;
  98. (* V1.6 additions *)
  99. RRNotify_Lease = 6;
  100. (* used in the rotation field; rotation and reflection in 0.1 proto. *)
  101. RR_Rotate_0 = 1;
  102. RR_Rotate_90 = 2;
  103. RR_Rotate_180 = 4;
  104. RR_Rotate_270 = 8;
  105. (* new in 1.0 protocol, to allow reflection of screen *)
  106. RR_Reflect_X = 16;
  107. RR_Reflect_Y = 32;
  108. RRSetConfigSuccess = 0;
  109. RRSetConfigInvalidConfigTime = 1;
  110. RRSetConfigInvalidTime = 2;
  111. RRSetConfigFailed = 3;
  112. (* new in 1.2 protocol *)
  113. RR_HSyncPositive = $00000001;
  114. RR_HSyncNegative = $00000002;
  115. RR_VSyncPositive = $00000004;
  116. RR_VSyncNegative = $00000008;
  117. RR_Interlace = $00000010;
  118. RR_DoubleScan = $00000020;
  119. RR_CSync = $00000040;
  120. RR_CSyncPositive = $00000080;
  121. RR_CSyncNegative = $00000100;
  122. RR_HSkewPresent = $00000200;
  123. RR_BCast = $00000400;
  124. RR_PixelMultiplex = $00000800;
  125. RR_DoubleClock = $00001000;
  126. RR_ClockDivideBy2 = $00002000;
  127. RR_Connected = 0;
  128. RR_Disconnected = 1;
  129. RR_UnknownConnection = 2;
  130. BadRROutput = 0;
  131. BadRRCrtc = 1;
  132. BadRRMode = 2;
  133. BadRRProvider = 3;
  134. BadRRLease = 4;
  135. (* Conventional RandR output properties *)
  136. RR_PROPERTY_BACKLIGHT = 'Backlight';
  137. RR_PROPERTY_RANDR_EDID = 'EDID';
  138. RR_PROPERTY_SIGNAL_FORMAT = 'SignalFormat';
  139. RR_PROPERTY_SIGNAL_PROPERTIES = 'SignalProperties';
  140. RR_PROPERTY_CONNECTOR_TYPE = 'ConnectorType';
  141. RR_PROPERTY_CONNECTOR_NUMBER = 'ConnectorNumber';
  142. RR_PROPERTY_COMPATIBILITY_LIST = 'CompatibilityList';
  143. RR_PROPERTY_CLONE_LIST = 'CloneList';
  144. RR_PROPERTY_BORDER = 'Border"';
  145. RR_PROPERTY_BORDER_DIMENSIONS = 'BorderDimensions';
  146. RR_PROPERTY_GUID = 'GUID';
  147. RR_PROPERTY_RANDR_TILE = 'TILE';
  148. RR_PROPERTY_NON_DESKTOP = 'non-desktop';
  149. (* roles this device can carry out *)
  150. RR_Capability_None = 0;
  151. RR_Capability_SourceOutput = 1;
  152. RR_Capability_SinkOutput = 2;
  153. RR_Capability_SourceOffload = 4;
  154. RR_Capability_SinkOffload = 8;
  155. type
  156. PRotation = ^TRotation;
  157. TRotation = cushort;
  158. TConnection = cushort;
  159. PSizeID = ^TSizeID;
  160. TSizeID = cushort;
  161. PSubpixelOrder = ^TSubpixelOrder;
  162. TSubpixelOrder = cushort;
  163. PAtom = ^TAtom;
  164. pbyte = ^byte;
  165. PChar = ^char;
  166. PDisplay = ^TDisplay;
  167. Pdword = ^dword;
  168. Plongint = ^longint;
  169. PRROutput = ^RROutput;
  170. RROutput = TXID;
  171. PRRCrtc = ^RRCrtc;
  172. RRCrtc = TXID;
  173. PRRMode = ^RRMode;
  174. RRMode = TXID;
  175. PRRProvider = ^RRProvider;
  176. RRProvider = TXID;
  177. Psmallint = ^smallint;
  178. PTime = ^TTime;
  179. PXEvent = ^TXEvent;
  180. PXFixed = ^XFixed;
  181. XFixed = LongInt;
  182. PXTransform = ^TXTransform;
  183. (* взято из нового Xrender, из файла Xrender.h
  184. typedef struct _XTransform {
  185. XFixed matrix[3][3];
  186. } XTransform; *)
  187. TXTransform = record
  188. matrix: array[0..2] of array[0..2] of XFixed;
  189. end;
  190. {$IFDEF FPC}
  191. {$PACKRECORDS C}
  192. {$ENDIF}
  193. {
  194. * Copyright © 2000 Compaq Computer Corporation, Inc.
  195. * Copyright © 2002 Hewlett-Packard Company, Inc.
  196. * Copyright © 2006 Intel Corporation
  197. * Copyright © 2008 Red Hat, Inc.
  198. *
  199. * Permission to use, copy, modify, distribute, and sell this software and its
  200. * documentation for any purpose is hereby granted without fee, provided that
  201. * the above copyright notice appear in all copies and that both that copyright
  202. * notice and this permission notice appear in supporting documentation, and
  203. * that the name of the copyright holders not be used in advertising or
  204. * publicity pertaining to distribution of the software without specific,
  205. * written prior permission. The copyright holders make no representations
  206. * about the suitability of this software for any purpose. It is provided "as
  207. * is" without express or implied warranty.
  208. *
  209. * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  210. * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  211. * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  212. * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  213. * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  214. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  215. * OF THIS SOFTWARE.
  216. *
  217. * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
  218. * Keith Packard, Intel Corporation
  219. }
  220. {.$include <X11/extensions/randr.h>}
  221. {.$include <X11/extensions/Xrender.h>}
  222. {.$include <X11/Xfuncproto.h>}
  223. type
  224. PXRRScreenSize = ^TXRRScreenSize;
  225. TXRRScreenSize = record
  226. Width: longint;
  227. Height: longint;
  228. mwidth: longint;
  229. mheight: longint;
  230. end;
  231. {* Events. }
  232. TXRRScreenChangeNotifyEvent = record
  233. _type: longint; { event base }
  234. serial: dword; { # of last request processed by server }
  235. send_event: TBool ; { true if this came from a SendEvent request }
  236. display: PDisplay; { Display the event was read from }
  237. window: TWindow; { window which selected for this event }
  238. root: TWindow; { Root window for changed screen }
  239. timestamp: TTime; { when the screen change occurred }
  240. config_timestamp: TTime; { when the last configuration change }
  241. size_index: TSizeID;
  242. subpixel_order: TSubpixelOrder;
  243. rotation: TRotation;
  244. Width: longint;
  245. Height: longint;
  246. mwidth: longint;
  247. mheight: longint;
  248. end;
  249. TXRRNotifyEvent = record
  250. _type: longint; { event base }
  251. serial: dword; { # of last request processed by server }
  252. send_event: TBool; { true if this came from a SendEvent request }
  253. display: PDisplay; { Display the event was read from }
  254. window: TWindow; { window which selected for this event }
  255. subtype: longint; { RRNotify_ subtype }
  256. end;
  257. TXRROutputChangeNotifyEvent = record
  258. _type: longint; { event base }
  259. serial: dword; { # of last request processed by server }
  260. send_event: TBool; { true if this came from a SendEvent request }
  261. display: PDisplay; { Display the event was read from }
  262. window: TWindow; { window which selected for this event }
  263. subtype: longint; { RRNotify_OutputChange }
  264. output: RROutput; { affected output }
  265. crtc: RRCrtc; { current crtc (or None) }
  266. mode: RRMode; { current mode (or None) }
  267. rotation: TRotation; { current rotation of associated crtc }
  268. connection: TConnection; { current connection status }
  269. subpixel_order: TSubpixelOrder;
  270. end;
  271. TXRRCrtcChangeNotifyEvent = record
  272. _type: longint; { event base }
  273. serial: dword; { # of last request processed by server }
  274. send_event: TBool; { true if this came from a SendEvent request }
  275. display: PDisplay; { Display the event was read from }
  276. window: TWindow; { window which selected for this event }
  277. subtype: longint; { RRNotify_CrtcChange }
  278. crtc: RRCrtc; { current crtc (or None) }
  279. mode: RRMode; { current mode (or None) }
  280. rotation: TRotation; { current rotation of associated crtc }
  281. x: longint; { position }
  282. y: longint;
  283. Width: dword; { size }
  284. Height: dword;
  285. end;
  286. TXRROutputPropertyNotifyEvent = record
  287. _type: longint; { event base }
  288. serial: dword; { # of last request processed by server }
  289. send_event: TBool; { true if this came from a SendEvent request }
  290. display: PDisplay; { Display the event was read from }
  291. window: TWindow; { window which selected for this event }
  292. subtype: longint; { RRNotify_OutputProperty }
  293. output: RROutput; { related output }
  294. _property: TAtom; { changed property }
  295. timestamp: TTime; { time of change }
  296. state: longint; { NewValue, Deleted }
  297. end;
  298. TXRRProviderChangeNotifyEvent = record
  299. _type: longint; { event base }
  300. serial: dword; { # of last request processed by server }
  301. send_event: TBool; { true if this came from a SendEvent request }
  302. display: PDisplay; { Display the event was read from }
  303. window: TWindow; { window which selected for this event }
  304. subtype: longint; { RRNotify_ProviderChange }
  305. provider: RRProvider; { current provider (or None) }
  306. timestamp: TTime; { time of change }
  307. current_role: dword;
  308. end;
  309. TXRRProviderPropertyNotifyEvent = record
  310. _type: longint; { event base }
  311. serial: dword; { # of last request processed by server }
  312. send_event: TBool; { true if this came from a SendEvent request }
  313. display: PDisplay; { Display the event was read from }
  314. window: TWindow; { window which selected for this event }
  315. subtype: longint; { RRNotify_ProviderProperty }
  316. provider: RRProvider; { related provider }
  317. _property: TAtom; { changed property }
  318. timestamp: TTime; { time of change }
  319. state: longint; { NewValue, Deleted }
  320. end;
  321. TXRRResourceChangeNotifyEvent = record
  322. _type: longint; { event base }
  323. serial: dword; { # of last request processed by server }
  324. send_event: TBool; { true if this came from a SendEvent request }
  325. display: PDisplay; { Display the event was read from }
  326. window: TWindow; { window which selected for this event }
  327. subtype: longint; { RRNotify_ResourceChange }
  328. timestamp: TTime; { time of change }
  329. end;
  330. { internal representation is private to the library }
  331. // _XRRScreenConfiguration = XRRScreenConfiguration;
  332. PXRRScreenConfiguration = ^TXRRScreenConfiguration;
  333. TXRRScreenConfiguration = record end;
  334. function XRRQueryExtension(dpy: PDisplay; event_base_return: Plongint; error_base_return: Plongint): TBoolResult; cdecl; external libXrandr;
  335. function XRRQueryVersion(dpy: PDisplay; major_version_return: Plongint; minor_version_return: Plongint): TStatus; cdecl; external libXrandr;
  336. function XRRGetScreenInfo(dpy: PDisplay; window: TWindow): PXRRScreenConfiguration; cdecl; external libXrandr;
  337. procedure XRRFreeScreenConfigInfo(config: PXRRScreenConfiguration); cdecl; external libXrandr;
  338. {
  339. * Note that screen configuration changes are only permitted if the client can
  340. * prove it has up to date configuration information. We are trying to
  341. * insist that it become possible for screens to change dynamically, so
  342. * we want to ensure the client knows what it is talking about when requesting
  343. * changes.
  344. Обратите внимание, что изменения конфигурации экрана разрешены только в том
  345. случае, если клиент может доказать, что у него есть обновленная информация о
  346. конфигурации. Мы пытаемся настоять на том, чтобы экраны могли изменяться
  347. динамически, поэтому мы хотим, чтобы клиент знал, о чем он говорит, запрашивая
  348. изменения.
  349. }
  350. function XRRSetScreenConfig(dpy: PDisplay; config: PXRRScreenConfiguration;
  351. draw: TDrawable; size_index: longint; rotation: TRotation; timestamp: TTime): TStatus; cdecl; external libXrandr;
  352. { added in v1.1, sorry for the lame name }
  353. function XRRSetScreenConfigAndRate(dpy: PDisplay; config: PXRRScreenConfiguration;
  354. draw: TDrawable; size_index: longint; rotation: TRotation; rate: smallint; timestamp: TTime): TStatus; cdecl; external libXrandr;
  355. function XRRConfigRotations(config: PXRRScreenConfiguration;current_rotation: PRotation): TRotation; cdecl; external libXrandr;
  356. function XRRConfigTimes(config: PXRRScreenConfiguration; config_timestamp: PTime): TTime; cdecl; external libXrandr;
  357. function XRRConfigSizes(config: PXRRScreenConfiguration; nsizes: Plongint): PXRRScreenSize; cdecl; external libXrandr;
  358. function XRRConfigRates(config: PXRRScreenConfiguration; TsizeID: longint; nrates: Plongint): Psmallint; cdecl; external libXrandr;
  359. function XRRConfigCurrentConfiguration(config: PXRRScreenConfiguration; rotation: PRotation): TSizeID; cdecl; external libXrandr;
  360. function XRRConfigCurrentRate(config: PXRRScreenConfiguration): smallint; cdecl; external libXrandr;
  361. function XRRRootToScreen(dpy: PDisplay; root: TWindow): longint; cdecl; external libXrandr;
  362. {
  363. * returns the screen configuration for the specified screen; does a lazy
  364. * evaluation to delay getting the information, and caches the result.
  365. * These routines should be used in preference to XRRGetScreenInfo
  366. * to avoid unneeded round trips to the X server. These are new
  367. * in protocol version 0.1.
  368. возвращает конфигурацию экрана для указанного экрана; выполняет ленивую
  369. оценку, чтобы задержать получение информации, и кэширует результат. Эти
  370. процедуры следует использовать вместо XRRGetScreenInfo, чтобы избежать
  371. ненужных обращений к X-серверу. Это новые возможности протокола версии 0.1.
  372. }
  373. procedure XRRSelectInput(dpy: PDisplay; window: TWindow; mask: longint); cdecl; external libXrandr;
  374. {
  375. * the following are always safe to call, even if RandR is not implemented
  376. * on a screen
  377. всегда безопасно вызывать следующие действия, даже если RandR не реализован на
  378. экране
  379. }
  380. function XRRRotations(dpy: PDisplay; screen: longint; current_rotation: PRotation): TRotation; cdecl; external libXrandr;
  381. function XRRSizes(dpy: PDisplay; screen: longint; nsizes: Plongint): PXRRScreenSize; cdecl; external libXrandr;
  382. function XRRRates(dpy: PDisplay; screen: longint; TsizeID: longint; nrates: Plongint): Psmallint; cdecl; external libXrandr;
  383. function XRRTimes(dpy: PDisplay; screen: longint; config_timestamp: PTime): TTime; cdecl; external libXrandr;
  384. { Version 1.2 additions }
  385. function XRRGetScreenSizeRange(dpy: PDisplay; window: TWindow;
  386. minWidth: Plongint; minHeight: Plongint; maxWidth: Plongint; maxHeight: Plongint): TStatus; cdecl; external libXrandr;
  387. procedure XRRSetScreenSize(dpy: PDisplay; window: TWindow; Width: longint; Height: longint; mmWidth: longint; mmHeight: longint); cdecl; external libXrandr;
  388. type
  389. TXRRModeFlags = dword;
  390. PXRRModeInfo = ^TXRRModeInfo;
  391. TXRRModeInfo = record
  392. id: RRMode;
  393. Width: dword;
  394. Height: dword;
  395. dotClock: dword;
  396. hSyncStart: dword;
  397. hSyncEnd: dword;
  398. hTotal: dword;
  399. hSkew: dword;
  400. vSyncStart: dword;
  401. vSyncEnd: dword;
  402. vTotal: dword;
  403. Name: Pchar;
  404. nameLength: dword;
  405. modeFlags: TXRRModeFlags;
  406. end;
  407. // XRRModeInfo = _XRRModeInfo;
  408. PXRRScreenResources = ^TXRRScreenResources;
  409. TXRRScreenResources = record
  410. timestamp: TTime;
  411. configTimestamp: TTime;
  412. ncrtc: longint;
  413. crtcs: PRRCrtc;
  414. noutput: longint;
  415. outputs: PRROutput;
  416. nmode: longint;
  417. modes: PXRRModeInfo;
  418. end;
  419. // XRRScreenResources = _XRRScreenResources;
  420. function XRRGetScreenResources(dpy: PDisplay; window: TWindow): PXRRScreenResources; cdecl; external libXrandr;
  421. procedure XRRFreeScreenResources(resources: PXRRScreenResources); cdecl; external libXrandr;
  422. type
  423. PXRROutputInfo = ^TXRROutputInfo;
  424. TXRROutputInfo = record
  425. timestamp: TTime;
  426. crtc: RRCrtc;
  427. Name: Pchar;
  428. nameLen: longint;
  429. mm_width: dword;
  430. mm_height: dword;
  431. connection: TConnection;
  432. subpixel_order: TSubpixelOrder;
  433. ncrtc: longint;
  434. crtcs: PRRCrtc;
  435. nclone: longint;
  436. clones: PRROutput;
  437. nmode: longint;
  438. npreferred: longint;
  439. modes: PRRMode;
  440. end;
  441. // XRROutputInfo = _XRROutputInfo;
  442. function XRRGetOutputInfo(dpy: PDisplay; resources: PXRRScreenResources; output: RROutput): PXRROutputInfo; cdecl; external libXrandr;
  443. procedure XRRFreeOutputInfo(outputInfo: PXRROutputInfo); cdecl; external libXrandr;
  444. function XRRListOutputProperties(dpy: PDisplay; output: RROutput; nprop: Plongint): PAtom; cdecl; external libXrandr;
  445. type
  446. PXRRPropertyInfo = ^TXRRPropertyInfo;
  447. TXRRPropertyInfo = record
  448. pending: TBool;
  449. range: TBool;
  450. immutable: TBool;
  451. num_values: longint;
  452. values: Plongint;
  453. end;
  454. function XRRQueryOutputProperty(dpy: PDisplay; output: RROutput; _property: TAtom): PXRRPropertyInfo; cdecl; external libXrandr;
  455. procedure XRRConfigureOutputProperty(dpy: PDisplay; output: RROutput;
  456. _property: TAtom; pending: TBool; range: TBool; num_values: longint; values: Plongint); cdecl; external libXrandr;
  457. procedure XRRChangeOutputProperty(dpy: PDisplay; output: RROutput; _property: TAtom; _type: TAtom; format: longint;
  458. mode: longint; Data: pbyte {_Xconst } {PChar}; nelements: longint); cdecl; external libXrandr;
  459. procedure XRRDeleteOutputProperty(dpy: PDisplay; output: RROutput; _property: TAtom); cdecl; external libXrandr;
  460. function XRRGetOutputProperty(dpy: PDisplay; output: RROutput; _property: TAtom; offset: longint; length: longint; _delete: TBool;
  461. pending: TBool; req_type: TAtom; actual_type: PAtom; actual_format: Plongint; nitems: Pdword; bytes_after: Pdword; prop: PPbyte {PPChar}): longint; cdecl; external libXrandr;
  462. function XRRAllocModeInfo(Name: PChar {_Xconst }; nameLength: longint): PXRRModeInfo; cdecl; external libXrandr;
  463. function XRRCreateMode(dpy: PDisplay; window: TWindow; modeInfo: PXRRModeInfo): RRMode; cdecl; external libXrandr;
  464. procedure XRRDestroyMode(dpy: PDisplay; mode: RRMode); cdecl; external libXrandr;
  465. procedure XRRAddOutputMode(dpy: PDisplay; output: RROutput; mode: RRMode); cdecl; external libXrandr;
  466. procedure XRRDeleteOutputMode(dpy: PDisplay; output: RROutput; mode: RRMode); cdecl; external libXrandr;
  467. procedure XRRFreeModeInfo(modeInfo: PXRRModeInfo); cdecl; external libXrandr;
  468. type
  469. PXRRCrtcInfo = ^TXRRCrtcInfo;
  470. TXRRCrtcInfo = record
  471. timestamp: TTime;
  472. x: longint;
  473. y: longint;
  474. Width: dword;
  475. Height: dword;
  476. mode: RRMode;
  477. rotation: TRotation;
  478. noutput: longint;
  479. outputs: PRROutput;
  480. rotations: TRotation;
  481. npossible: longint;
  482. possible: PRROutput;
  483. end;
  484. // XRRCrtcInfo = _XRRCrtcInfo;
  485. function XRRGetCrtcInfo(dpy: PDisplay; resources: PXRRScreenResources; crtc: RRCrtc): PXRRCrtcInfo; cdecl; external libXrandr;
  486. procedure XRRFreeCrtcInfo(crtcInfo: PXRRCrtcInfo); cdecl; external libXrandr;
  487. function XRRSetCrtcConfig(dpy: PDisplay; resources: PXRRScreenResources;
  488. crtc: RRCrtc; timestamp: TTime; x: longint; y: longint; mode: RRMode; rotation: TRotation; outputs: PRROutput; noutputs: longint): TStatus; cdecl; external libXrandr;
  489. function XRRGetCrtcGammaSize(dpy: PDisplay; crtc: RRCrtc): longint; cdecl; external libXrandr;
  490. type
  491. PXRRCrtcGamma = ^TXRRCrtcGamma;
  492. TXRRCrtcGamma = record
  493. size: longint;
  494. red: Pword;
  495. green: Pword;
  496. blue: Pword;
  497. end;
  498. // XRRCrtcGamma = _XRRCrtcGamma;
  499. function XRRGetCrtcGamma(dpy: PDisplay; crtc: RRCrtc): PXRRCrtcGamma; cdecl; external libXrandr;
  500. function XRRAllocGamma(size: longint): PXRRCrtcGamma; cdecl; external libXrandr;
  501. procedure XRRSetCrtcGamma(dpy: PDisplay; crtc: RRCrtc; gamma: PXRRCrtcGamma); cdecl; external libXrandr;
  502. procedure XRRFreeGamma(gamma: PXRRCrtcGamma); cdecl; external libXrandr;
  503. { Version 1.3 additions }
  504. function XRRGetScreenResourcesCurrent(dpy: PDisplay; window: TWindow): PXRRScreenResources; cdecl; external libXrandr;
  505. procedure XRRSetCrtcTransform(dpy: PDisplay; crtc: RRCrtc; transform: PXTransform; filter: PChar{_Xconst }; params: PXFixed; nparams: longint); cdecl; external libXrandr;
  506. type
  507. PPXRRCrtcTransformAttributes = ^PXRRCrtcTransformAttributes;
  508. PXRRCrtcTransformAttributes = ^TXRRCrtcTransformAttributes;
  509. TXRRCrtcTransformAttributes = record
  510. pendingTransform: TXTransform;
  511. pendingFilter: Pchar;
  512. pendingNparams: longint;
  513. pendingParams: PXFixed;
  514. currentTransform: TXTransform;
  515. currentFilter: Pchar;
  516. currentNparams: longint;
  517. currentParams: PXFixed;
  518. end;
  519. // XRRCrtcTransformAttributes = _XRRCrtcTransformAttributes;
  520. {
  521. * Get current crtc transforms and filters.
  522. * Pass *attributes to XFree to free
  523. }
  524. function XRRGetCrtcTransform(dpy: PDisplay; crtc: RRCrtc; attributes: PPXRRCrtcTransformAttributes): TStatus; cdecl; external libXrandr;
  525. {
  526. * intended to take RRScreenChangeNotify, or
  527. * ConfigureNotify (on the root window)
  528. * returns 1 if it is an event type it understands, 0 if not
  529. предназначенный для получения RRScreenChangeNotify или ConfigurationNotify (в
  530. корневом окне), возвращает 1, если это тип события, который он понимает, и 0,
  531. если нет
  532. }
  533. function XRRUpdateConfiguration(event: PXEvent): longint; cdecl; external libXrandr;
  534. type
  535. PXRRPanning = ^TXRRPanning;
  536. TXRRPanning = record
  537. timestamp: TTime;
  538. left: dword;
  539. top: dword;
  540. Width: dword;
  541. Height: dword;
  542. track_left: dword;
  543. track_top: dword;
  544. track_width: dword;
  545. track_height: dword;
  546. border_left: longint;
  547. border_top: longint;
  548. border_right: longint;
  549. border_bottom: longint;
  550. end;
  551. // XRRPanning = _XRRPanning;
  552. function XRRGetPanning(dpy: PDisplay; resources: PXRRScreenResources; crtc: RRCrtc): PXRRPanning; cdecl; external libXrandr;
  553. procedure XRRFreePanning(panning: PXRRPanning); cdecl; external libXrandr;
  554. function XRRSetPanning(dpy: PDisplay; resources: PXRRScreenResources; crtc: RRCrtc; panning: PXRRPanning): TStatus; cdecl; external libXrandr;
  555. procedure XRRSetOutputPrimary(dpy: PDisplay; window: TWindow; output: RROutput); cdecl; external libXrandr;
  556. function XRRGetOutputPrimary(dpy: PDisplay; window: TWindow): RROutput; cdecl; external libXrandr;
  557. type
  558. PXRRProviderResources = ^TXRRProviderResources;
  559. TXRRProviderResources = record
  560. timestamp: TTime;
  561. nproviders: longint;
  562. providers: PRRProvider;
  563. end;
  564. // XRRProviderResources = _XRRProviderResources;
  565. function XRRGetProviderResources(dpy: PDisplay; window: TWindow): PXRRProviderResources; cdecl; external libXrandr;
  566. procedure XRRFreeProviderResources(resources: PXRRProviderResources); cdecl; external libXrandr;
  567. type
  568. PXRRProviderInfo = ^TXRRProviderInfo;
  569. TXRRProviderInfo = record
  570. capabilities: dword;
  571. ncrtcs: longint;
  572. crtcs: PRRCrtc;
  573. noutputs: longint;
  574. outputs: PRROutput;
  575. Name: Pchar;
  576. nassociatedproviders: longint;
  577. associated_providers: PRRProvider;
  578. associated_capability: Pdword;
  579. nameLen: longint;
  580. end;
  581. // XRRProviderInfo = _XRRProviderInfo;
  582. function XRRGetProviderInfo(dpy: PDisplay; resources: PXRRScreenResources; provider: RRProvider): PXRRProviderInfo; cdecl; external libXrandr;
  583. procedure XRRFreeProviderInfo(provider: PXRRProviderInfo); cdecl; external libXrandr;
  584. function XRRSetProviderOutputSource(dpy: PDisplay; provider: TXID; source_provider: TXID): longint; cdecl; external libXrandr;
  585. function XRRSetProviderOffloadSink(dpy: PDisplay; provider: TXID; sink_provider: TXID): longint; cdecl; external libXrandr;
  586. function XRRListProviderProperties(dpy: PDisplay; provider: RRProvider; nprop: Plongint): PAtom; cdecl; external libXrandr;
  587. function XRRQueryProviderProperty(dpy: PDisplay; provider: RRProvider; _property: TAtom): PXRRPropertyInfo; cdecl; external libXrandr;
  588. procedure XRRConfigureProviderProperty(dpy: PDisplay; provider: RRProvider; _property: tAtom; pending: TBool; range: TBool; num_values: longint; values: Plongint); cdecl; external libXrandr;
  589. procedure XRRChangeProviderProperty(dpy: PDisplay; provider: RRProvider; _property: TAtom; _type: TAtom; format: longint;
  590. mode: longint; Data: pbyte {_Xconst } {PChar}; nelements: longint); cdecl; external libXrandr;
  591. procedure XRRDeleteProviderProperty(dpy: PDisplay; provider: RRProvider; _property: TAtom); cdecl; external libXrandr;
  592. function XRRGetProviderProperty(dpy: PDisplay; provider: RRProvider; _property: TAtom; offset: longint; length: longint; _delete: TBool;
  593. pending: TBool; req_type: TAtom; actual_type: PAtom; actual_format: Plongint; nitems: Pdword; bytes_after: Pdword; prop: PPbyte {PPChar}): longint; cdecl; external libXrandr;
  594. type
  595. PXRRMonitorInfo = ^TXRRMonitorInfo;
  596. TXRRMonitorInfo = record
  597. Name: TAtom;
  598. primary: TBool;
  599. automatic: TBool;
  600. noutput: longint;
  601. x: longint;
  602. y: longint;
  603. Width: longint;
  604. Height: longint;
  605. mwidth: longint;
  606. mheight: longint;
  607. outputs: PRROutput;
  608. end;
  609. // XRRMonitorInfo = _XRRMonitorInfo;
  610. function XRRAllocateMonitor(dpy: PDisplay; noutput: longint): PXRRMonitorInfo; cdecl; external libXrandr;
  611. function XRRGetMonitors(dpy: PDisplay; window: TWindow; get_active: TBool; nmonitors: Plongint): PXRRMonitorInfo; cdecl; external libXrandr;
  612. procedure XRRSetMonitor(dpy: PDisplay; window: TWindow; monitor: PXRRMonitorInfo); cdecl; external libXrandr;
  613. procedure XRRDeleteMonitor(dpy: PDisplay; window: TWindow; Name: TAtom); cdecl; external libXrandr;
  614. procedure XRRFreeMonitors(monitors: PXRRMonitorInfo); cdecl; external libXrandr;
  615. implementation
  616. end.