Debian Codegraph @

thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h

raw symbols SCIP
1 /*
2 * Copyright © 2000 Compaq Computer Corporation, Inc.
3 * Copyright © 2002 Hewlett-Packard Company, Inc.
4 * Copyright © 2006 Intel Corporation
5 * Copyright © 2008 Red Hat, Inc.
6 *
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that copyright
10 * notice and this permission notice appear in supporting documentation, and
11 * that the name of the copyright holders not be used in advertising or
12 * publicity pertaining to distribution of the software without specific,
13 * written prior permission. The copyright holders make no representations
14 * about the suitability of this software for any purpose. It is provided "as
15 * is" without express or implied warranty.
16 *
17 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
19 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23 * OF THIS SOFTWARE.
24 *
25 * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
26 * Keith Packard, Intel Corporation
27 */
28
29 #ifndef _XRANDR_H_
30 #define _XRANDR_H_
31
32 #include <X11/extensions/randr.h>
33 #include <X11/extensions/Xrender.h>
34
35 #include <X11/Xfuncproto.h>
36
37 _XFUNCPROTOBEGIN
38
39 typedef XID RROutput;
40 typedef XID RRCrtc;
41 typedef XID RRMode;
42 typedef XID RRProvider;
43
44 typedef struct {
45 int width, height;
46 int mwidth, mheight;
47 } XRRScreenSize;
48
49 /*
50 * Events.
51 */
52
53 typedef struct {
54 int type; /* event base */
55 unsigned long serial; /* # of last request processed by server */
56 Bool send_event; /* true if this came from a SendEvent request */
57 Display *display; /* Display the event was read from */
58 Window window; /* window which selected for this event */
59 Window root; /* Root window for changed screen */
60 Time timestamp; /* when the screen change occurred */
61 Time config_timestamp; /* when the last configuration change */
62 SizeID size_index;
63 SubpixelOrder subpixel_order;
64 Rotation rotation;
65 int width;
66 int height;
67 int mwidth;
68 int mheight;
69 } XRRScreenChangeNotifyEvent;
70
71 typedef struct {
72 int type; /* event base */
73 unsigned long serial; /* # of last request processed by server */
74 Bool send_event; /* true if this came from a SendEvent request */
75 Display *display; /* Display the event was read from */
76 Window window; /* window which selected for this event */
77 int subtype; /* RRNotify_ subtype */
78 } XRRNotifyEvent;
79
80 typedef struct {
81 int type; /* event base */
82 unsigned long serial; /* # of last request processed by server */
83 Bool send_event; /* true if this came from a SendEvent request */
84 Display *display; /* Display the event was read from */
85 Window window; /* window which selected for this event */
86 int subtype; /* RRNotify_OutputChange */
87 RROutput output; /* affected output */
88 RRCrtc crtc; /* current crtc (or None) */
89 RRMode mode; /* current mode (or None) */
90 Rotation rotation; /* current rotation of associated crtc */
91 Connection connection; /* current connection status */
92 SubpixelOrder subpixel_order;
93 } XRROutputChangeNotifyEvent;
94
95 typedef struct {
96 int type; /* event base */
97 unsigned long serial; /* # of last request processed by server */
98 Bool send_event; /* true if this came from a SendEvent request */
99 Display *display; /* Display the event was read from */
100 Window window; /* window which selected for this event */
101 int subtype; /* RRNotify_CrtcChange */
102 RRCrtc crtc; /* current crtc (or None) */
103 RRMode mode; /* current mode (or None) */
104 Rotation rotation; /* current rotation of associated crtc */
105 int x, y; /* position */
106 unsigned int width, height; /* size */
107 } XRRCrtcChangeNotifyEvent;
108
109 typedef struct {
110 int type; /* event base */
111 unsigned long serial; /* # of last request processed by server */
112 Bool send_event; /* true if this came from a SendEvent request */
113 Display *display; /* Display the event was read from */
114 Window window; /* window which selected for this event */
115 int subtype; /* RRNotify_OutputProperty */
116 RROutput output; /* related output */
117 Atom property; /* changed property */
118 Time timestamp; /* time of change */
119 int state; /* NewValue, Deleted */
120 } XRROutputPropertyNotifyEvent;
121
122 typedef struct {
123 int type; /* event base */
124 unsigned long serial; /* # of last request processed by server */
125 Bool send_event; /* true if this came from a SendEvent request */
126 Display *display; /* Display the event was read from */
127 Window window; /* window which selected for this event */
128 int subtype; /* RRNotify_ProviderChange */
129 RRProvider provider; /* current provider (or None) */
130 Time timestamp; /* time of change */
131 unsigned int current_role;
132 } XRRProviderChangeNotifyEvent;
133
134 typedef struct {
135 int type; /* event base */
136 unsigned long serial; /* # of last request processed by server */
137 Bool send_event; /* true if this came from a SendEvent request */
138 Display *display; /* Display the event was read from */
139 Window window; /* window which selected for this event */
140 int subtype; /* RRNotify_ProviderProperty */
141 RRProvider provider; /* related provider */
142 Atom property; /* changed property */
143 Time timestamp; /* time of change */
144 int state; /* NewValue, Deleted */
145 } XRRProviderPropertyNotifyEvent;
146
147 typedef struct {
148 int type; /* event base */
149 unsigned long serial; /* # of last request processed by server */
150 Bool send_event; /* true if this came from a SendEvent request */
151 Display *display; /* Display the event was read from */
152 Window window; /* window which selected for this event */
153 int subtype; /* RRNotify_ResourceChange */
154 Time timestamp; /* time of change */
155 } XRRResourceChangeNotifyEvent;
156
157 /* internal representation is private to the library */
158 typedef struct _XRRScreenConfiguration XRRScreenConfiguration;
159
160 Bool XRRQueryExtension (Display *dpy,
161 int *event_base_return,
162 int *error_base_return);
163 Status XRRQueryVersion (Display *dpy,
164 int *major_version_return,
165 int *minor_version_return);
166
167 XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy,
168 Window window);
169
170 void XRRFreeScreenConfigInfo (XRRScreenConfiguration *config);
171
172 /*
173 * Note that screen configuration changes are only permitted if the client can
174 * prove it has up to date configuration information. We are trying to
175 * insist that it become possible for screens to change dynamically, so
176 * we want to ensure the client knows what it is talking about when requesting
177 * changes.
178 */
179 Status XRRSetScreenConfig (Display *dpy,
180 XRRScreenConfiguration *config,
181 Drawable draw,
182 int size_index,
183 Rotation rotation,
184 Time timestamp);
185
186 /* added in v1.1, sorry for the lame name */
187 Status XRRSetScreenConfigAndRate (Display *dpy,
188 XRRScreenConfiguration *config,
189 Drawable draw,
190 int size_index,
191 Rotation rotation,
192 short rate,
193 Time timestamp);
194
195
196 Rotation XRRConfigRotations(XRRScreenConfiguration *config, Rotation *current_rotation);
197
198 Time XRRConfigTimes (XRRScreenConfiguration *config, Time *config_timestamp);
199
200 XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes);
201
202 short *XRRConfigRates (XRRScreenConfiguration *config, int sizeID, int *nrates);
203
204 SizeID XRRConfigCurrentConfiguration (XRRScreenConfiguration *config,
205 Rotation *rotation);
206
207 short XRRConfigCurrentRate (XRRScreenConfiguration *config);
208
209 int XRRRootToScreen(Display *dpy, Window root);
210
211 /*
212 * returns the screen configuration for the specified screen; does a lazy
213 * evalution to delay getting the information, and caches the result.
214 * These routines should be used in preference to XRRGetScreenInfo
215 * to avoid unneeded round trips to the X server. These are new
216 * in protocol version 0.1.
217 */
218
219
220 void XRRSelectInput(Display *dpy, Window window, int mask);
221
222 /*
223 * the following are always safe to call, even if RandR is not implemented
224 * on a screen
225 */
226
227
228 Rotation XRRRotations(Display *dpy, int screen, Rotation *current_rotation);
229 XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes);
230 short *XRRRates (Display *dpy, int screen, int sizeID, int *nrates);
231 Time XRRTimes (Display *dpy, int screen, Time *config_timestamp);
232
233
234 /* Version 1.2 additions */
235
236 /* despite returning a Status, this returns 1 for success */
237 Status
238 XRRGetScreenSizeRange (Display *dpy, Window window,
239 int *minWidth, int *minHeight,
240 int *maxWidth, int *maxHeight);
241
242 void
243 XRRSetScreenSize (Display *dpy, Window window,
244 int width, int height,
245 int mmWidth, int mmHeight);
246
247 typedef unsigned long XRRModeFlags;
248
249 typedef struct _XRRModeInfo {
250 RRMode id;
251 unsigned int width;
252 unsigned int height;
253 unsigned long dotClock;
254 unsigned int hSyncStart;
255 unsigned int hSyncEnd;
256 unsigned int hTotal;
257 unsigned int hSkew;
258 unsigned int vSyncStart;
259 unsigned int vSyncEnd;
260 unsigned int vTotal;
261 char *name;
262 unsigned int nameLength;
263 XRRModeFlags modeFlags;
264 } XRRModeInfo;
265
266 typedef struct _XRRScreenResources {
267 Time timestamp;
268 Time configTimestamp;
269 int ncrtc;
270 RRCrtc *crtcs;
271 int noutput;
272 RROutput *outputs;
273 int nmode;
274 XRRModeInfo *modes;
275 } XRRScreenResources;
276
277 XRRScreenResources *
278 XRRGetScreenResources (Display *dpy, Window window);
279
280 void
281 XRRFreeScreenResources (XRRScreenResources *resources);
282
283 typedef struct _XRROutputInfo {
284 Time timestamp;
285 RRCrtc crtc;
286 char *name;
287 int nameLen;
288 unsigned long mm_width;
289 unsigned long mm_height;
290 Connection connection;
291 SubpixelOrder subpixel_order;
292 int ncrtc;
293 RRCrtc *crtcs;
294 int nclone;
295 RROutput *clones;
296 int nmode;
297 int npreferred;
298 RRMode *modes;
299 } XRROutputInfo;
300
301 XRROutputInfo *
302 XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources, RROutput output);
303
304 void
305 XRRFreeOutputInfo (XRROutputInfo *outputInfo);
306
307 Atom *
308 XRRListOutputProperties (Display *dpy, RROutput output, int *nprop);
309
310 typedef struct {
311 Bool pending;
312 Bool range;
313 Bool immutable;
314 int num_values;
315 long *values;
316 } XRRPropertyInfo;
317
318 XRRPropertyInfo *
319 XRRQueryOutputProperty (Display *dpy, RROutput output, Atom property);
320
321 void
322 XRRConfigureOutputProperty (Display *dpy, RROutput output, Atom property,
323 Bool pending, Bool range, int num_values,
324 long *values);
325
326 void
327 XRRChangeOutputProperty (Display *dpy, RROutput output,
328 Atom property, Atom type,
329 int format, int mode,
330 _Xconst unsigned char *data, int nelements);
331
332 void
333 XRRDeleteOutputProperty (Display *dpy, RROutput output, Atom property);
334
335 int
336 XRRGetOutputProperty (Display *dpy, RROutput output,
337 Atom property, long offset, long length,
338 Bool _delete, Bool pending, Atom req_type,
339 Atom *actual_type, int *actual_format,
340 unsigned long *nitems, unsigned long *bytes_after,
341 unsigned char **prop);
342
343 XRRModeInfo *
344 XRRAllocModeInfo (_Xconst char *name, int nameLength);
345
346 RRMode
347 XRRCreateMode (Display *dpy, Window window, XRRModeInfo *modeInfo);
348
349 void
350 XRRDestroyMode (Display *dpy, RRMode mode);
351
352 void
353 XRRAddOutputMode (Display *dpy, RROutput output, RRMode mode);
354
355 void
356 XRRDeleteOutputMode (Display *dpy, RROutput output, RRMode mode);
357
358 void
359 XRRFreeModeInfo (XRRModeInfo *modeInfo);
360
361 typedef struct _XRRCrtcInfo {
362 Time timestamp;
363 int x, y;
364 unsigned int width, height;
365 RRMode mode;
366 Rotation rotation;
367 int noutput;
368 RROutput *outputs;
369 Rotation rotations;
370 int npossible;
371 RROutput *possible;
372 } XRRCrtcInfo;
373
374 XRRCrtcInfo *
375 XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
376
377 void
378 XRRFreeCrtcInfo (XRRCrtcInfo *crtcInfo);
379
380 Status
381 XRRSetCrtcConfig (Display *dpy,
382 XRRScreenResources *resources,
383 RRCrtc crtc,
384 Time timestamp,
385 int x, int y,
386 RRMode mode,
387 Rotation rotation,
388 RROutput *outputs,
389 int noutputs);
390
391 int
392 XRRGetCrtcGammaSize (Display *dpy, RRCrtc crtc);
393
394 typedef struct _XRRCrtcGamma {
395 int size;
396 unsigned short *red;
397 unsigned short *green;
398 unsigned short *blue;
399 } XRRCrtcGamma;
400
401 XRRCrtcGamma *
402 XRRGetCrtcGamma (Display *dpy, RRCrtc crtc);
403
404 XRRCrtcGamma *
405 XRRAllocGamma (int size);
406
407 void
408 XRRSetCrtcGamma (Display *dpy, RRCrtc crtc, XRRCrtcGamma *gamma);
409
410 void
411 XRRFreeGamma (XRRCrtcGamma *gamma);
412
413 /* Version 1.3 additions */
414
415 XRRScreenResources *
416 XRRGetScreenResourcesCurrent (Display *dpy, Window window);
417
418 void
419 XRRSetCrtcTransform (Display *dpy,
420 RRCrtc crtc,
421 XTransform *transform,
422 _Xconst char *filter,
423 XFixed *params,
424 int nparams);
425
426 typedef struct _XRRCrtcTransformAttributes {
427 XTransform pendingTransform;
428 char *pendingFilter;
429 int pendingNparams;
430 XFixed *pendingParams;
431 XTransform currentTransform;
432 char *currentFilter;
433 int currentNparams;
434 XFixed *currentParams;
435 } XRRCrtcTransformAttributes;
436
437 /*
438 * Get current crtc transforms and filters.
439 * Pass *attributes to XFree to free
440 */
441 Status
442 XRRGetCrtcTransform (Display *dpy,
443 RRCrtc crtc,
444 XRRCrtcTransformAttributes **attributes);
445
446 /*
447 * intended to take RRScreenChangeNotify, or
448 * ConfigureNotify (on the root window)
449 * returns 1 if it is an event type it understands, 0 if not
450 */
451 int XRRUpdateConfiguration(XEvent *event);
452
453 typedef struct _XRRPanning {
454 Time timestamp;
455 unsigned int left;
456 unsigned int top;
457 unsigned int width;
458 unsigned int height;
459 unsigned int track_left;
460 unsigned int track_top;
461 unsigned int track_width;
462 unsigned int track_height;
463 int border_left;
464 int border_top;
465 int border_right;
466 int border_bottom;
467 } XRRPanning;
468
469 XRRPanning *
470 XRRGetPanning (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
471
472 void
473 XRRFreePanning (XRRPanning *panning);
474
475 Status
476 XRRSetPanning (Display *dpy,
477 XRRScreenResources *resources,
478 RRCrtc crtc,
479 XRRPanning *panning);
480
481 void
482 XRRSetOutputPrimary(Display *dpy,
483 Window window,
484 RROutput output);
485
486 RROutput
487 XRRGetOutputPrimary(Display *dpy,
488 Window window);
489
490 typedef struct _XRRProviderResources {
491 Time timestamp;
492 int nproviders;
493 RRProvider *providers;
494 } XRRProviderResources;
495
496 XRRProviderResources *
497 XRRGetProviderResources(Display *dpy, Window window);
498
499 void
500 XRRFreeProviderResources(XRRProviderResources *resources);
501
502 typedef struct _XRRProviderInfo {
503 unsigned int capabilities;
504 int ncrtcs;
505 RRCrtc *crtcs;
506 int noutputs;
507 RROutput *outputs;
508 char *name;
509 int nassociatedproviders;
510 RRProvider *associated_providers;
511 unsigned int *associated_capability;
512 int nameLen;
513 } XRRProviderInfo;
514
515 XRRProviderInfo *
516 XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provider);
517
518 void
519 XRRFreeProviderInfo(XRRProviderInfo *provider);
520
521 int
522 XRRSetProviderOutputSource(Display *dpy, XID provider, XID source_provider);
523
524 int
525 XRRSetProviderOffloadSink(Display *dpy, XID provider, XID sink_provider);
526
527 Atom *
528 XRRListProviderProperties (Display *dpy, RRProvider provider, int *nprop);
529
530 XRRPropertyInfo *
531 XRRQueryProviderProperty (Display *dpy, RRProvider provider, Atom property);
532
533 void
534 XRRConfigureProviderProperty (Display *dpy, RRProvider provider, Atom property,
535 Bool pending, Bool range, int num_values,
536 long *values);
537
538 void
539 XRRChangeProviderProperty (Display *dpy, RRProvider provider,
540 Atom property, Atom type,
541 int format, int mode,
542 _Xconst unsigned char *data, int nelements);
543
544 void
545 XRRDeleteProviderProperty (Display *dpy, RRProvider provider, Atom property);
546
547 int
548 XRRGetProviderProperty (Display *dpy, RRProvider provider,
549 Atom property, long offset, long length,
550 Bool _delete, Bool pending, Atom req_type,
551 Atom *actual_type, int *actual_format,
552 unsigned long *nitems, unsigned long *bytes_after,
553 unsigned char **prop);
554
555
556 typedef struct _XRRMonitorInfo {
557 Atom name;
558 Bool primary;
559 Bool automatic;
560 int noutput;
561 int x;
562 int y;
563 int width;
564 int height;
565 int mwidth;
566 int mheight;
567 RROutput *outputs;
568 } XRRMonitorInfo;
569
570 XRRMonitorInfo *
571 XRRAllocateMonitor(Display *dpy, int noutput);
572
573 XRRMonitorInfo *
574 XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors);
575
576 void
577 XRRSetMonitor(Display *dpy, Window window, XRRMonitorInfo *monitor);
578
579 void
580 XRRDeleteMonitor(Display *dpy, Window window, Atom name);
581
582 void
583 XRRFreeMonitors(XRRMonitorInfo *monitors);
584
585 _XFUNCPROTOEND
586
587 #endif /* _XRANDR_H_ */