Annotation of researchv9/X11/src/X.V11R1/server/include/extension.h, revision 1.1.1.1

1.1       root        1: /* $Header: extension.h,v 1.2 87/09/08 14:02:46 toddb 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: /****************************************************************
                     29:  *  extension.h: static bindings for extending X protocol.  
                     30:  *
                     31:  *  Each protocol extension is encapsulated in the following record:
                     32:  *  
                     33:  *      typedef struct _extension_entry {
                     34:  *          char *name;                  
                     35:  *          int base;                   
                     36:  *          void (* InitProc)();          
                     37:  *          int (* MainProc)();          
                     38:  *      } EXTENSION_ENTRY;
                     39:  *  
                     40:  *  When Dispatch() gets a request type > 128, it calls
                     41:  *  XDispatchToExtension. This routine looks in the extension table for the
                     42:  *  the (MainProc) to call.  It gets one parameter, char *request (the
                     43:  *  string returned from ReadRequestFromClient).  MainProc() should return 
                     44:  *  a status flag to the disptacher.  In main(), the init procedure
                     45:  *  for each loaded extension is called.  
                     46:  *  
                     47:  *  Extension procedures to call when a GC is created and destroy are
                     48:  *  defined in gc.h (in the include directory)
                     49:  *  
                     50:  ****************************************************************/
                     51: 
                     52: #define GetGCAndDrawableAndValidate(gcID, pGC, drawID, pDraw, client)\
                     53:     if ((client->lastDrawableID != drawID) || (client->lastGCID != gcID))\
                     54:     {\
                     55:        if (client->lastDrawableID != drawID)\
                     56:        {\
                     57:            pDraw = (DrawablePtr)LookupID(drawID, RT_DRAWABLE, RC_CORE);\
                     58:            if (!pDraw)\
                     59:            {\
                     60:                client->errorValue = drawID; \
                     61:                return (BadDrawable);\
                     62:            }\
                     63:            if ((pDraw->type == DRAWABLE_WINDOW) || \
                     64:                (pDraw->type == DRAWABLE_PIXMAP))\
                     65:            {\
                     66:                client->lastDrawable = pDraw;\
                     67:                client->lastDrawableID = drawID;\
                     68:            }\
                     69:            else\
                     70:            {\
                     71:                client->errorValue = drawID;\
                     72:                return (BadDrawable);\
                     73:            }\
                     74:        }\
                     75:        else\
                     76:            pDraw = (DrawablePtr)client->lastDrawable;\
                     77:        if (client->lastGCID != gcID)\
                     78:        {\
                     79:            pGC = (GC *)LookupID(gcID, RT_GC, RC_CORE);\
                     80:            if (!pGC)\
                     81:            {\
                     82:                client->errorValue = gcID;\
                     83:                return (BadGC);\
                     84:            }\
                     85:            client->lastGC = pGC;\
                     86:            client->lastGCID = gcID;\
                     87:        }\
                     88:        else\
                     89:            pGC = (GC *) client->lastGC;\
                     90:        if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\
                     91:        {\
                     92:            client->errorValue = gcID;\
                     93:            client->lastGCID = 0;\
                     94:            return (BadMatch);\
                     95:         }\
                     96:     }\
                     97:     else\
                     98:     {\
                     99:        pGC = (GC *) client->lastGC;\
                    100:        pDraw = (DrawablePtr)client->lastDrawable;\
                    101:     }\
                    102:     if (pGC->serialNumber != pDraw->serialNumber)\
                    103:     { \
                    104:        ValidateGC(pDraw, pGC);\
                    105:     }
                    106: #endif /* EXTENSION_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.