Path: blob/master/thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h
9905 views
/*1* Copyright © 2000 Compaq Computer Corporation, Inc.2* Copyright © 2002 Hewlett-Packard Company, Inc.3* Copyright © 2006 Intel Corporation4* Copyright © 2008 Red Hat, Inc.5*6* Permission to use, copy, modify, distribute, and sell this software and its7* documentation for any purpose is hereby granted without fee, provided that8* the above copyright notice appear in all copies and that both that copyright9* notice and this permission notice appear in supporting documentation, and10* that the name of the copyright holders not be used in advertising or11* publicity pertaining to distribution of the software without specific,12* written prior permission. The copyright holders make no representations13* about the suitability of this software for any purpose. It is provided "as14* is" without express or implied warranty.15*16* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,17* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO18* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR19* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,20* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER21* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE22* OF THIS SOFTWARE.23*24* Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.25* Keith Packard, Intel Corporation26*/2728#ifndef _XRANDR_H_29#define _XRANDR_H_3031#include <X11/extensions/randr.h>32#include <X11/extensions/Xrender.h>3334#include <X11/Xfuncproto.h>3536_XFUNCPROTOBEGIN3738typedef XID RROutput;39typedef XID RRCrtc;40typedef XID RRMode;41typedef XID RRProvider;4243typedef struct {44int width, height;45int mwidth, mheight;46} XRRScreenSize;4748/*49* Events.50*/5152typedef struct {53int type; /* event base */54unsigned long serial; /* # of last request processed by server */55Bool send_event; /* true if this came from a SendEvent request */56Display *display; /* Display the event was read from */57Window window; /* window which selected for this event */58Window root; /* Root window for changed screen */59Time timestamp; /* when the screen change occurred */60Time config_timestamp; /* when the last configuration change */61SizeID size_index;62SubpixelOrder subpixel_order;63Rotation rotation;64int width;65int height;66int mwidth;67int mheight;68} XRRScreenChangeNotifyEvent;6970typedef struct {71int type; /* event base */72unsigned long serial; /* # of last request processed by server */73Bool send_event; /* true if this came from a SendEvent request */74Display *display; /* Display the event was read from */75Window window; /* window which selected for this event */76int subtype; /* RRNotify_ subtype */77} XRRNotifyEvent;7879typedef struct {80int type; /* event base */81unsigned long serial; /* # of last request processed by server */82Bool send_event; /* true if this came from a SendEvent request */83Display *display; /* Display the event was read from */84Window window; /* window which selected for this event */85int subtype; /* RRNotify_OutputChange */86RROutput output; /* affected output */87RRCrtc crtc; /* current crtc (or None) */88RRMode mode; /* current mode (or None) */89Rotation rotation; /* current rotation of associated crtc */90Connection connection; /* current connection status */91SubpixelOrder subpixel_order;92} XRROutputChangeNotifyEvent;9394typedef struct {95int type; /* event base */96unsigned long serial; /* # of last request processed by server */97Bool send_event; /* true if this came from a SendEvent request */98Display *display; /* Display the event was read from */99Window window; /* window which selected for this event */100int subtype; /* RRNotify_CrtcChange */101RRCrtc crtc; /* current crtc (or None) */102RRMode mode; /* current mode (or None) */103Rotation rotation; /* current rotation of associated crtc */104int x, y; /* position */105unsigned int width, height; /* size */106} XRRCrtcChangeNotifyEvent;107108typedef struct {109int type; /* event base */110unsigned long serial; /* # of last request processed by server */111Bool send_event; /* true if this came from a SendEvent request */112Display *display; /* Display the event was read from */113Window window; /* window which selected for this event */114int subtype; /* RRNotify_OutputProperty */115RROutput output; /* related output */116Atom property; /* changed property */117Time timestamp; /* time of change */118int state; /* NewValue, Deleted */119} XRROutputPropertyNotifyEvent;120121typedef struct {122int type; /* event base */123unsigned long serial; /* # of last request processed by server */124Bool send_event; /* true if this came from a SendEvent request */125Display *display; /* Display the event was read from */126Window window; /* window which selected for this event */127int subtype; /* RRNotify_ProviderChange */128RRProvider provider; /* current provider (or None) */129Time timestamp; /* time of change */130unsigned int current_role;131} XRRProviderChangeNotifyEvent;132133typedef struct {134int type; /* event base */135unsigned long serial; /* # of last request processed by server */136Bool send_event; /* true if this came from a SendEvent request */137Display *display; /* Display the event was read from */138Window window; /* window which selected for this event */139int subtype; /* RRNotify_ProviderProperty */140RRProvider provider; /* related provider */141Atom property; /* changed property */142Time timestamp; /* time of change */143int state; /* NewValue, Deleted */144} XRRProviderPropertyNotifyEvent;145146typedef struct {147int type; /* event base */148unsigned long serial; /* # of last request processed by server */149Bool send_event; /* true if this came from a SendEvent request */150Display *display; /* Display the event was read from */151Window window; /* window which selected for this event */152int subtype; /* RRNotify_ResourceChange */153Time timestamp; /* time of change */154} XRRResourceChangeNotifyEvent;155156/* internal representation is private to the library */157typedef struct _XRRScreenConfiguration XRRScreenConfiguration;158159Bool XRRQueryExtension (Display *dpy,160int *event_base_return,161int *error_base_return);162Status XRRQueryVersion (Display *dpy,163int *major_version_return,164int *minor_version_return);165166XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy,167Window window);168169void XRRFreeScreenConfigInfo (XRRScreenConfiguration *config);170171/*172* Note that screen configuration changes are only permitted if the client can173* prove it has up to date configuration information. We are trying to174* insist that it become possible for screens to change dynamically, so175* we want to ensure the client knows what it is talking about when requesting176* changes.177*/178Status XRRSetScreenConfig (Display *dpy,179XRRScreenConfiguration *config,180Drawable draw,181int size_index,182Rotation rotation,183Time timestamp);184185/* added in v1.1, sorry for the lame name */186Status XRRSetScreenConfigAndRate (Display *dpy,187XRRScreenConfiguration *config,188Drawable draw,189int size_index,190Rotation rotation,191short rate,192Time timestamp);193194195Rotation XRRConfigRotations(XRRScreenConfiguration *config, Rotation *current_rotation);196197Time XRRConfigTimes (XRRScreenConfiguration *config, Time *config_timestamp);198199XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes);200201short *XRRConfigRates (XRRScreenConfiguration *config, int sizeID, int *nrates);202203SizeID XRRConfigCurrentConfiguration (XRRScreenConfiguration *config,204Rotation *rotation);205206short XRRConfigCurrentRate (XRRScreenConfiguration *config);207208int XRRRootToScreen(Display *dpy, Window root);209210/*211* returns the screen configuration for the specified screen; does a lazy212* evalution to delay getting the information, and caches the result.213* These routines should be used in preference to XRRGetScreenInfo214* to avoid unneeded round trips to the X server. These are new215* in protocol version 0.1.216*/217218219void XRRSelectInput(Display *dpy, Window window, int mask);220221/*222* the following are always safe to call, even if RandR is not implemented223* on a screen224*/225226227Rotation XRRRotations(Display *dpy, int screen, Rotation *current_rotation);228XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes);229short *XRRRates (Display *dpy, int screen, int sizeID, int *nrates);230Time XRRTimes (Display *dpy, int screen, Time *config_timestamp);231232233/* Version 1.2 additions */234235/* despite returning a Status, this returns 1 for success */236Status237XRRGetScreenSizeRange (Display *dpy, Window window,238int *minWidth, int *minHeight,239int *maxWidth, int *maxHeight);240241void242XRRSetScreenSize (Display *dpy, Window window,243int width, int height,244int mmWidth, int mmHeight);245246typedef unsigned long XRRModeFlags;247248typedef struct _XRRModeInfo {249RRMode id;250unsigned int width;251unsigned int height;252unsigned long dotClock;253unsigned int hSyncStart;254unsigned int hSyncEnd;255unsigned int hTotal;256unsigned int hSkew;257unsigned int vSyncStart;258unsigned int vSyncEnd;259unsigned int vTotal;260char *name;261unsigned int nameLength;262XRRModeFlags modeFlags;263} XRRModeInfo;264265typedef struct _XRRScreenResources {266Time timestamp;267Time configTimestamp;268int ncrtc;269RRCrtc *crtcs;270int noutput;271RROutput *outputs;272int nmode;273XRRModeInfo *modes;274} XRRScreenResources;275276XRRScreenResources *277XRRGetScreenResources (Display *dpy, Window window);278279void280XRRFreeScreenResources (XRRScreenResources *resources);281282typedef struct _XRROutputInfo {283Time timestamp;284RRCrtc crtc;285char *name;286int nameLen;287unsigned long mm_width;288unsigned long mm_height;289Connection connection;290SubpixelOrder subpixel_order;291int ncrtc;292RRCrtc *crtcs;293int nclone;294RROutput *clones;295int nmode;296int npreferred;297RRMode *modes;298} XRROutputInfo;299300XRROutputInfo *301XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources, RROutput output);302303void304XRRFreeOutputInfo (XRROutputInfo *outputInfo);305306Atom *307XRRListOutputProperties (Display *dpy, RROutput output, int *nprop);308309typedef struct {310Bool pending;311Bool range;312Bool immutable;313int num_values;314long *values;315} XRRPropertyInfo;316317XRRPropertyInfo *318XRRQueryOutputProperty (Display *dpy, RROutput output, Atom property);319320void321XRRConfigureOutputProperty (Display *dpy, RROutput output, Atom property,322Bool pending, Bool range, int num_values,323long *values);324325void326XRRChangeOutputProperty (Display *dpy, RROutput output,327Atom property, Atom type,328int format, int mode,329_Xconst unsigned char *data, int nelements);330331void332XRRDeleteOutputProperty (Display *dpy, RROutput output, Atom property);333334int335XRRGetOutputProperty (Display *dpy, RROutput output,336Atom property, long offset, long length,337Bool _delete, Bool pending, Atom req_type,338Atom *actual_type, int *actual_format,339unsigned long *nitems, unsigned long *bytes_after,340unsigned char **prop);341342XRRModeInfo *343XRRAllocModeInfo (_Xconst char *name, int nameLength);344345RRMode346XRRCreateMode (Display *dpy, Window window, XRRModeInfo *modeInfo);347348void349XRRDestroyMode (Display *dpy, RRMode mode);350351void352XRRAddOutputMode (Display *dpy, RROutput output, RRMode mode);353354void355XRRDeleteOutputMode (Display *dpy, RROutput output, RRMode mode);356357void358XRRFreeModeInfo (XRRModeInfo *modeInfo);359360typedef struct _XRRCrtcInfo {361Time timestamp;362int x, y;363unsigned int width, height;364RRMode mode;365Rotation rotation;366int noutput;367RROutput *outputs;368Rotation rotations;369int npossible;370RROutput *possible;371} XRRCrtcInfo;372373XRRCrtcInfo *374XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);375376void377XRRFreeCrtcInfo (XRRCrtcInfo *crtcInfo);378379Status380XRRSetCrtcConfig (Display *dpy,381XRRScreenResources *resources,382RRCrtc crtc,383Time timestamp,384int x, int y,385RRMode mode,386Rotation rotation,387RROutput *outputs,388int noutputs);389390int391XRRGetCrtcGammaSize (Display *dpy, RRCrtc crtc);392393typedef struct _XRRCrtcGamma {394int size;395unsigned short *red;396unsigned short *green;397unsigned short *blue;398} XRRCrtcGamma;399400XRRCrtcGamma *401XRRGetCrtcGamma (Display *dpy, RRCrtc crtc);402403XRRCrtcGamma *404XRRAllocGamma (int size);405406void407XRRSetCrtcGamma (Display *dpy, RRCrtc crtc, XRRCrtcGamma *gamma);408409void410XRRFreeGamma (XRRCrtcGamma *gamma);411412/* Version 1.3 additions */413414XRRScreenResources *415XRRGetScreenResourcesCurrent (Display *dpy, Window window);416417void418XRRSetCrtcTransform (Display *dpy,419RRCrtc crtc,420XTransform *transform,421_Xconst char *filter,422XFixed *params,423int nparams);424425typedef struct _XRRCrtcTransformAttributes {426XTransform pendingTransform;427char *pendingFilter;428int pendingNparams;429XFixed *pendingParams;430XTransform currentTransform;431char *currentFilter;432int currentNparams;433XFixed *currentParams;434} XRRCrtcTransformAttributes;435436/*437* Get current crtc transforms and filters.438* Pass *attributes to XFree to free439*/440Status441XRRGetCrtcTransform (Display *dpy,442RRCrtc crtc,443XRRCrtcTransformAttributes **attributes);444445/*446* intended to take RRScreenChangeNotify, or447* ConfigureNotify (on the root window)448* returns 1 if it is an event type it understands, 0 if not449*/450int XRRUpdateConfiguration(XEvent *event);451452typedef struct _XRRPanning {453Time timestamp;454unsigned int left;455unsigned int top;456unsigned int width;457unsigned int height;458unsigned int track_left;459unsigned int track_top;460unsigned int track_width;461unsigned int track_height;462int border_left;463int border_top;464int border_right;465int border_bottom;466} XRRPanning;467468XRRPanning *469XRRGetPanning (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);470471void472XRRFreePanning (XRRPanning *panning);473474Status475XRRSetPanning (Display *dpy,476XRRScreenResources *resources,477RRCrtc crtc,478XRRPanning *panning);479480void481XRRSetOutputPrimary(Display *dpy,482Window window,483RROutput output);484485RROutput486XRRGetOutputPrimary(Display *dpy,487Window window);488489typedef struct _XRRProviderResources {490Time timestamp;491int nproviders;492RRProvider *providers;493} XRRProviderResources;494495XRRProviderResources *496XRRGetProviderResources(Display *dpy, Window window);497498void499XRRFreeProviderResources(XRRProviderResources *resources);500501typedef struct _XRRProviderInfo {502unsigned int capabilities;503int ncrtcs;504RRCrtc *crtcs;505int noutputs;506RROutput *outputs;507char *name;508int nassociatedproviders;509RRProvider *associated_providers;510unsigned int *associated_capability;511int nameLen;512} XRRProviderInfo;513514XRRProviderInfo *515XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provider);516517void518XRRFreeProviderInfo(XRRProviderInfo *provider);519520int521XRRSetProviderOutputSource(Display *dpy, XID provider, XID source_provider);522523int524XRRSetProviderOffloadSink(Display *dpy, XID provider, XID sink_provider);525526Atom *527XRRListProviderProperties (Display *dpy, RRProvider provider, int *nprop);528529XRRPropertyInfo *530XRRQueryProviderProperty (Display *dpy, RRProvider provider, Atom property);531532void533XRRConfigureProviderProperty (Display *dpy, RRProvider provider, Atom property,534Bool pending, Bool range, int num_values,535long *values);536537void538XRRChangeProviderProperty (Display *dpy, RRProvider provider,539Atom property, Atom type,540int format, int mode,541_Xconst unsigned char *data, int nelements);542543void544XRRDeleteProviderProperty (Display *dpy, RRProvider provider, Atom property);545546int547XRRGetProviderProperty (Display *dpy, RRProvider provider,548Atom property, long offset, long length,549Bool _delete, Bool pending, Atom req_type,550Atom *actual_type, int *actual_format,551unsigned long *nitems, unsigned long *bytes_after,552unsigned char **prop);553554555typedef struct _XRRMonitorInfo {556Atom name;557Bool primary;558Bool automatic;559int noutput;560int x;561int y;562int width;563int height;564int mwidth;565int mheight;566RROutput *outputs;567} XRRMonitorInfo;568569XRRMonitorInfo *570XRRAllocateMonitor(Display *dpy, int noutput);571572XRRMonitorInfo *573XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors);574575void576XRRSetMonitor(Display *dpy, Window window, XRRMonitorInfo *monitor);577578void579XRRDeleteMonitor(Display *dpy, Window window, Atom name);580581void582XRRFreeMonitors(XRRMonitorInfo *monitors);583584_XFUNCPROTOEND585586#endif /* _XRANDR_H_ */587588589