Xrandrint.h revision 8c4a8e55
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#define NEED_EVENTS
29#define NEED_REPLIES
30#include <X11/Xlibint.h>
31#include <X11/Xutil.h>
32#include <X11/extensions/Xext.h>
33#include <X11/extensions/extutil.h>
34#include "Xrandr.h"
35#include <X11/extensions/randr.h>
36#include <X11/extensions/randrproto.h>
37
38extern char XRRExtensionName[];
39
40#define RRCheckExtension(dpy,i,val) \
41  XextCheckExtension (dpy, i, XRRExtensionName, val)
42#define RRSimpleCheckExtension(dpy,i) \
43  XextSimpleCheckExtension (dpy, i, XRRExtensionName)
44
45XExtDisplayInfo *XRRFindDisplay (Display *dpy);
46
47
48/* deliberately opaque internal data structure; can be extended,
49   but not reordered */
50struct _XRRScreenConfiguration {
51  Screen *screen;	/* the root window in GetScreenInfo */
52  XRRScreenSize *sizes;
53  Rotation rotations;
54  Rotation current_rotation;
55  int nsizes;
56  int current_size;
57  short current_rate;
58  Time timestamp;
59  Time config_timestamp;
60  int subpixel_order;	/* introduced in randr v0.1 */
61  short *rates;		/* introduced in randr v1.1 */
62  int nrates;
63};
64
65/*
66 * if a configure notify on the root is recieved, or
67 * an XRRScreenChangeNotify is recieved,
68 * XRRUpdateConfiguration should be called to update the X library's
69 * view of the screen configuration; it will also invalidate the cache
70 * provided by XRRScreenConfig and XRRConfig, and force a round trip
71 * when next used.  Returns invalid status if not an event type
72 * the library routine understand.
73 */
74
75/* we cache one screen configuration/screen */
76
77typedef struct _XRandRInfo {
78  XRRScreenConfiguration **config;
79  int major_version, minor_version;	/* major_version = -1 means we don't know */
80  Bool has_rates;			/* Server supports refresh rates */
81} XRandRInfo;
82
83typedef struct _randrVersionState {
84    unsigned long   version_seq;
85    Bool	    error;
86    int		    major_version;
87    int		    minor_version;
88} _XRRVersionState;
89
90Bool
91_XRRVersionHandler (Display	*dpy,
92		    xReply	*rep,
93		    char	*buf,
94		    int		len,
95		    XPointer    data);
96
97_X_HIDDEN Bool
98_XRRHasRates (int major, int minor);
99
100#endif /* _XRANDRINT_H_ */
101