7fb5831ef450149a49051415691830d352c19ef6
[framework/uifw/xorg/lib/libxrandr.git] / src / Xrandrint.h
1 /*
2  * Copyright © 2000, Compaq Computer Corporation, 
3  * Copyright © 2002, Hewlett Packard, Inc.
4  *
5  * Permission to use, copy, modify, distribute, and sell this software and its
6  * documentation for any purpose is hereby granted without fee, provided that
7  * the above copyright notice appear in all copies and that both that
8  * copyright notice and this permission notice appear in supporting
9  * documentation, and that the name of Compaq or HP not be used in advertising
10  * or publicity pertaining to distribution of the software without specific,
11  * written prior permission.  HP makes no representations about the
12  * suitability of this software for any purpose.  It is provided "as is"
13  * without express or implied warranty.
14  *
15  * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
17  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
19  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
20  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  *
22  * Author:  Jim Gettys, HP Labs, Hewlett-Packard, Inc.
23  */
24
25 #ifndef _XRANDRINT_H_
26 #define _XRANDRINT_H_
27
28 #include <X11/Xlibint.h>
29 #include <X11/Xutil.h>
30 #include <X11/extensions/Xext.h>
31 #include <X11/extensions/extutil.h>
32 #include "Xrandr.h"
33 #include <X11/extensions/randr.h>
34 #include <X11/extensions/randrproto.h>
35
36 extern char XRRExtensionName[];
37
38 #define RRCheckExtension(dpy,i,val) \
39   XextCheckExtension (dpy, i, XRRExtensionName, val)
40 #define RRSimpleCheckExtension(dpy,i) \
41   XextSimpleCheckExtension (dpy, i, XRRExtensionName)
42
43 XExtDisplayInfo *XRRFindDisplay (Display *dpy);
44
45
46 /* deliberately opaque internal data structure; can be extended, 
47    but not reordered */
48 struct _XRRScreenConfiguration {
49   Screen *screen;       /* the root window in GetScreenInfo */
50   XRRScreenSize *sizes;
51   Rotation rotations;
52   Rotation current_rotation;
53   int nsizes;
54   int current_size;
55   short current_rate;
56   Time timestamp;
57   Time config_timestamp;
58   int subpixel_order;   /* introduced in randr v0.1 */
59   short *rates;         /* introduced in randr v1.1 */
60   int nrates;
61 };
62
63 /*
64  * if a configure notify on the root is recieved, or
65  * an XRRScreenChangeNotify is recieved,
66  * XRRUpdateConfiguration should be called to update the X library's
67  * view of the screen configuration; it will also invalidate the cache
68  * provided by XRRScreenConfig and XRRConfig, and force a round trip
69  * when next used.  Returns invalid status if not an event type
70  * the library routine understand.
71  */
72  
73 /* we cache one screen configuration/screen */
74
75 typedef struct _XRandRInfo {
76   XRRScreenConfiguration **config;
77   int major_version, minor_version;     /* major_version = -1 means we don't know */
78   Bool has_rates;                       /* Server supports refresh rates */
79 } XRandRInfo;
80
81 typedef struct _randrVersionState {
82     unsigned long   version_seq;
83     Bool            error;
84     int             major_version;
85     int             minor_version;
86 } _XRRVersionState;
87
88 Bool
89 _XRRVersionHandler (Display     *dpy,
90                     xReply      *rep,
91                     char        *buf,
92                     int         len,
93                     XPointer    data);
94
95 _X_HIDDEN Bool
96 _XRRHasRates (int major, int minor);
97
98 #endif /* _XRANDRINT_H_ */