home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / include / dix.h.orig < prev    next >
Encoding:
Text File  |  1991-07-27  |  5.2 KB  |  171 lines

  1. /***********************************************************
  2. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  3. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its 
  8. documentation for any purpose and without fee is hereby granted, 
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in 
  11. supporting documentation, and that the names of Digital or MIT not be
  12. used in advertising or publicity pertaining to distribution of the
  13. software without specific, written prior permission.  
  14.  
  15. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21. SOFTWARE.
  22.  
  23. ******************************************************************/
  24. /* $XConsortium: dix.h,v 1.59 91/07/27 23:40:24 keith Exp $ */
  25.  
  26. #ifndef DIX_H
  27. #define DIX_H
  28.  
  29. #include "gc.h"
  30. #include "window.h"
  31.  
  32. #define EARLIER -1
  33. #define SAMETIME 0
  34. #define LATER 1
  35.  
  36. #define NullClient ((ClientPtr) 0)
  37. #define REQUEST(type) \
  38.     register type *stuff = (type *)client->requestBuffer
  39.  
  40.  
  41. #define REQUEST_SIZE_MATCH(req)\
  42.     if ((sizeof(req) >> 2) != stuff->length)\
  43.          return(BadLength)
  44.  
  45. #define REQUEST_AT_LEAST_SIZE(req) \
  46.     if ((sizeof(req) >> 2) > stuff->length )\
  47.          return(BadLength)
  48.  
  49. #define REQUEST_FIXED_SIZE(req, n)\
  50.     if (((sizeof(req) >> 2) > stuff->length) || \
  51.         (((sizeof(req) + (n) + 3) >> 2) != stuff->length)) \
  52.          return(BadLength)
  53.  
  54. #define LEGAL_NEW_RESOURCE(id,client)\
  55.     if (!LegalNewID(id,client)) \
  56.     {\
  57.     client->errorValue = id;\
  58.         return(BadIDChoice);\
  59.     }
  60.  
  61. #define LOOKUP_DRAWABLE(did, client)\
  62.     ((client->lastDrawableID == did) ? \
  63.      client->lastDrawable : (DrawablePtr)LookupDrawable(did, client))
  64.  
  65. #define VERIFY_GC(pGC, rid, client)\
  66.     if (client->lastGCID == rid)\
  67.         pGC = client->lastGC;\
  68.     else\
  69.     pGC = (GC *)LookupIDByType(rid, RT_GC);\
  70.     if (!pGC)\
  71.     {\
  72.     client->errorValue = rid;\
  73.     return (BadGC);\
  74.     }
  75.  
  76. #define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, pGC, client)\
  77.     if ((client->lastGCID != stuff->gc) || (client->lastDrawableID != drawID))\
  78.     {\
  79.         if (client->lastDrawableID != drawID) {\
  80.         pDraw = (DrawablePtr)LookupIDByClass(drawID, RC_DRAWABLE);\
  81.             if (!pDraw)\
  82.             {\
  83.                 client->errorValue = drawID; \
  84.             return (BadDrawable);\
  85.             }\
  86.         } else\
  87.         pDraw = client->lastDrawable;\
  88.         if (client->lastGCID != stuff->gc) {\
  89.             pGC = (GC *)LookupIDByType(stuff->gc, RT_GC);\
  90.             if (!pGC)\
  91.             {\
  92.                 client->errorValue = stuff->gc;\
  93.                 return (BadGC);\
  94.             }\
  95.         } else\
  96.             pGC = client->lastGC;\
  97.     if ((pDraw->type == UNDRAWABLE_WINDOW) ||\
  98.         (pGC->depth != pDraw->depth) ||\
  99.         (pGC->pScreen != pDraw->pScreen))\
  100.         return (BadMatch);\
  101.     client->lastDrawable = pDraw;\
  102.     client->lastDrawableID = drawID;\
  103.     client->lastGC = pGC;\
  104.     client->lastGCID = stuff->gc;\
  105.     }\
  106.     else\
  107.     {\
  108.         pGC = client->lastGC;\
  109.         pDraw = client->lastDrawable;\
  110.     }\
  111.     if (pGC->serialNumber != pDraw->serialNumber)\
  112.     ValidateGC(pDraw, pGC);
  113.  
  114. #define WriteReplyToClient(pClient, size, pReply) \
  115.    if ((pClient)->swapped) \
  116.       (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \
  117.            (pClient, (int)(size), pReply); \
  118.       else (void) WriteToClient(pClient, (int)(size), (char *)(pReply));
  119.  
  120. #define WriteSwappedDataToClient(pClient, size, pbuf) \
  121.    if ((pClient)->swapped) \
  122.       (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \
  123.    else (void) WriteToClient (pClient, (int)(size), (char *)(pbuf));
  124.  
  125. typedef struct _TimeStamp *TimeStampPtr;
  126. typedef struct _Client *ClientPtr;
  127.  
  128. typedef struct _WorkQueue    *WorkQueuePtr;
  129.  
  130.  
  131. extern ClientPtr requestingClient;
  132. extern ClientPtr *clients;
  133. extern ClientPtr serverClient;
  134. extern int currentMaxClients;
  135. extern long *checkForInput[2];
  136.  
  137. extern int ProcAllowEvents();
  138. extern int ProcBell();
  139. extern int ProcChangeActivePointerGrab();
  140. extern int ProcChangeKeyboardControl();
  141. extern int ProcChangePointerControl();
  142. extern int ProcGetKeyboardMapping();
  143. extern int ProcGetPointerMapping();
  144. extern int ProcGetInputFocus();
  145. extern int ProcGetKeyboardControl();
  146. extern int ProcGetMotionEvents();
  147. extern int ProcGetPointerControl();
  148. extern int ProcGrabButton();
  149. extern int ProcGrabKey();
  150. extern int ProcGrabKeyboard();
  151. extern int ProcGrabPointer();
  152. extern int ProcQueryKeymap();
  153. extern int ProcQueryPointer();
  154. extern int ProcSetInputFocus();
  155. extern int ProcSetKeyboardMapping();
  156. extern int ProcSetPointerMapping();
  157. extern int ProcSendEvent();
  158. extern int ProcUngrabButton();
  159. extern int ProcUngrabKey();
  160. extern int ProcUngrabKeyboard();
  161. extern int ProcUngrabPointer();
  162. extern int ProcWarpPointer();
  163. extern int ProcRecolorCursor();
  164.  
  165. extern WindowPtr LookupWindow();
  166. extern pointer LookupDrawable();
  167.  
  168. extern void NoopDDA();
  169.  
  170. #endif /* DIX_H */
  171.