home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / include / extension.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-07-16  |  2.4 KB  |  69 lines

  1. /* $XConsortium: extension.h,v 1.6 89/07/16 14:37:47 rws Exp $ */
  2. /***********************************************************
  3. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  4. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  5.  
  6.                         All Rights Reserved
  7.  
  8. Permission to use, copy, modify, and distribute this software and its 
  9. documentation for any purpose and without fee is hereby granted, 
  10. provided that the above copyright notice appear in all copies and that
  11. both that copyright notice and this permission notice appear in 
  12. supporting documentation, and that the names of Digital or MIT not be
  13. used in advertising or publicity pertaining to distribution of the
  14. software without specific, written prior permission.  
  15.  
  16. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  18. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  19. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22. SOFTWARE.
  23.  
  24. ******************************************************************/
  25. #ifndef EXTENSION_H
  26. #define EXTENSION_H 
  27.  
  28. #define GetGCAndDrawableAndValidate(gcID, pGC, drawID, pDraw, client)\
  29.     if ((client->lastDrawableID != drawID) || (client->lastGCID != gcID))\
  30.     {\
  31.         if (client->lastDrawableID != drawID)\
  32.             pDraw = (DrawablePtr)LookupIDByClass(drawID, RC_DRAWABLE);\
  33.         else\
  34.         pDraw = client->lastDrawable;\
  35.         if (client->lastGCID != gcID)\
  36.         pGC = (GC *)LookupIDByType(gcID, RT_GC);\
  37.         else\
  38.             pGC = client->lastGC;\
  39.     if (pDraw && pGC)\
  40.     {\
  41.         if ((pDraw->type == UNDRAWABLE_WINDOW) ||\
  42.         (pGC->depth != pDraw->depth) ||\
  43.         (pGC->pScreen != pDraw->pScreen))\
  44.         return (BadMatch);\
  45.         client->lastDrawable = pDraw;\
  46.         client->lastDrawableID = drawID;\
  47.             client->lastGC = pGC;\
  48.             client->lastGCID = gcID;\
  49.     }\
  50.     }\
  51.     else\
  52.     {\
  53.         pGC = client->lastGC;\
  54.         pDraw = client->lastDrawable;\
  55.     }\
  56.     if (!pDraw)\
  57.     {\
  58.         client->errorValue = drawID; \
  59.     return (BadDrawable);\
  60.     }\
  61.     if (!pGC)\
  62.     {\
  63.         client->errorValue = gcID;\
  64.         return (BadGC);\
  65.     }\
  66.     if (pGC->serialNumber != pDraw->serialNumber)\
  67.     ValidateGC(pDraw, pGC);
  68. #endif /* EXTENSION_H */
  69.