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