| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 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 | |
| 51 | |
| 52 | |
| 53 | typedef struct { |
| 54 | int type; |
| 55 | unsigned long serial; |
| 56 | Bool send_event; |
| 57 | Display *display; |
| 58 | Window window; |
| 59 | Window root; |
| 60 | Time timestamp; |
| 61 | Time config_timestamp; |
| 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; |
| 73 | unsigned long serial; |
| 74 | Bool send_event; |
| 75 | Display *display; |
| 76 | Window window; |
| 77 | int subtype; |
| 78 | } XRRNotifyEvent; |
| 79 | |
| 80 | typedef struct { |
| 81 | int type; |
| 82 | unsigned long serial; |
| 83 | Bool send_event; |
| 84 | Display *display; |
| 85 | Window window; |
| 86 | int subtype; |
| 87 | RROutput output; |
| 88 | RRCrtc crtc; |
| 89 | RRMode mode; |
| 90 | Rotation rotation; |
| 91 | Connection connection; |
| 92 | SubpixelOrder subpixel_order; |
| 93 | } XRROutputChangeNotifyEvent; |
| 94 | |
| 95 | typedef struct { |
| 96 | int type; |
| 97 | unsigned long serial; |
| 98 | Bool send_event; |
| 99 | Display *display; |
| 100 | Window window; |
| 101 | int subtype; |
| 102 | RRCrtc crtc; |
| 103 | RRMode mode; |
| 104 | Rotation rotation; |
| 105 | int x, y; |
| 106 | unsigned int width, height; |
| 107 | } XRRCrtcChangeNotifyEvent; |
| 108 | |
| 109 | typedef struct { |
| 110 | int type; |
| 111 | unsigned long serial; |
| 112 | Bool send_event; |
| 113 | Display *display; |
| 114 | Window window; |
| 115 | int subtype; |
| 116 | RROutput output; |
| 117 | Atom property; |
| 118 | Time timestamp; |
| 119 | int state; |
| 120 | } XRROutputPropertyNotifyEvent; |
| 121 | |
| 122 | typedef struct { |
| 123 | int type; |
| 124 | unsigned long serial; |
| 125 | Bool send_event; |
| 126 | Display *display; |
| 127 | Window window; |
| 128 | int subtype; |
| 129 | RRProvider provider; |
| 130 | Time timestamp; |
| 131 | unsigned int current_role; |
| 132 | } XRRProviderChangeNotifyEvent; |
| 133 | |
| 134 | typedef struct { |
| 135 | int type; |
| 136 | unsigned long serial; |
| 137 | Bool send_event; |
| 138 | Display *display; |
| 139 | Window window; |
| 140 | int subtype; |
| 141 | RRProvider provider; |
| 142 | Atom property; |
| 143 | Time timestamp; |
| 144 | int state; |
| 145 | } XRRProviderPropertyNotifyEvent; |
| 146 | |
| 147 | typedef struct { |
| 148 | int type; |
| 149 | unsigned long serial; |
| 150 | Bool send_event; |
| 151 | Display *display; |
| 152 | Window window; |
| 153 | int subtype; |
| 154 | Time timestamp; |
| 155 | } XRRResourceChangeNotifyEvent; |
| 156 | |
| 157 | |
| 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 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | Status XRRSetScreenConfig (Display *dpy, |
| 180 | XRRScreenConfiguration *config, |
| 181 | Drawable draw, |
| 182 | int size_index, |
| 183 | Rotation rotation, |
| 184 | Time timestamp); |
| 185 | |
| 186 | |
| 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 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | void XRRSelectInput(Display *dpy, Window window, int mask); |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 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 | |
| 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 | |
| 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 | |
| 438 | |
| 439 | |
| 440 | Status |
| 441 | XRRGetCrtcTransform (Display *dpy, |
| 442 | RRCrtc crtc, |
| 443 | XRRCrtcTransformAttributes **attributes); |
| 444 | |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 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 |