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