Xrandrint.h revision 8bd17e5f
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 36extern 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 43XExtDisplayInfo *XRRFindDisplay (Display *dpy); 44 45#ifndef HAVE__XEATDATAWORDS 46#include <X11/Xmd.h> /* for LONG64 on 64-bit platforms */ 47#include <limits.h> 48 49static inline void _XEatDataWords(Display *dpy, unsigned long n) 50{ 51# ifndef LONG64 52 if (n >= (ULONG_MAX >> 2)) 53 _XIOError(dpy); 54# endif 55 _XEatData (dpy, n << 2); 56} 57#endif 58 59/* deliberately opaque internal data structure; can be extended, 60 but not reordered */ 61struct _XRRScreenConfiguration { 62 Screen *screen; /* the root window in GetScreenInfo */ 63 XRRScreenSize *sizes; 64 Rotation rotations; 65 Rotation current_rotation; 66 int nsizes; 67 int current_size; 68 short current_rate; 69 Time timestamp; 70 Time config_timestamp; 71 int subpixel_order; /* introduced in randr v0.1 */ 72 short *rates; /* introduced in randr v1.1 */ 73 int nrates; 74}; 75 76/* 77 * if a configure notify on the root is recieved, or 78 * an XRRScreenChangeNotify is recieved, 79 * XRRUpdateConfiguration should be called to update the X library's 80 * view of the screen configuration; it will also invalidate the cache 81 * provided by XRRScreenConfig and XRRConfig, and force a round trip 82 * when next used. Returns invalid status if not an event type 83 * the library routine understand. 84 */ 85 86/* we cache one screen configuration/screen */ 87 88typedef struct _XRandRInfo { 89 XRRScreenConfiguration **config; 90 int major_version, minor_version; /* major_version = -1 means we don't know */ 91 Bool has_rates; /* Server supports refresh rates */ 92} XRandRInfo; 93 94typedef struct _randrVersionState { 95 unsigned long version_seq; 96 Bool error; 97 int major_version; 98 int minor_version; 99} _XRRVersionState; 100 101Bool 102_XRRVersionHandler (Display *dpy, 103 xReply *rep, 104 char *buf, 105 int len, 106 XPointer data); 107 108_X_HIDDEN Bool 109_XRRHasRates (int major, int minor); 110 111#endif /* _XRANDRINT_H_ */ 112