Debian Codegraph @

include/X11/extensions/Xrandr.h

raw
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 * evaluation 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 Status
237 XRRGetScreenSizeRange (Display *dpy, Window window,
238 int *minWidth, int *minHeight,
239 int *maxWidth, int *maxHeight);
240
241 void
242 XRRSetScreenSize (Display *dpy, Window window,
243 int width, int height,
244 int mmWidth, int mmHeight);
245
246 typedef unsigned long XRRModeFlags;
247
248 typedef struct _XRRModeInfo {
249 RRMode id;
250 unsigned int width;
251 unsigned int height;
252 unsigned long dotClock;
253 unsigned int hSyncStart;
254 unsigned int hSyncEnd;
255 unsigned int hTotal;
256 unsigned int hSkew;
257 unsigned int vSyncStart;
258 unsigned int vSyncEnd;
259 unsigned int vTotal;
260 char *name;
261 unsigned int nameLength;
262 XRRModeFlags modeFlags;
263 } XRRModeInfo;
264
265 typedef struct _XRRScreenResources {
266 Time timestamp;
267 Time configTimestamp;
268 int ncrtc;
269 RRCrtc *crtcs;
270 int noutput;
271 RROutput *outputs;
272 int nmode;
273 XRRModeInfo *modes;
274 } XRRScreenResources;
275
276 XRRScreenResources *
277 XRRGetScreenResources (Display *dpy, Window window);
278
279 void
280 XRRFreeScreenResources (XRRScreenResources *resources);
281
282 typedef struct _XRROutputInfo {
283 Time timestamp;
284 RRCrtc crtc;
285 char *name;
286 int nameLen;
287 unsigned long mm_width;
288 unsigned long mm_height;
289 Connection connection;
290 SubpixelOrder subpixel_order;
291 int ncrtc;
292 RRCrtc *crtcs;
293 int nclone;
294 RROutput *clones;
295 int nmode;
296 int npreferred;
297 RRMode *modes;
298 } XRROutputInfo;
299
300 XRROutputInfo *
301 XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources, RROutput output);
302
303 void
304 XRRFreeOutputInfo (XRROutputInfo *outputInfo);
305
306 Atom *
307 XRRListOutputProperties (Display *dpy, RROutput output, int *nprop);
308
309 typedef struct {
310 Bool pending;
311 Bool range;
312 Bool immutable;
313 int num_values;
314 long *values;
315 } XRRPropertyInfo;
316
317 XRRPropertyInfo *
318 XRRQueryOutputProperty (Display *dpy, RROutput output, Atom property);
319
320 void
321 XRRConfigureOutputProperty (Display *dpy, RROutput output, Atom property,
322 Bool pending, Bool range, int num_values,
323 long *values);
324
325 void
326 XRRChangeOutputProperty (Display *dpy, RROutput output,
327 Atom property, Atom type,
328 int format, int mode,
329 _Xconst unsigned char *data, int nelements);
330
331 void
332 XRRDeleteOutputProperty (Display *dpy, RROutput output, Atom property);
333
334 int
335 XRRGetOutputProperty (Display *dpy, RROutput output,
336 Atom property, long offset, long length,
337 Bool _delete, Bool pending, Atom req_type,
338 Atom *actual_type, int *actual_format,
339 unsigned long *nitems, unsigned long *bytes_after,
340 unsigned char **prop);
341
342 XRRModeInfo *
343 XRRAllocModeInfo (_Xconst char *name, int nameLength);
344
345 RRMode
346 XRRCreateMode (Display *dpy, Window window, XRRModeInfo *modeInfo);
347
348 void
349 XRRDestroyMode (Display *dpy, RRMode mode);
350
351 void
352 XRRAddOutputMode (Display *dpy, RROutput output, RRMode mode);
353
354 void
355 XRRDeleteOutputMode (Display *dpy, RROutput output, RRMode mode);
356
357 void
358 XRRFreeModeInfo (XRRModeInfo *modeInfo);
359
360 typedef struct _XRRCrtcInfo {
361 Time timestamp;
362 int x, y;
363 unsigned int width, height;
364 RRMode mode;
365 Rotation rotation;
366 int noutput;
367 RROutput *outputs;
368 Rotation rotations;
369 int npossible;
370 RROutput *possible;
371 } XRRCrtcInfo;
372
373 XRRCrtcInfo *
374 XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
375
376 void
377 XRRFreeCrtcInfo (XRRCrtcInfo *crtcInfo);
378
379 Status
380 XRRSetCrtcConfig (Display *dpy,
381 XRRScreenResources *resources,
382 RRCrtc crtc,
383 Time timestamp,
384 int x, int y,
385 RRMode mode,
386 Rotation rotation,
387 RROutput *outputs,
388 int noutputs);
389
390 int
391 XRRGetCrtcGammaSize (Display *dpy, RRCrtc crtc);
392
393 typedef struct _XRRCrtcGamma {
394 int size;
395 unsigned short *red;
396 unsigned short *green;
397 unsigned short *blue;
398 } XRRCrtcGamma;
399
400 XRRCrtcGamma *
401 XRRGetCrtcGamma (Display *dpy, RRCrtc crtc);
402
403 XRRCrtcGamma *
404 XRRAllocGamma (int size);
405
406 void
407 XRRSetCrtcGamma (Display *dpy, RRCrtc crtc, XRRCrtcGamma *gamma);
408
409 void
410 XRRFreeGamma (XRRCrtcGamma *gamma);
411
412 /* Version 1.3 additions */
413
414 XRRScreenResources *
415 XRRGetScreenResourcesCurrent (Display *dpy, Window window);
416
417 void
418 XRRSetCrtcTransform (Display *dpy,
419 RRCrtc crtc,
420 XTransform *transform,
421 _Xconst char *filter,
422 XFixed *params,
423 int nparams);
424
425 typedef struct _XRRCrtcTransformAttributes {
426 XTransform pendingTransform;
427 char *pendingFilter;
428 int pendingNparams;
429 XFixed *pendingParams;
430 XTransform currentTransform;
431 char *currentFilter;
432 int currentNparams;
433 XFixed *currentParams;
434 } XRRCrtcTransformAttributes;
435
436 /*
437 * Get current crtc transforms and filters.
438 * Pass *attributes to XFree to free
439 */
440 Status
441 XRRGetCrtcTransform (Display *dpy,
442 RRCrtc crtc,
443 XRRCrtcTransformAttributes **attributes);
444
445 /*
446 * intended to take RRScreenChangeNotify, or
447 * ConfigureNotify (on the root window)
448 * returns 1 if it is an event type it understands, 0 if not
449 */
450 int XRRUpdateConfiguration(XEvent *event);
451
452 typedef struct _XRRPanning {
453 Time timestamp;
454 unsigned int left;
455 unsigned int top;
456 unsigned int width;
457 unsigned int height;
458 unsigned int track_left;
459 unsigned int track_top;
460 unsigned int track_width;
461 unsigned int track_height;
462 int border_left;
463 int border_top;
464 int border_right;
465 int border_bottom;
466 } XRRPanning;
467
468 XRRPanning *
469 XRRGetPanning (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
470
471 void
472 XRRFreePanning (XRRPanning *panning);
473
474 Status
475 XRRSetPanning (Display *dpy,
476 XRRScreenResources *resources,
477 RRCrtc crtc,
478 XRRPanning *panning);
479
480 void
481 XRRSetOutputPrimary(Display *dpy,
482 Window window,
483 RROutput output);
484
485 RROutput
486 XRRGetOutputPrimary(Display *dpy,
487 Window window);
488
489 typedef struct _XRRProviderResources {
490 Time timestamp;
491 int nproviders;
492 RRProvider *providers;
493 } XRRProviderResources;
494
495 XRRProviderResources *
496 XRRGetProviderResources(Display *dpy, Window window);
497
498 void
499 XRRFreeProviderResources(XRRProviderResources *resources);
500
501 typedef struct _XRRProviderInfo {
502 unsigned int capabilities;
503 int ncrtcs;
504 RRCrtc *crtcs;
505 int noutputs;
506 RROutput *outputs;
507 char *name;
508 int nassociatedproviders;
509 RRProvider *associated_providers;
510 unsigned int *associated_capability;
511 int nameLen;
512 } XRRProviderInfo;
513
514 XRRProviderInfo *
515 XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provider);
516
517 void
518 XRRFreeProviderInfo(XRRProviderInfo *provider);
519
520 int
521 XRRSetProviderOutputSource(Display *dpy, XID provider, XID source_provider);
522
523 int
524 XRRSetProviderOffloadSink(Display *dpy, XID provider, XID sink_provider);
525
526 Atom *
527 XRRListProviderProperties (Display *dpy, RRProvider provider, int *nprop);
528
529 XRRPropertyInfo *
530 XRRQueryProviderProperty (Display *dpy, RRProvider provider, Atom property);
531
532 void
533 XRRConfigureProviderProperty (Display *dpy, RRProvider provider, Atom property,
534 Bool pending, Bool range, int num_values,
535 long *values);
536
537 void
538 XRRChangeProviderProperty (Display *dpy, RRProvider provider,
539 Atom property, Atom type,
540 int format, int mode,
541 _Xconst unsigned char *data, int nelements);
542
543 void
544 XRRDeleteProviderProperty (Display *dpy, RRProvider provider, Atom property);
545
546 int
547 XRRGetProviderProperty (Display *dpy, RRProvider provider,
548 Atom property, long offset, long length,
549 Bool _delete, Bool pending, Atom req_type,
550 Atom *actual_type, int *actual_format,
551 unsigned long *nitems, unsigned long *bytes_after,
552 unsigned char **prop);
553
554
555 typedef struct _XRRMonitorInfo {
556 Atom name;
557 Bool primary;
558 Bool automatic;
559 int noutput;
560 int x;
561 int y;
562 int width;
563 int height;
564 int mwidth;
565 int mheight;
566 RROutput *outputs;
567 } XRRMonitorInfo;
568
569 XRRMonitorInfo *
570 XRRAllocateMonitor(Display *dpy, int noutput);
571
572 XRRMonitorInfo *
573 XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors);
574
575 void
576 XRRSetMonitor(Display *dpy, Window window, XRRMonitorInfo *monitor);
577
578 void
579 XRRDeleteMonitor(Display *dpy, Window window, Atom name);
580
581 void
582 XRRFreeMonitors(XRRMonitorInfo *monitors);
583
584 _XFUNCPROTOEND
585
586 #endif /* _XRANDR_H_ */