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