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