1*cdf0e10cSrcweir /* 2*cdf0e10cSrcweir * $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.9 2002/09/29 23:39:44 keithp Exp $ 3*cdf0e10cSrcweir * 4*cdf0e10cSrcweir * Copyright © 2000 Compaq Computer Corporation, Inc. 5*cdf0e10cSrcweir * Copyright © 2002 Hewlett-Packard Company, Inc. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * Permission to use, copy, modify, distribute, and sell this software and its 8*cdf0e10cSrcweir * documentation for any purpose is hereby granted without fee, provided that 9*cdf0e10cSrcweir * the above copyright notice appear in all copies and that both that 10*cdf0e10cSrcweir * copyright notice and this permission notice appear in supporting 11*cdf0e10cSrcweir * documentation, and that the name of Compaq not be used in advertising or 12*cdf0e10cSrcweir * publicity pertaining to distribution of the software without specific, 13*cdf0e10cSrcweir * written prior permission. HP makes no representations about the 14*cdf0e10cSrcweir * suitability of this software for any purpose. It is provided "as is" 15*cdf0e10cSrcweir * without express or implied warranty. 16*cdf0e10cSrcweir * 17*cdf0e10cSrcweir * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 18*cdf0e10cSrcweir * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ 19*cdf0e10cSrcweir * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 20*cdf0e10cSrcweir * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 21*cdf0e10cSrcweir * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 22*cdf0e10cSrcweir * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 23*cdf0e10cSrcweir * 24*cdf0e10cSrcweir * Author: Jim Gettys, HP Labs, HP. 25*cdf0e10cSrcweir */ 26*cdf0e10cSrcweir 27*cdf0e10cSrcweir #ifndef _XRANDR_H_ 28*cdf0e10cSrcweir #define _XRANDR_H_ 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include <X11/extensions/randr.h> 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <X11/Xfuncproto.h> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir _XFUNCPROTOBEGIN 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir typedef struct { 38*cdf0e10cSrcweir int width, height; 39*cdf0e10cSrcweir int mwidth, mheight; 40*cdf0e10cSrcweir } XRRScreenSize; 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir /* 43*cdf0e10cSrcweir * Events. 44*cdf0e10cSrcweir */ 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir typedef struct { 47*cdf0e10cSrcweir int type; /* event base */ 48*cdf0e10cSrcweir unsigned long serial; /* # of last request processed by server */ 49*cdf0e10cSrcweir Bool send_event; /* true if this came from a SendEvent request */ 50*cdf0e10cSrcweir Display *display; /* Display the event was read from */ 51*cdf0e10cSrcweir Window window; /* window which selected for this event */ 52*cdf0e10cSrcweir Window root; /* Root window for changed screen */ 53*cdf0e10cSrcweir Time timestamp; /* when the screen change occurred */ 54*cdf0e10cSrcweir Time config_timestamp; /* when the last configuration change */ 55*cdf0e10cSrcweir SizeID size_index; 56*cdf0e10cSrcweir SubpixelOrder subpixel_order; 57*cdf0e10cSrcweir Rotation rotation; 58*cdf0e10cSrcweir int width; 59*cdf0e10cSrcweir int height; 60*cdf0e10cSrcweir int mwidth; 61*cdf0e10cSrcweir int mheight; 62*cdf0e10cSrcweir } XRRScreenChangeNotifyEvent; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir /* internal representation is private to the library */ 66*cdf0e10cSrcweir typedef struct _XRRScreenConfiguration XRRScreenConfiguration; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir Bool XRRQueryExtension (Display *dpy, int *event_basep, int *error_basep); 69*cdf0e10cSrcweir Status XRRQueryVersion (Display *dpy, 70*cdf0e10cSrcweir int *major_versionp, 71*cdf0e10cSrcweir int *minor_versionp); 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy, 74*cdf0e10cSrcweir Drawable draw); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir void XRRFreeScreenConfigInfo (XRRScreenConfiguration *config); 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir /* 79*cdf0e10cSrcweir * Note that screen configuration changes are only permitted if the client can 80*cdf0e10cSrcweir * prove it has up to date configuration information. We are trying to 81*cdf0e10cSrcweir * insist that it become possible for screens to change dynamically, so 82*cdf0e10cSrcweir * we want to ensure the client knows what it is talking about when requesting 83*cdf0e10cSrcweir * changes. 84*cdf0e10cSrcweir */ 85*cdf0e10cSrcweir Status XRRSetScreenConfig (Display *dpy, 86*cdf0e10cSrcweir XRRScreenConfiguration *config, 87*cdf0e10cSrcweir Drawable draw, 88*cdf0e10cSrcweir int size_index, 89*cdf0e10cSrcweir Rotation rotation, 90*cdf0e10cSrcweir Time timestamp); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir /* added in v1.1, sorry for the lame name */ 93*cdf0e10cSrcweir Status XRRSetScreenConfigAndRate (Display *dpy, 94*cdf0e10cSrcweir XRRScreenConfiguration *config, 95*cdf0e10cSrcweir Drawable draw, 96*cdf0e10cSrcweir int size_index, 97*cdf0e10cSrcweir Rotation rotation, 98*cdf0e10cSrcweir short rate, 99*cdf0e10cSrcweir Time timestamp); 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir Rotation XRRConfigRotations(XRRScreenConfiguration *config, Rotation *current_rotation); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir Time XRRConfigTimes (XRRScreenConfiguration *config, Time *config_timestamp); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir short *XRRConfigRates (XRRScreenConfiguration *config, int sizeID, int *nrates); 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir SizeID XRRConfigCurrentConfiguration (XRRScreenConfiguration *config, 111*cdf0e10cSrcweir Rotation *rotation); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir short XRRConfigCurrentRate (XRRScreenConfiguration *config); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir int XRRRootToScreen(Display *dpy, Window root); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir /* 118*cdf0e10cSrcweir * returns the screen configuration for the specified screen; does a lazy 119*cdf0e10cSrcweir * evalution to delay getting the information, and caches the result. 120*cdf0e10cSrcweir * These routines should be used in preference to XRRGetScreenInfo 121*cdf0e10cSrcweir * to avoid unneeded round trips to the X server. These are new 122*cdf0e10cSrcweir * in protocol version 0.1. 123*cdf0e10cSrcweir */ 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir XRRScreenConfiguration *XRRScreenConfig(Display *dpy, int screen); 127*cdf0e10cSrcweir XRRScreenConfiguration *XRRConfig(Screen *screen); 128*cdf0e10cSrcweir void XRRSelectInput(Display *dpy, Window window, int mask); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir /* 131*cdf0e10cSrcweir * the following are always safe to call, even if RandR is not implemented 132*cdf0e10cSrcweir * on a screen 133*cdf0e10cSrcweir */ 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir Rotation XRRRotations(Display *dpy, int screen, Rotation *current_rotation); 137*cdf0e10cSrcweir XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes); 138*cdf0e10cSrcweir short *XRRRates (Display *dpy, int screen, int sizeID, int *nrates); 139*cdf0e10cSrcweir Time XRRTimes (Display *dpy, int screen, Time *config_timestamp); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir /* 143*cdf0e10cSrcweir * intended to take RRScreenChangeNotify, or 144*cdf0e10cSrcweir * ConfigureNotify (on the root window) 145*cdf0e10cSrcweir * returns 1 if it is an event type it understands, 0 if not 146*cdf0e10cSrcweir */ 147*cdf0e10cSrcweir int XRRUpdateConfiguration(XEvent *event); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir _XFUNCPROTOEND 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir #endif /* _XRANDR_H_ */ 152