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