1/* 2 * Copyright © 2013 Keith Packard 3 * 4 * Permission to use, copy, modify, distribute, and sell this software and its 5 * documentation for any purpose is hereby granted without fee, provided that 6 * the above copyright notice appear in all copies and that both that copyright 7 * notice and this permission notice appear in supporting documentation, and 8 * that the name of the copyright holders not be used in advertising or 9 * publicity pertaining to distribution of the software without specific, 10 * written prior permission. The copyright holders make no representations 11 * about the suitability of this software for any purpose. It is provided "as 12 * is" without express or implied warranty. 13 * 14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 20 * OF THIS SOFTWARE. 21 */ 22 23#ifndef _XPRESENT_H_ 24#define _XPRESENT_H_ 25 26#include <stdint.h> 27#include <X11/extensions/presenttokens.h> 28 29#include <X11/Xfuncproto.h> 30#include <X11/Xlib.h> 31#include <X11/extensions/Xfixes.h> 32#include <X11/extensions/Xrandr.h> 33#include <X11/extensions/sync.h> 34 35/* 36 * This revision number also appears in configure.ac, they have 37 * to be manually synchronized 38 */ 39#define PRESENT_REVISION 0 40#define PRESENT_VERSION ((PRESENT_MAJOR * 10000) + (PRESENT_MINOR * 100) + (PRESENT_REVISION)) 41 42/** 43 * Generic Present event. All Present events have the same header. 44 */ 45 46typedef struct { 47 Window window; 48 uint32_t serial; 49} XPresentNotify; 50 51typedef struct { 52 int type; /* event base */ 53 unsigned long serial; 54 Bool send_event; 55 Display *display; 56 int extension; 57 int evtype; 58} XPresentEvent; 59 60typedef struct { 61 int type; /* event base */ 62 unsigned long serial; 63 Bool send_event; 64 Display *display; 65 int extension; 66 int evtype; 67 68 uint32_t eid; 69 Window window; 70 int x,y; 71 unsigned width, height; 72 int off_x, off_y; 73 int pixmap_width, pixmap_height; 74 long pixmap_flags; 75} XPresentConfigureNotifyEvent; 76 77typedef struct { 78 int type; /* event base */ 79 unsigned long serial; 80 Bool send_event; 81 Display *display; 82 int extension; 83 int evtype; 84 85 uint32_t eid; 86 Window window; 87 uint32_t serial_number; 88 uint64_t ust; 89 uint64_t msc; 90 uint8_t kind; 91 uint8_t mode; 92} XPresentCompleteNotifyEvent; 93 94typedef struct { 95 int type; /* event base */ 96 unsigned long serial; 97 Bool send_event; 98 Display *display; 99 int extension; 100 int evtype; 101 102 uint32_t eid; 103 Window window; 104 uint32_t serial_number; 105 Pixmap pixmap; 106 XSyncFence idle_fence; 107} XPresentIdleNotifyEvent; 108 109#if PRESENT_FUTURE_VERSION 110 111typedef struct { 112 int type; /* event base */ 113 unsigned long serial; 114 Bool send_event; 115 Display *display; 116 int extension; 117 int evtype; 118 119 uint32_t eid; 120 Window event_window; 121 122 Window window; 123 Pixmap pixmap; 124 uint32_t serial_number; 125 126 XserverRegion valid_region; 127 XserverRegion update_region; 128 129 XRectangle valid_rect; 130 XRectangle update_rect; 131 132 int x_off, y_off; 133 134 RRCrtc target_crtc; 135 136 XSyncFence wait_fence; 137 XSyncFence idle_fence; 138 139 uint32_t options; 140 141 uint64_t target_msc; 142 uint64_t divisor; 143 uint64_t remainder; 144 XPresentNotify *notifies; 145 int nnotifies; 146} XPresentRedirectNotifyEvent; 147 148#endif 149 150_XFUNCPROTOBEGIN 151 152Bool XPresentQueryExtension (Display *dpy, 153 int *major_opcode_return, 154 int *event_base_return, 155 int *error_base_return); 156 157Status XPresentQueryVersion (Display *dpy, 158 int *major_version_return, 159 int *minor_version_return); 160 161int XPresentVersion (void); 162 163void 164XPresentPixmap(Display *dpy, 165 Window window, 166 Pixmap pixmap, 167 uint32_t serial, 168 XserverRegion valid, 169 XserverRegion update, 170 int x_off, 171 int y_off, 172 RRCrtc target_crtc, 173 XSyncFence wait_fence, 174 XSyncFence idle_fence, 175 uint32_t options, 176 uint64_t target_msc, 177 uint64_t divisor, 178 uint64_t remainder, 179 XPresentNotify *notifies, 180 int nnotifies); 181 182void 183XPresentNotifyMSC(Display *dpy, 184 Window window, 185 uint32_t serial, 186 uint64_t target_msc, 187 uint64_t divisor, 188 uint64_t remainder); 189 190XID 191XPresentSelectInput(Display *dpy, 192 Window window, 193 unsigned event_mask); 194 195void 196XPresentFreeInput(Display *dpy, 197 Window window, 198 XID event_id); 199 200uint32_t 201XPresentQueryCapabilities(Display *dpy, 202 XID target); 203 204_XFUNCPROTOEND 205 206#endif /* _XPRESENT_H_ */ 207