Annotation of researchv9/X11/src/X.V11R1/server/ddx/sun/sun.h, revision 1.1.1.1

1.1       root        1: /*-
                      2:  * sun.h --
                      3:  *     Internal declarations for the sun ddx interface
                      4:  *
                      5:  * Copyright (c) 1987 by the Regents of the University of California
                      6:  *
                      7:  * Permission to use, copy, modify, and distribute this
                      8:  * software and its documentation for any purpose and without
                      9:  * fee is hereby granted, provided that the above copyright
                     10:  * notice appear in all copies.  The University of California
                     11:  * makes no representations about the suitability of this
                     12:  * software for any purpose.  It is provided "as is" without
                     13:  * express or implied warranty.
                     14:  *
                     15:  *     "$Header: sun.h,v 4.3 87/09/12 02:29:58 sun Exp $ SPRITE (Berkeley)"
                     16:  */
                     17: #ifndef _SUN_H_
                     18: #define _SUN_H_
                     19: 
                     20: #include    <errno.h>
                     21: #include    <sys/param.h>
                     22: #include    <sys/types.h>
                     23: #include    <sys/time.h>
                     24: #include    <sys/file.h>
                     25: #include    <sys/fcntl.h>
                     26: #include    <sys/signal.h>
                     27: #include    <sundev/kbd.h>
                     28: #include    <sundev/kbio.h>
                     29: #include    <sundev/msio.h>
                     30: #include    <sun/fbio.h>
                     31: 
                     32: /*
                     33:  * SUN_WINDOWS is now defined (or not) by the Makefile
                     34:  * variable $(SUNWINDOWSFLAGS) in server/Makefile.
                     35:  */
                     36: 
                     37: #ifdef SUN_WINDOWS
                     38: #include    <varargs.h>
                     39: #include    <sys/ioctl.h>
                     40: #include    <stdio.h>
                     41: #include    <pixrect/pixrect_hs.h>
                     42: #include    <sunwindow/rect.h>
                     43: #include    <sunwindow/rectlist.h>
                     44: #include    <sunwindow/pixwin.h>
                     45: #include    <sunwindow/win_screen.h>
                     46: #include    <sunwindow/win_input.h>
                     47: #include    <sunwindow/cms.h>
                     48: #include    <sunwindow/win_struct.h>
                     49: #else 
                     50: /* already included by sunwindow/win_input.h */
                     51: #include    <sundev/vuid_event.h>
                     52: #endif SUN_WINDOWS
                     53: 
                     54: #include    "X.h"
                     55: #include    "Xproto.h"
                     56: #include    "scrnintstr.h"
                     57: #include    "screenint.h"
                     58: #ifdef NEED_EVENTS
                     59: #include    "inputstr.h"
                     60: #endif NEED_EVENTS
                     61: #include    "input.h"
                     62: #include    "cursorstr.h"
                     63: #include    "cursor.h"
                     64: #include    "pixmapstr.h"
                     65: #include    "pixmap.h"
                     66: #include    "windowstr.h"
                     67: #include    "gc.h"
                     68: #include    "gcstruct.h"
                     69: #include    "regionstr.h"
                     70: #include    "colormap.h"
                     71: #include    "miscstruct.h"
                     72: #include    "dix.h"
                     73: #include    "mfb.h"
                     74: #include    "mi.h"
                     75: #ifdef ZOIDS
                     76: #include    "zoid.h"
                     77: #endif ZOIDS
                     78: 
                     79: /*
                     80:  * MAXEVENTS is the maximum number of events the mouse and keyboard functions
                     81:  * will read on a given call to their GetEvents vectors.
                     82:  */
                     83: #define MAXEVENTS      32
                     84: 
                     85: /*
                     86:  * Data private to any sun keyboard.
                     87:  *     GetEvents reads any events which are available for the keyboard
                     88:  *     ProcessEvent processes a single event and gives it to DIX
                     89:  *     DoneEvents is called when done handling a string of keyboard
                     90:  *         events or done handling all events.
                     91:  *     devPrivate is private to the specific keyboard.
                     92:  *     map_q is TRUE if the event queue for the keyboard is memory mapped.
                     93:  */
                     94: typedef struct kbPrivate {
                     95:     int                  type;                 /* Type of keyboard */
                     96:     int                  fd;                   /* Descriptor open to device */
                     97:     Firm_event   *(*GetEvents)();      /* Function to read events */
                     98:     void         (*ProcessEvent)();    /* Function to process an event */
                     99:     void         (*DoneEvents)();      /* Function called when all events */
                    100:                                        /* have been handled. */
                    101:     pointer      devPrivate;           /* Private to keyboard device */
                    102:     Bool         map_q;                /* TRUE if fd has a mapped event queue */
                    103:     int                  offset;               /* to be added to device keycodes */
                    104: } KbPrivRec, *KbPrivPtr;
                    105: 
                    106: #define        MIN_KEYCODE     8       /* necessary to avoid the mouse buttons */
                    107: 
                    108: /*
                    109:  * Data private to any sun pointer device.
                    110:  *     GetEvents, ProcessEvent and DoneEvents have uses similar to the
                    111:  *         keyboard fields of the same name.
                    112:  *     pScreen is the screen the pointer is on (only valid if it is the
                    113:  *         main pointer device).
                    114:  *     x and y are absolute coordinates on that screen (they may be negative)
                    115:  */
                    116: typedef struct ptrPrivate {
                    117:     int                  fd;                   /* Descriptor to device */
                    118:     Firm_event           *(*GetEvents)();      /* Function to read events */
                    119:     void         (*ProcessEvent)();    /* Function to process an event */
                    120:     void         (*DoneEvents)();      /* When all the events have been */
                    121:                                        /* handled, this function will be */
                    122:                                        /* called. */
                    123:     short        x,                    /* Current X coordinate of pointer */
                    124:                  y;                    /* Current Y coordinate */
                    125:     ScreenPtr    pScreen;              /* Screen pointer is on */
                    126:     pointer              devPrivate;           /* Field private to device */
                    127: } PtrPrivRec, *PtrPrivPtr;
                    128: 
                    129: /*
                    130:  * Cursor-private data
                    131:  *     screenBits      saves the contents of the screen before the cursor
                    132:  *                     was placed in the frame buffer.
                    133:  *     source          a bitmap for placing the foreground pixels down
                    134:  *     srcGC           a GC for placing the foreground pixels down.
                    135:  *                     Prevalidated for the cursor's screen.
                    136:  *     invSource       a bitmap for placing the background pixels down.
                    137:  *     invSrcGC        a GC for placing the background pixels down.
                    138:  *                     Also prevalidated for the cursor's screen Pixmap.
                    139:  *     temp            a temporary pixmap for low-flicker cursor motion --
                    140:  *                     exists to avoid the overhead of creating a pixmap
                    141:  *                     whenever the cursor must be moved.
                    142:  *     fg, bg          foreground and background pixels. For a color display,
                    143:  *                     these are allocated once and the rgb values changed
                    144:  *                     when the cursor is recolored.
                    145:  *     scrX, scrY      the coordinate on the screen of the upper-left corner
                    146:  *                     of screenBits.
                    147:  *     state           one of CR_IN, CR_OUT and CR_XING to track whether the
                    148:  *                     cursor is in or out of the frame buffer or is in the
                    149:  *                     process of going from one state to the other.
                    150:  */
                    151: typedef enum {
                    152:     CR_IN,             /* Cursor in frame buffer */
                    153:     CR_OUT,            /* Cursor out of frame buffer */
                    154:     CR_XING            /* Cursor in flux */
                    155: } CrState;
                    156: 
                    157: typedef struct crPrivate {
                    158:     PixmapPtr                  screenBits; /* Screen before cursor put down */
                    159:     PixmapPtr                  source;     /* Cursor source (foreground bits) */
                    160:     GCPtr              srcGC;      /* Foreground GC */
                    161:     PixmapPtr                  invSource;  /* Cursor source inverted (background) */
                    162:     GCPtr              invSrcGC;   /* Background GC */
                    163:     PixmapPtr                  temp;       /* Temporary pixmap for merging screenBits
                    164:                                     * and the sources. Saves creation time */
                    165:     Pixel              fg;         /* Foreground color */
                    166:     Pixel              bg;         /* Background color */
                    167:     int                        scrX,       /* Screen X coordinate of screenBits */
                    168:                        scrY;       /* Screen Y coordinate of screenBits */
                    169:     CrState            state;      /* Current state of the cursor */
                    170: } CrPrivRec, *CrPrivPtr;
                    171: 
                    172: /*
                    173:  * Frame-buffer-private info.
                    174:  *     fd              file opened to the frame buffer device.
                    175:  *     info            description of the frame buffer -- type, height, depth,
                    176:  *                     width, etc.
                    177:  *     fb              pointer to the mapped image of the frame buffer. Used
                    178:  *                     by the driving routines for the specific frame buffer
                    179:  *                     type.
                    180:  *     pGC             A GC for realizing cursors.
                    181:  *     GetImage        Original GetImage function for this screen.
                    182:  *     CreateGC        Original CreateGC function
                    183:  *     CreateWindow    Original CreateWindow function
                    184:  *     ChangeWindowAttributes  Original function
                    185:  *     GetSpans        GC function which needs to be here b/c GetSpans isn't
                    186:  *                     called with the GC as an argument...
                    187:  *     mapped          flag set true by the driver when the frame buffer has
                    188:  *                     been mapped in.
                    189:  *     parent          set true if the frame buffer is actually a SunWindows
                    190:  *                     window.
                    191:  *     fbPriv          Data private to the frame buffer type.
                    192:  */
                    193: typedef struct {
                    194:     pointer            fb;         /* Frame buffer itself */
                    195:     GCPtr              pGC;        /* GC for realizing cursors */
                    196: 
                    197:     void               (*GetImage)();
                    198:     Bool               (*CreateGC)();/* GC Creation function previously in the
                    199:                                       * Screen structure */
                    200:     Bool               (*CreateWindow)();
                    201:     Bool               (*ChangeWindowAttributes)();
                    202:     unsigned int       *(*GetSpans)();
                    203:     void               (*EnterLeave)();
                    204:     Bool               mapped;     /* TRUE if frame buffer already mapped */
                    205:     Bool               parent;     /* TRUE if fd is a SunWindows window */
                    206:     int                        fd;         /* Descriptor open to frame buffer */
                    207:     struct fbtype      info;       /* Frame buffer characteristics */
                    208:     pointer            fbPriv;     /* Frame-buffer-dependent data */
                    209: } fbFd;
                    210: 
                    211: /*
                    212:  * Data describing each type of frame buffer. The probeProc is called to
                    213:  * see if such a device exists and to do what needs doing if it does. devName
                    214:  * is the expected name of the device in the file system. Note that this only
                    215:  * allows one of each type of frame buffer. This may need changing later.
                    216:  */
                    217: typedef enum {
                    218:        neverProbed, probedAndSucceeded, probedAndFailed
                    219: } SunProbeStatus;
                    220: 
                    221: /*
                    222:  * ZOIDS should only ever be defined if SUN_WINDOWS is defined.
                    223:  */
                    224: typedef struct _sunFbDataRec {
                    225:     Bool    (*probeProc)();    /* probe procedure for this fb */
                    226:     char    *devName;          /* device filename */
                    227:     SunProbeStatus probeStatus;        /* TRUE if fb has been probed successfully */
                    228: #ifdef ZOIDS
                    229:     Pixrect *pr;               /* set for bwtwo's only */
                    230:     Pixrect *scratch_pr;       /* set for bwtwo's only */
                    231: #endif ZOIDS
                    232: } sunFbDataRec;
                    233: 
                    234: extern sunFbDataRec sunFbData[];
                    235: /*
                    236:  * Cursor functions
                    237:  */
                    238: extern void      sunInitCursor();
                    239: extern Bool      sunRealizeCursor();
                    240: extern Bool      sunUnrealizeCursor();
                    241: extern Bool      sunDisplayCursor();
                    242: extern Bool      sunSetCursorPosition();
                    243: extern void      sunCursorLimits();
                    244: extern void      sunPointerNonInterestBox();
                    245: extern void      sunConstrainCursor();
                    246: extern void      sunRecolorCursor();
                    247: extern Bool      sunCursorLoc();
                    248: extern void      sunRemoveCursor();
                    249: extern void      sunRestoreCursor();
                    250: 
                    251: /*
                    252:  * Initialization
                    253:  */
                    254: extern void      sunScreenInit();
                    255: extern int       sunOpenFrameBuffer();
                    256: 
                    257: /*
                    258:  * GC Interceptions
                    259:  */
                    260: extern GCPtr     sunCreatePrivGC();
                    261: extern Bool      sunCreateGC();
                    262: extern Bool      sunCreateWindow();
                    263: extern Bool      sunChangeWindowAttributes();
                    264: 
                    265: extern void      sunGetImage();
                    266: extern unsigned int *sunGetSpans();
                    267: 
                    268: extern int       isItTimeToYield;
                    269: extern int       sunCheckInput;    /* Non-zero if input is available */
                    270: 
                    271: extern fbFd      sunFbs[];
                    272: extern Bool      screenSaved;          /* True is screen is being saved */
                    273: 
                    274: extern int       lastEventTime;    /* Time (in ms.) of last event */
                    275: extern void      SetTimeSinceLastInputEvent();
                    276: extern void    ErrorF();
                    277: 
                    278: #define AUTOREPEAT_INITIATE     (300)           /* milliseconds */
                    279: #define AUTOREPEAT_DELAY        (100)           /* milliseconds */
                    280: /*
                    281:  * We signal autorepeat events with the unique Firm_event
                    282:  * id AUTOREPEAT_EVENTID.
                    283:  * Because inputevent ie_code is set to Firm_event ids in
                    284:  * sunKbdProcessEventSunWin, and ie_code is short whereas
                    285:  * Firm_event id is u_short, we use 0x7fff.
                    286:  */
                    287: #define AUTOREPEAT_EVENTID      (0x7fff)        /* AutoRepeat Firm_event id */
                    288: 
                    289: extern int     autoRepeatKeyDown;              /* TRUE if key down */
                    290: extern int     autoRepeatReady;                /* TRUE if time out */
                    291: extern int     autoRepeatDebug;                /* TRUE if debugging */
                    292: 
                    293: /*
                    294:  * Sun specific extensions:
                    295:  *     trapezoids
                    296:  */
                    297: #ifdef ZOIDS
                    298: extern void      sunBW2SolidXZoids();
                    299: extern void      sunBW2SolidYZoids();
                    300: extern void      sunBW2TiledXZoids();
                    301: extern void      sunBW2TiledYZoids();
                    302: extern void      sunBW2StipXZoids();
                    303: extern void      sunBW2StipYZoids();
                    304: #endif ZOIDS
                    305: 
                    306: /*-
                    307:  * TVTOMILLI(tv)
                    308:  *     Given a struct timeval, convert its time into milliseconds...
                    309:  */
                    310: #define TVTOMILLI(tv)  (((tv).tv_usec/1000)+((tv).tv_sec*1000))
                    311: 
                    312: #ifdef SUN_WINDOWS
                    313: extern int windowFd;
                    314: #endif SUN_WINDOWS
                    315: 
                    316: #endif _SUN_H_

unix.superglobalmegacorp.com

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