1 /* 2 3 Copyright 1987, 1998 The Open Group 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. 10 11 The above copyright notice and this permission notice shall be included in 12 all copies or substantial portions of the Software. 13 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21 Except as contained in this notice, the name of The Open Group shall not be 22 used in advertising or otherwise to promote the sale, use or other dealings 23 in this Software without prior written authorization from The Open Group. 24 25 */ 26 27 #ifdef HAVE_CONFIG_H 28 #include <config.h> 29 #endif 30 #include "Xlibint.h" 31 #define XUTIL_DEFINE_FUNCTIONS 32 #include "Xutil.h" 33 #include "Xxcbint.h" 34 35 /* 36 * This file makes full definitions of routines for each macro. 37 * We do not expect C programs to use these, but other languages may 38 * need them. 39 */ 40 41 int XConnectionNumber(Display *dpy) { return (ConnectionNumber(dpy)); } 42 43 Window XRootWindow (Display *dpy, int scr) 44 { 45 return (RootWindow(dpy,scr)); 46 } 47 48 int XDefaultScreen(Display *dpy) { return (DefaultScreen(dpy)); } 49 50 Window XDefaultRootWindow (Display *dpy) 51 { 52 return (RootWindow(dpy,DefaultScreen(dpy))); 53 } 54 55 Visual *XDefaultVisual(Display *dpy, int scr) 56 { 57 return (DefaultVisual(dpy, scr)); 58 } 59 60 GC XDefaultGC(Display *dpy, int scr) 61 { 62 return (DefaultGC(dpy,scr)); 63 } 64 65 unsigned long XBlackPixel(Display *dpy, int scr) 66 { 67 return (BlackPixel(dpy, scr)); 68 } 69 70 unsigned long XWhitePixel(Display *dpy, int scr) 71 { 72 return (WhitePixel(dpy,scr)); 73 } 74 75 unsigned long XAllPlanes(void) { return AllPlanes; } 76 77 int XQLength(Display *dpy) { return (QLength(dpy)); } 78 79 int XDisplayWidth(Display *dpy, int scr) 80 { 81 return (DisplayWidth(dpy,scr)); 82 } 83 84 int XDisplayHeight(Display *dpy, int scr) 85 { 86 return (DisplayHeight(dpy, scr)); 87 } 88 89 int XDisplayWidthMM(Display *dpy, int scr) 90 { 91 return (DisplayWidthMM(dpy, scr)); 92 } 93 94 int XDisplayHeightMM(Display *dpy, int scr) 95 { 96 return (DisplayHeightMM(dpy, scr)); 97 } 98 99 int XDisplayPlanes(Display *dpy, int scr) 100 { 101 return (DisplayPlanes(dpy, scr)); 102 } 103 104 int XDisplayCells(Display *dpy, int scr) 105 { 106 return (DisplayCells (dpy, scr)); 107 } 108 109 int XScreenCount(Display *dpy) { return (ScreenCount(dpy)); } 110 111 char *XServerVendor(Display *dpy) { return (ServerVendor(dpy)); } 112 113 int XProtocolVersion(Display *dpy) { return (ProtocolVersion(dpy)); } 114 115 int XProtocolRevision(Display *dpy) { return (ProtocolRevision(dpy));} 116 117 int XVendorRelease(Display *dpy) { return (VendorRelease(dpy)); } 118 119 char *XDisplayString(Display *dpy) { return (DisplayString(dpy)); } 120 121 int XDefaultDepth(Display *dpy, int scr) 122 { 123 return(DefaultDepth(dpy, scr)); 124 } 125 126 Colormap XDefaultColormap(Display *dpy, int scr) 127 { 128 return (DefaultColormap(dpy, scr)); 129 } 130 131 int XBitmapUnit(Display *dpy) { return (BitmapUnit(dpy)); } 132 133 int XBitmapBitOrder(Display *dpy) { return (BitmapBitOrder(dpy)); } 134 135 int XBitmapPad(Display *dpy) { return (BitmapPad(dpy)); } 136 137 int XImageByteOrder(Display *dpy) { return (ImageByteOrder(dpy)); } 138 139 /* XNextRequest() differs from the rest of the functions here because it is 140 * no longer a macro wrapper - when libX11 is being used mixed together 141 * with direct use of xcb, the next request field of the Display structure will 142 * not be updated. We can't fix the NextRequest() macro in any easy way, 143 * but we can at least make XNextRequest() do the right thing. 144 */ 145 unsigned long XNextRequest(Display *dpy) 146 { 147 unsigned long next_request; 148 LockDisplay(dpy); 149 next_request = _XNextRequest(dpy); 150 UnlockDisplay(dpy); 151 152 return next_request; 153 } 154 155 unsigned long XLastKnownRequestProcessed(Display *dpy) 156 { 157 return (LastKnownRequestProcessed(dpy)); 158 } 159 160 /* screen oriented macros (toolkit) */ 161 Screen *XScreenOfDisplay(Display *dpy, int scr) 162 { 163 return (ScreenOfDisplay(dpy, scr)); 164 } 165 166 Screen *XDefaultScreenOfDisplay(Display *dpy) 167 { 168 return (DefaultScreenOfDisplay(dpy)); 169 } 170 171 Display *XDisplayOfScreen(Screen *s) { return (DisplayOfScreen(s)); } 172 173 Window XRootWindowOfScreen(Screen *s) { return (RootWindowOfScreen(s)); } 174 175 unsigned long XBlackPixelOfScreen(Screen *s) 176 { 177 return (BlackPixelOfScreen(s)); 178 } 179 180 unsigned long XWhitePixelOfScreen(Screen *s) 181 { 182 return (WhitePixelOfScreen(s)); 183 } 184 185 Colormap XDefaultColormapOfScreen(Screen *s) 186 { 187 return (DefaultColormapOfScreen(s)); 188 } 189 190 int XDefaultDepthOfScreen(Screen *s) 191 { 192 return (DefaultDepthOfScreen(s)); 193 } 194 195 GC XDefaultGCOfScreen(Screen *s) 196 { 197 return (DefaultGCOfScreen(s)); 198 } 199 200 Visual *XDefaultVisualOfScreen(Screen *s) 201 { 202 return (DefaultVisualOfScreen(s)); 203 } 204 205 int XWidthOfScreen(Screen *s) { return (WidthOfScreen(s)); } 206 207 int XHeightOfScreen(Screen *s) { return (HeightOfScreen(s)); } 208 209 int XWidthMMOfScreen(Screen *s) { return (WidthMMOfScreen(s)); } 210 211 int XHeightMMOfScreen(Screen *s) { return (HeightMMOfScreen(s)); } 212 213 int XPlanesOfScreen(Screen *s) { return (PlanesOfScreen(s)); } 214 215 int XCellsOfScreen(Screen *s) { return (CellsOfScreen(s)); } 216 217 int XMinCmapsOfScreen(Screen *s) { return (MinCmapsOfScreen(s)); } 218 219 int XMaxCmapsOfScreen(Screen *s) { return (MaxCmapsOfScreen(s)); } 220 221 Bool XDoesSaveUnders(Screen *s) { return (DoesSaveUnders(s)); } 222 223 int XDoesBackingStore(Screen *s) { return (DoesBackingStore(s)); } 224 225 long XEventMaskOfScreen(Screen *s) { return (EventMaskOfScreen(s)); } 226 227 int XScreenNumberOfScreen (register Screen *scr) 228 { 229 register Display *dpy = scr->display; 230 register Screen *dpyscr = dpy->screens; 231 register int i; 232 233 for (i = 0; i < dpy->nscreens; i++, dpyscr++) { 234 if (scr == dpyscr) return i; 235 } 236 return -1; 237 } 238 239 /* 240 * These macros are used to give some sugar to the image routines so that 241 * naive people are more comfortable with them. 242 */ 243 #undef XDestroyImage 244 int 245 XDestroyImage( 246 XImage *ximage) 247 { 248 return((*((ximage)->f.destroy_image))((ximage))); 249 } 250 #undef XGetPixel 251 unsigned long XGetPixel( 252 XImage *ximage, 253 int x, int y) 254 { 255 return ((*((ximage)->f.get_pixel))((ximage), (x), (y))); 256 } 257 #undef XPutPixel 258 int XPutPixel( 259 XImage *ximage, 260 int x, int y, 261 unsigned long pixel) 262 { 263 return((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel))); 264 } 265 #undef XSubImage 266 XImage *XSubImage( 267 XImage *ximage, 268 int x, int y, 269 unsigned int width, unsigned int height) 270 { 271 return((*((ximage)->f.sub_image))((ximage), (x), 272 (y), (width), (height))); 273 } 274 #undef XAddPixel 275 int XAddPixel( 276 XImage *ximage, 277 long value) 278 { 279 return((*((ximage)->f.add_pixel))((ximage), (value))); 280 } 281 282 283 int 284 XNoOp (register Display *dpy) 285 { 286 _X_UNUSED register xReq *req; 287 288 LockDisplay(dpy); 289 GetEmptyReq(NoOperation, req); 290 291 UnlockDisplay(dpy); 292 SyncHandle(); 293 return 1; 294 } 295