|
|
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: extern int errno;
22: #include <sys/types.h>
23: #include <sys/timeb.h>
24: #include <signal.h>
25: #include <sun/fbio.h>
26:
27: #include "X.h"
28: #include "Xproto.h"
29: #include "scrnintstr.h"
30: #include "screenint.h"
31: #ifdef NEED_EVENTS
32: #include "inputstr.h"
33: #endif NEED_EVENTS
34: #include "input.h"
35: #include "cursorstr.h"
36: #include "cursor.h"
37: #include "pixmapstr.h"
38: #include "pixmap.h"
39: #include "windowstr.h"
40: #include "gc.h"
41: #include "gcstruct.h"
42: #include "regionstr.h"
43: #include "colormap.h"
44: #include "miscstruct.h"
45: #include "dix.h"
46: #include "mfb.h"
47: #include "mi.h"
48:
49: /*
50: * MAXEVENTS is the maximum number of events the mouse and keyboard functions
51: * will read on a given call to their GetEvents vectors.
52: */
53: #define MAXEVENTS 32
54:
55: /*
56: * Data private to any sun pointer device.
57: * GetEvents, ProcessEvent and DoneEvents have uses similar to the
58: * keyboard fields of the same name.
59: * pScreen is the screen the pointer is on (only valid if it is the
60: * main pointer device).
61: * x and y are absolute coordinates on that screen (they may be negative)
62: */
63: typedef struct ptrPrivate {
64: short x, /* Current X coordinate of pointer */
65: y; /* Current Y coordinate */
66: ScreenPtr pScreen; /* Screen pointer is on */
67: } PtrPrivRec, *PtrPrivPtr;
68:
69: /*
70: * Cursor-private data
71: * screenBits saves the contents of the screen before the cursor
72: * was placed in the frame buffer.
73: * source a bitmap for placing the foreground pixels down
74: * srcGC a GC for placing the foreground pixels down.
75: * Prevalidated for the cursor's screen.
76: * invSource a bitmap for placing the background pixels down.
77: * invSrcGC a GC for placing the background pixels down.
78: * Also prevalidated for the cursor's screen Pixmap.
79: * temp a temporary pixmap for low-flicker cursor motion --
80: * exists to avoid the overhead of creating a pixmap
81: * whenever the cursor must be moved.
82: * fg, bg foreground and background pixels. For a color display,
83: * these are allocated once and the rgb values changed
84: * when the cursor is recolored.
85: * scrX, scrY the coordinate on the screen of the upper-left corner
86: * of screenBits.
87: * state one of CR_IN, CR_OUT and CR_XING to track whether the
88: * cursor is in or out of the frame buffer or is in the
89: * process of going from one state to the other.
90: */
91: typedef enum {
92: CR_IN, /* Cursor in frame buffer */
93: CR_OUT, /* Cursor out of frame buffer */
94: CR_XING /* Cursor in flux */
95: } CrState;
96:
97: typedef struct crPrivate {
98: PixmapPtr screenBits; /* Screen before cursor put down */
99: PixmapPtr source; /* Cursor source (foreground bits) */
100: GCPtr srcGC; /* Foreground GC */
101: PixmapPtr invSource; /* Cursor source inverted (background) */
102: GCPtr invSrcGC; /* Background GC */
103: PixmapPtr temp; /* Temporary pixmap for merging screenBits
104: * and the sources. Saves creation time */
105: Pixel fg; /* Foreground color */
106: Pixel bg; /* Background color */
107: int scrX, /* Screen X coordinate of screenBits */
108: scrY; /* Screen Y coordinate of screenBits */
109: CrState state; /* Current state of the cursor */
110: } CrPrivRec, *CrPrivPtr;
111:
112: /*
113: * Frame-buffer-private info.
114: * fd file opened to the frame buffer device.
115: * info description of the frame buffer -- type, height, depth,
116: * width, etc.
117: * fb pointer to the mapped image of the frame buffer. Used
118: * by the driving routines for the specific frame buffer
119: * type.
120: * pGC A GC for realizing cursors.
121: * GetImage Original GetImage function for this screen.
122: * CreateGC Original CreateGC function
123: * CreateWindow Original CreateWindow function
124: * ChangeWindowAttributes Original function
125: * GetSpans GC function which needs to be here b/c GetSpans isn't
126: * called with the GC as an argument...
127: * mapped flag set true by the driver when the frame buffer has
128: * been mapped in.
129: * fbPriv Data private to the frame buffer type.
130: */
131: typedef struct {
132: pointer fb; /* Frame buffer itself */
133: GCPtr pGC; /* GC for realizing cursors */
134:
135: void (*GetImage)();
136: Bool (*CreateGC)();/* GC Creation function previously in the
137: * Screen structure */
138: Bool (*CreateWindow)();
139: Bool (*ChangeWindowAttributes)();
140: unsigned int *(*GetSpans)();
141: void (*EnterLeave)();
142: Bool mapped; /* TRUE if frame buffer already mapped */
143: int fd; /* Descriptor open to frame buffer */
144: struct fbtype info; /* Frame buffer characteristics */
145: pointer fbPriv; /* Frame-buffer-dependent data */
146: } fbFd;
147:
148: /*
149: * Data describing each type of frame buffer. The probeProc is called to
150: * see if such a device exists and to do what needs doing if it does. devName
151: * is the expected name of the device in the file system. Note that this only
152: * allows one of each type of frame buffer. This may need changing later.
153: */
154: typedef enum {
155: neverProbed, probedAndSucceeded, probedAndFailed
156: } SunProbeStatus;
157:
158: /*
159: * ZOIDS should only ever be defined if SUN_WINDOWS is defined.
160: */
161: typedef struct _sunFbDataRec {
162: Bool (*probeProc)(); /* probe procedure for this fb */
163: char *devName; /* device filename */
164: SunProbeStatus probeStatus; /* TRUE if fb has been probed successfully */
165: } sunFbDataRec;
166:
167: extern sunFbDataRec sunFbData[];
168: /*
169: * Cursor functions
170: */
171: extern void sunInitCursor();
172: extern Bool sunRealizeCursor();
173: extern Bool sunUnrealizeCursor();
174: extern Bool sunDisplayCursor();
175: extern Bool sunSetCursorPosition();
176: extern void sunCursorLimits();
177: extern void sunPointerNonInterestBox();
178: extern void sunConstrainCursor();
179: extern void sunRecolorCursor();
180: extern Bool sunCursorLoc();
181: extern void sunRemoveCursor();
182: extern void sunRestoreCursor();
183:
184: /*
185: * Initialization
186: */
187: extern void sunScreenInit();
188: extern int sunOpenFrameBuffer();
189:
190: /*
191: * GC Interceptions
192: */
193: extern GCPtr sunCreatePrivGC();
194: extern Bool sunCreateGC();
195: extern Bool sunCreateWindow();
196: extern Bool sunChangeWindowAttributes();
197:
198: extern void sunGetImage();
199: extern unsigned int *sunGetSpans();
200:
201: extern int isItTimeToYield;
202: extern int sunCheckInput; /* Non-zero if input is available */
203:
204: extern fbFd sunFbs[];
205: extern Bool screenSaved; /* True is screen is being saved */
206:
207: extern int lastEventTime; /* Time (in ms.) of last event */
208: extern void SetTimeSinceLastInputEvent();
209: extern void ErrorF();
210:
211: #define AUTOREPEAT_INITIATE (300) /* milliseconds */
212: #define AUTOREPEAT_DELAY (100) /* milliseconds */
213: /*
214: * We signal autorepeat events with the unique Firm_event
215: * id AUTOREPEAT_EVENTID.
216: * Because inputevent ie_code is set to Firm_event ids in
217: * sunKbdProcessEventSunWin, and ie_code is short whereas
218: * Firm_event id is u_short, we use 0x7fff.
219: */
220: #define AUTOREPEAT_EVENTID (0x7fff) /* AutoRepeat Firm_event id */
221:
222: extern int autoRepeatKeyDown; /* TRUE if key down */
223: extern int autoRepeatReady; /* TRUE if time out */
224: extern int autoRepeatDebug; /* TRUE if debugging */
225:
226: #endif _SUN_H_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.