1 /** 2 * @file jxlib.h 3 * @author Joe Wingbermuehle 4 * @date 2004-2006 5 * 6 * @brief Macros to wrap X calls for debugging and testing. 7 * 8 */ 9 10 #ifndef JXLIB_H 11 #define JXLIB_H 12 13 #ifdef UNIT_TEST 14 15 # define JFUNC1(name, a) Mock_##name(a) 16 # define JFUNC2(name, a, b) Mock_##name(a, b) 17 # define JFUNC3(name, a, b, c) Mock_##name(a, b, c) 18 # define JFUNC4(name, a, b, c, d) Mock_##name(a, b, c, d) 19 # define JFUNC5(name, a, b, c, d, e) Mock_##name(a, b, c, d, e) 20 # define JFUNC6(name, a, b, c, d, e, f) Mock_##name(a, b, c, d, e, f) 21 # define JFUNC7(name, a, b, c, d, e, f, g) Mock_##name(a, b, c, d, e, f, g) 22 # define JFUNC8(name, a, b, c, d, e, f, g, h) \ 23 Mock_##name(a, b, c, d, e, f, g, h) 24 # define JFUNC9(name, a, b, c, d, e, f, g, h, i) \ 25 Mock_##name(a, b, c, d, e, f, g, h, i) 26 # define JFUNC10(name, a, b, c, d, e, f, g, h, i, j) \ 27 Mock_##name(a, b, c, d, e, f, g, h, i, j) 28 # define JFUNC11(name, a, b, c, d, e, f, g, h, i, j, k) \ 29 Mock_##name(a, b, c, d, e, f, g, h, i, j, k) 30 # define JFUNC12(name, a, b, c, d, e, f, g, h, i, j, k, l) \ 31 Mock_##name(a, b, c, d, e, f, g, h, i, j, k, l) 32 # define JFUNC13(name, a, b, c, d, e, f, g, h, i, j, k, l, m) \ 33 Mock_##name(a, b, c, d, e, f, g, h, i, j, k, l, m) 34 35 #else 36 37 # define JFUNC1(name, a) (SetCheckpoint(), name(a)) 38 # define JFUNC2(name, a, b) (SetCheckpoint(), name(a, b)) 39 # define JFUNC3(name, a, b, c) (SetCheckpoint(), name(a, b, c)) 40 # define JFUNC4(name, a, b, c, d) (SetCheckpoint(), name(a, b, c, d)) 41 # define JFUNC5(name, a, b, c, d, e) (SetCheckpoint(), name(a, b, c, d, e)) 42 # define JFUNC6(name, a, b, c, d, e, f) \ 43 (SetCheckpoint(), name(a, b, c, d, e, f)) 44 # define JFUNC7(name, a, b, c, d, e, f, g) \ 45 (SetCheckpoint(), name(a, b, c, d, e, f, g)) 46 # define JFUNC8(name, a, b, c, d, e, f, g, h) \ 47 (SetCheckpoint(), name(a, b, c, d, e, f, g, h)) 48 # define JFUNC9(name, a, b, c, d, e, f, g, h, i) \ 49 (SetCheckpoint(), name(a, b, c, d, e, f, g, h, i)) 50 # define JFUNC10(name, a, b, c, d, e, f, g, h, i, j) \ 51 (SetCheckpoint(), name(a, b, c, d, e, f, g, h, i, j)) 52 # define JFUNC11(name, a, b, c, d, e, f, g, h, i, j, k) \ 53 (SetCheckpoint(), name(a, b, c, d, e, f, g, h, i, j, k)) 54 # define JFUNC12(name, a, b, c, d, e, f, g, h, i, j, k, l) \ 55 (SetCheckpoint(), name(a, b, c, d, e, f, g, h, i, j, k, l)) 56 # define JFUNC13(name, a, b, c, d, e, f, g, h, i, j, k, l, m) \ 57 (SetCheckpoint(), name(a, b, c, d, e, f, g, h, i, j, k, l, m)) 58 59 #endif 60 61 #define JXAddToSaveSet( a, b ) JFUNC2(XAddToSaveSet, a, b) 62 63 #define JXAllocColor( a, b, c ) JFUNC3(XAllocColor, a, b, c) 64 65 #define JXGetRGBColormaps( a, b, c, d, e ) \ 66 JFUNC5(XGetRGBColormaps, a, b, c, d, e) 67 68 #define JXQueryColor( a, b, c ) JFUNC3(XQueryColor, a, b, c) 69 70 #define JXQueryColors( a, b, c, d ) JFUNC4(XQueryColors, a, b, c, d) 71 72 #define JXAllowEvents( a, b, c ) JFUNC3(XAllowEvents, a, b, c) 73 74 #define JXChangeProperty( a, b, c, d, e, f, g, h ) \ 75 JFUNC8(XChangeProperty, a, b, c, d, e, f, g, h) 76 77 #define JXDeleteProperty( a, b, c ) JFUNC3(XDeleteProperty, a, b, c) 78 79 #define JXChangeWindowAttributes( a, b, c, d ) \ 80 JFUNC4(XChangeWindowAttributes, a, b, c, d) 81 82 #define JXCheckTypedEvent( a, b, c ) JFUNC3(XCheckTypedEvent, a, b, c) 83 84 #define JXCheckTypedWindowEvent( a, b, c, d ) \ 85 JFUNC4(XCheckTypedWindowEvent, a, b, c, d) 86 87 #define JXClearWindow( a, b ) JFUNC2(XClearWindow, a, b) 88 89 #define JXClearArea( a, b, c, d, e, f, g ) \ 90 JFUNC7(XClearArea, a, b, c, d, e, f, g) 91 92 #define JXCloseDisplay( a ) JFUNC1(XCloseDisplay, a) 93 94 #define JXConfigureWindow( a, b, c, d ) JFUNC4(XConfigureWindow, a, b, c, d) 95 96 #define JXConnectionNumber( a ) JFUNC1(XConnectionNumber, a) 97 98 #define JXCopyArea( a, b, c, d, e, f, g, h, i, j ) \ 99 JFUNC10(XCopyArea, a, b, c, d, e, f, g, h, i, j) 100 101 #define JXCopyPlane( a, b, c, d, e, f, g, h, i, j, k ) \ 102 JFUNC11(XCopyPlane, a, b, c, d, e, f, g, h, i, j, k) 103 104 #define JXCreateFontCursor( a, b ) JFUNC2(XCreateFontCursor, a, b) 105 106 #define JXCreateGC( a, b, c, d ) JFUNC4(XCreateGC, a, b, c, d) 107 108 #define JXCreateImage( a, b, c, d, e, f, g, h, i, j ) \ 109 JFUNC10(XCreateImage, a, b, c, d, e, f, g, h, i, j) 110 111 #define JXCreatePixmap( a, b, c, d, e ) \ 112 JFUNC5(XCreatePixmap, a, b, c, d, e) 113 114 #define JXCreatePixmapFromBitmapData( a, b, c, d, e, f, g, h ) \ 115 JFUNC8(XCreatePixmapFromBitmapData, a, b, c, d, e, f, g, h) 116 117 #define JXCreateBitmapFromData( a, b, c, d, e ) \ 118 JFUNC5(XCreateBitmapFromData, a, b, c, d, e) 119 120 #define JXCreateSimpleWindow( a, b, c, d, e, f, g, h, i ) \ 121 JFUNC9(XCreateSimpleWindow, a, b, c, d, e, f, g, h, i) 122 123 #define JXCreateWindow( a, b, c, d, e, f, g, h, i, j, k, l ) \ 124 JFUNC12(XCreateWindow, a, b, c, d, e, f, g, h, i, j, k, l) 125 126 #define JXDefineCursor( a, b, c ) JFUNC3(XDefineCursor, a, b, c) 127 128 #define JXDestroyImage( a ) JFUNC1(XDestroyImage, a) 129 130 #define JXDestroyWindow( a, b ) JFUNC2(XDestroyWindow, a, b) 131 132 #define JXDrawPoint( a, b, c, d, e ) JFUNC5(XDrawPoint, a, b, c, d, e) 133 134 #define JXDrawPoints( a, b, c, d, e, f ) \ 135 JFUNC6(XDrawPoints, a, b, c, d, e, f) 136 137 #define JXDrawLine( a, b, c, d, e, f, g ) \ 138 JFUNC7(XDrawLine, a, b, c, d, e, f, g) 139 140 #define JXDrawSegments( a, b, c, d, e ) \ 141 JFUNC5(XDrawSegments, a, b, c, d, e) 142 143 #define JXDrawRectangle( a, b, c, d, e, f, g ) \ 144 JFUNC7(XDrawRectangle, a, b, c, d, e, f, g) 145 146 #define JXFillRectangles( a, b, c, d, e ) \ 147 JFUNC5(XFillRectangles, a, b, c, d, e) 148 149 #define JXDrawArcs( a, b, c, d, e ) JFUNC5(XDrawArcs, a, b, c, d, e) 150 151 #define JXFillArcs( a, b, c, d, e ) JFUNC5(XFillArcs, a, b, c, d, e) 152 153 #define JXSetLineAttributes( a, b, c, d, e, f ) \ 154 JFUNC6(XSetLineAttributes, a, b, c, d, e, f) 155 156 #define JXDrawString( a, b, c, d, e, f, g ) \ 157 JFUNC7(XDrawString, a, b, c, d, e, f, g) 158 159 #define JXFetchName( a, b, c ) JFUNC3(XFetchName, a, b, c) 160 161 #define JXFillRectangle( a, b, c, d, e, f, g ) \ 162 JFUNC7(XFillRectangle, a, b, c, d, e, f, g) 163 164 #define JXFlush( a ) JFUNC1(XFlush, a) 165 166 #define JXFree( a ) JFUNC1(XFree, a) 167 168 #define JXFreeColors( a, b, c, d, e ) JFUNC5(XFreeColors, a, b, c, d, e) 169 170 #define JXFreeCursor( a, b ) JFUNC2(XFreeCursor, a, b) 171 172 #define JXFreeFont( a, b ) JFUNC2(XFreeFont, a, b) 173 174 #define JXFreeGC( a, b ) JFUNC2(XFreeGC, a, b) 175 176 #define JXFreeModifiermap( a ) JFUNC1(XFreeModifiermap, a) 177 178 #define JXFreePixmap( a, b ) JFUNC2(XFreePixmap, a, b) 179 180 #define JXGetAtomName( a, b ) JFUNC2(XGetAtomName, a, b) 181 182 #define JXGetModifierMapping( a ) JFUNC1(XGetModifierMapping, a) 183 184 #define JXGetSubImage( a, b, c, d, e, f, g, h, i, j, k ) \ 185 JFUNC11(XGetSubImage, a, b, c, d, e, f, g, h, i, j, k) 186 187 #define JXGetTransientForHint( a, b, c ) JFUNC3(XGetTransientForHint, a, b, c) 188 189 #define JXGetClassHint( a, b, c ) JFUNC3(XGetClassHint, a, b, c) 190 191 #define JXGetWindowAttributes( a, b, c ) JFUNC3(XGetWindowAttributes, a, b, c) 192 193 #define JXGetWindowProperty( a, b, c, d, e, f, g, h, i, j, k, l ) \ 194 JFUNC12(XGetWindowProperty, a, b, c, d, e, f, g, h, i, j, k, l) 195 196 #define JXGetWMColormapWindows( a, b, c, d ) \ 197 JFUNC4(XGetWMColormapWindows, a, b, c, d) 198 199 #define JXGetWMNormalHints( a, b, c, d ) JFUNC4(XGetWMNormalHints, a, b, c, d) 200 201 #define JXSetIconSizes( a, b, c, d ) JFUNC4(XSetIconSizes, a, b, c, d) 202 203 #define JXSetWindowBorder( a, b, c ) JFUNC3(XSetWindowBorder, a, b, c) 204 205 #define JXGetWMHints( a, b ) JFUNC2(XGetWMHints, a, b) 206 207 #define JXGrabButton( a, b, c, d, e, f, g, h, i, j ) \ 208 JFUNC10(XGrabButton, a, b, c, d, e, f, g, h, i, j) 209 210 #define JXKeycodeToKeysym( a, b, c ) JFUNC3(XKeycodeToKeysym, a, b, c) 211 212 #define JXGrabKey( a, b, c, d, e, f, g ) \ 213 JFUNC7(XGrabKey, a, b, c, d, e, f, g) 214 215 #define JXUngrabKey( a, b, c, d ) JFUNC4(XUngrabKey, a, b, c, d) 216 217 #define JXGrabKeyboard( a, b, c, d, e, f ) \ 218 ( SetCheckpoint(), XGrabKeyboard( a, b, c, d, e, f ) ) 219 220 #define JXGrabPointer( a, b, c, d, e, f, g, h, i ) \ 221 ( SetCheckpoint(), XGrabPointer( a, b, c, d, e, f, g, h, i ) ) 222 223 #define JXGrabServer( a ) JFUNC1(XGrabServer, a) 224 225 #define JXInstallColormap( a, b ) JFUNC2(XInstallColormap, a, b) 226 227 #define JXInternAtom( a, b, c ) JFUNC3(XInternAtom, a, b, c) 228 229 #define JXKeysymToKeycode( a, b ) JFUNC2(XKeysymToKeycode, a, b) 230 231 #define JXKillClient( a, b ) JFUNC2(XKillClient, a, b) 232 233 #define JXLoadQueryFont( a, b ) JFUNC2(XLoadQueryFont, a, b) 234 235 #define JXMapRaised( a, b ) JFUNC2(XMapRaised, a, b) 236 237 #define JXMapWindow( a, b ) JFUNC2(XMapWindow, a, b) 238 239 #define JXMoveResizeWindow( a, b, c, d, e, f ) \ 240 JFUNC6(XMoveResizeWindow, a, b, c, d, e, f) 241 242 #define JXMoveWindow( a, b, c, d ) JFUNC4(XMoveWindow, a, b, c, d) 243 244 #define JXNextEvent( a, b ) JFUNC2(XNextEvent, a, b) 245 246 #define JXMaskEvent( a, b, c ) JFUNC3(XMaskEvent, a, b, c) 247 248 #define JXCheckMaskEvent( a, b, c ) JFUNC3(XCheckMaskEvent, a, b, c) 249 250 #define JXOpenDisplay( a ) JFUNC1(XOpenDisplay, a) 251 252 #define JXParseColor( a, b, c, d ) JFUNC4(XParseColor, a, b, c, d) 253 254 #define JXPending( a ) JFUNC1(XPending, a) 255 256 #define JXPutBackEvent( a, b ) JFUNC2(XPutBackEvent, a, b) 257 258 #define JXGetImage( a, b, c, d, e, f, g, h ) \ 259 JFUNC8(XGetImage, a, b, c, d, e, f, g, h) 260 261 #define JXPutImage( a, b, c, d, e, f, g, h, i, j ) \ 262 JFUNC10(XPutImage, a, b, c, d, e, f, g, h, i, j) 263 264 #define JXQueryPointer( a, b, c, d, e, f, g, h, i ) \ 265 JFUNC9(XQueryPointer, a, b, c, d, e, f, g, h, i) 266 267 #define JXQueryTree( a, b, c, d, e, f ) JFUNC6(XQueryTree, a, b, c, d, e, f) 268 269 #define JXReparentWindow( a, b, c, d, e ) \ 270 JFUNC5(XReparentWindow, a, b, c, d, e) 271 272 #define JXRemoveFromSaveSet( a, b ) JFUNC2(XRemoveFromSaveSet, a, b) 273 274 #define JXResizeWindow( a, b, c, d ) JFUNC4(XResizeWindow, a, b, c, d) 275 276 #define JXRestackWindows( a, b, c ) JFUNC3(XRestackWindows, a, b, c) 277 278 #define JXRaiseWindow( a, b ) JFUNC2(XRaiseWindow, a, b) 279 280 #define JXSelectInput( a, b, c ) JFUNC3(XSelectInput, a, b, c) 281 282 #define JXSendEvent( a, b, c, d, e ) JFUNC5(XSendEvent, a, b, c, d, e) 283 284 #define JXSetBackground( a, b, c ) JFUNC3(XSetBackground, a, b, c) 285 286 #define JXSetClipMask( a, b, c ) JFUNC3(XSetClipMask, a, b, c) 287 288 #define JXSetClipOrigin( a, b, c, d ) JFUNC4(XSetClipOrigin, a, b, c, d) 289 290 #define JXSetClipRectangles( a, b, c, d, e, f, g ) \ 291 JFUNC7(XSetClipRectangles, a, b, c, d, e, f, g) 292 293 #define JXSetErrorHandler( a ) JFUNC1(XSetErrorHandler, a) 294 295 #define JXSetFont( a, b, c ) JFUNC3(XSetFont, a, b, c) 296 297 #define JXSetForeground( a, b, c ) JFUNC3(XSetForeground, a, b, c) 298 299 #define JXGetInputFocus( a, b, c ) JFUNC3(XGetInputFocus, a, b, c) 300 301 #define JXSetInputFocus( a, b, c, d ) JFUNC4(XSetInputFocus, a, b, c, d) 302 303 #define JXSetWindowBackground( a, b, c ) JFUNC3(XSetWindowBackground, a, b, c) 304 305 #define JXSetWindowBorderWidth( a, b, c ) \ 306 JFUNC3(XSetWindowBorderWidth, a, b, c) 307 308 #define JXSetWMNormalHints( a, b, c ) JFUNC3(XSetWMNormalHints, a, b, c) 309 310 #define JXShapeCombineRectangles( a, b, c, d, e, f, g, h, i ) \ 311 JFUNC9(XShapeCombineRectangles, a, b, c, d, e, f, g, h, i) 312 313 #define JXShapeCombineShape( a, b, c, d, e, f, g, h ) \ 314 JFUNC8(XShapeCombineShape, a, b, c, d, e, f, g, h) 315 316 #define JXShapeCombineMask( a, b, c, d, e, f, g ) \ 317 JFUNC7(XShapeCombineMask, a, b, c, d, e, f, g) 318 319 #define JXShapeQueryExtension( a, b, c ) \ 320 JFUNC3(XShapeQueryExtension, a, b, c) 321 322 #define JXQueryExtension( a, b, c, d, e ) \ 323 JFUNC5(XQueryExtension, a, b, c, d, e) 324 325 #define JXShapeQueryExtents( a, b, c, d, e, f, g, h, i, j, k, l ) \ 326 JFUNC12(XShapeQueryExtents, a, b, c, d, e, f, g, h, i, j, k, l) 327 328 #define JXShapeGetRectangles( a, b, c, d, e ) \ 329 JFUNC5(XShapeGetRectangles, a, b, c, d, e) 330 331 #define JXShapeSelectInput( a, b, c ) JFUNC3(XShapeSelectInput, a, b, c) 332 333 #define JXStoreName( a, b, c ) JFUNC3(XStoreName, a, b, c) 334 335 #define JXStringToKeysym( a ) JFUNC1(XStringToKeysym, a) 336 337 #define JXSync( a, b ) JFUNC2(XSync, a, b) 338 339 #define JXTextWidth( a, b, c ) JFUNC3(XTextWidth, a, b, c) 340 341 #define JXUngrabButton( a, b, c, d ) JFUNC4(XUngrabButton, a, b, c, d) 342 343 #define JXUngrabKeyboard( a, b ) JFUNC2(XUngrabKeyboard, a, b) 344 345 #define JXUngrabPointer( a, b ) JFUNC2(XUngrabPointer, a, b) 346 347 #define JXUngrabServer( a ) JFUNC1(XUngrabServer, a) 348 349 #define JXUnmapWindow( a, b ) JFUNC2(XUnmapWindow, a, b) 350 351 #define JXWarpPointer( a, b, c, d, e, f, g, h, i ) \ 352 JFUNC9(XWarpPointer, a, b, c, d, e, f, g, h, i) 353 354 #define JXSetSelectionOwner( a, b, c, d ) \ 355 JFUNC4(XSetSelectionOwner, a, b, c, d) 356 357 #define JXGetSelectionOwner( a, b ) JFUNC2(XGetSelectionOwner, a, b) 358 359 #define JXSetRegion( a, b, c ) JFUNC3(XSetRegion, a, b, c) 360 361 #define JXGetGeometry( a, b, c, d, e, f, g, h, i ) \ 362 JFUNC9(XGetGeometry, a, b, c, d, e, f, g, h, i) 363 364 /* XFT */ 365 366 #define JXftFontOpenName( a, b, c ) JFUNC3(XftFontOpenName, a, b, c) 367 368 #define JXftFontOpenXlfd( a, b, c ) JFUNC3(XftFontOpenXlfd, a, b, c) 369 370 #define JXftDrawCreate( a, b, c, d ) JFUNC4(XftDrawCreate, a, b, c, d) 371 372 #define JXftDrawDestroy( a ) JFUNC1(XftDrawDestroy, a) 373 374 #define JXftTextExtentsUtf8( a, b, c, d, e ) \ 375 JFUNC5(XftTextExtentsUtf8, a, b, c, d, e) 376 377 #define JXftDrawChange( a, b ) JFUNC2(XftDrawChange, a, b) 378 379 #define JXftDrawSetClipRectangles( a, b, c, d, e ) \ 380 JFUNC5(XftDrawSetClipRectangles, a, b, c, d, e) 381 382 #define JXftDrawStringUtf8( a, b, c, d, e, f, g ) \ 383 JFUNC7(XftDrawStringUtf8, a, b, c, d, e, f, g) 384 385 #define JXftColorFree( a, b, c, d ) JFUNC4(XftColorFree, a, b, c, d) 386 387 #define JXftColorAllocValue( a, b, c, d, e ) \ 388 JFUNC5(XftColorAllocValue, a, b, c, d, e) 389 390 #define JXftFontClose( a, b ) JFUNC2(XftFontClose, a, b) 391 392 #define JXftDrawSetClip( a, b ) JFUNC2(XftDrawSetClip, a, b) 393 394 /* Xrender */ 395 396 #define JXRenderQueryExtension( a, b, c ) \ 397 JFUNC3(XRenderQueryExtension, a, b, c) 398 399 #define JXRenderFindVisualFormat( a, b ) \ 400 JFUNC2(XRenderFindVisualFormat, a, b) 401 402 #define JXRenderFindFormat( a, b, c, d ) \ 403 JFUNC4(XRenderFindFormat, a, b, c, d) 404 405 #define JXRenderFindStandardFormat( a, b ) \ 406 JFUNC2(XRenderFindStandardFormat, a, b) 407 408 #define JXRenderCreatePicture( a, b, c, d, e ) \ 409 JFUNC5(XRenderCreatePicture, a, b, c, d, e) 410 411 #define JXRenderFreePicture( a, b ) JFUNC2(XRenderFreePicture, a, b) 412 413 #define JXRenderComposite( a, b, c, d, e, f, g, h, i, j, k, l, m ) \ 414 JFUNC13(XRenderComposite, a, b, c, d, e, f, g, h, i, j, k, l, m) 415 416 #endif /* JXLIB_H */ 417