1 | /***********************************************************
|
---|
2 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
---|
3 |
|
---|
4 | All Rights Reserved
|
---|
5 |
|
---|
6 | Permission to use, copy, modify, and distribute this software and its
|
---|
7 | documentation for any purpose and without fee is hereby granted,
|
---|
8 | provided that the above copyright notice appear in all copies and that
|
---|
9 | both that copyright notice and this permission notice appear in
|
---|
10 | supporting documentation, and that the name of Digital not be
|
---|
11 | used in advertising or publicity pertaining to distribution of the
|
---|
12 | software without specific, written prior permission.
|
---|
13 |
|
---|
14 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
---|
15 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
---|
16 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
---|
17 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
---|
18 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
---|
19 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
20 | SOFTWARE.
|
---|
21 |
|
---|
22 | ******************************************************************/
|
---|
23 |
|
---|
24 | #ifndef DIXSTRUCT_H
|
---|
25 | #define DIXSTRUCT_H
|
---|
26 |
|
---|
27 | #include "client.h"
|
---|
28 | #include "dix.h"
|
---|
29 | #include "resource.h"
|
---|
30 | #include "cursor.h"
|
---|
31 | #include "gc.h"
|
---|
32 | #include "pixmap.h"
|
---|
33 | #include "privates.h"
|
---|
34 | #include <X11/Xmd.h>
|
---|
35 |
|
---|
36 | /*
|
---|
37 | * direct-mapped hash table, used by resource manager to store
|
---|
38 | * translation from client ids to server addresses.
|
---|
39 | */
|
---|
40 |
|
---|
41 | extern _X_EXPORT CallbackListPtr ClientStateCallback;
|
---|
42 |
|
---|
43 | typedef struct {
|
---|
44 | ClientPtr client;
|
---|
45 | xConnSetupPrefix *prefix;
|
---|
46 | xConnSetup *setup;
|
---|
47 | } NewClientInfoRec;
|
---|
48 |
|
---|
49 | typedef void (*ReplySwapPtr) (ClientPtr /* pClient */ ,
|
---|
50 | int /* size */ ,
|
---|
51 | void * /* pbuf */ );
|
---|
52 |
|
---|
53 | extern _X_EXPORT void
|
---|
54 | ReplyNotSwappd(ClientPtr /* pClient */ ,
|
---|
55 | int /* size */ ,
|
---|
56 | void * /* pbuf */ ) _X_NORETURN;
|
---|
57 |
|
---|
58 | typedef enum { ClientStateInitial,
|
---|
59 | ClientStateRunning,
|
---|
60 | ClientStateRetained,
|
---|
61 | ClientStateGone
|
---|
62 | } ClientState;
|
---|
63 |
|
---|
64 | typedef struct _saveSet {
|
---|
65 | struct _Window *windowPtr;
|
---|
66 | Bool toRoot;
|
---|
67 | Bool map;
|
---|
68 | } SaveSetElt;
|
---|
69 | #define SaveSetWindow(ss) ((ss).windowPtr)
|
---|
70 | #define SaveSetToRoot(ss) ((ss).toRoot)
|
---|
71 | #define SaveSetShouldMap(ss) ((ss).map)
|
---|
72 | #define SaveSetAssignWindow(ss,w) ((ss).windowPtr = (w))
|
---|
73 | #define SaveSetAssignToRoot(ss,tr) ((ss).toRoot = (tr))
|
---|
74 | #define SaveSetAssignMap(ss,m) ((ss).map = (m))
|
---|
75 |
|
---|
76 | typedef struct _Client {
|
---|
77 | void *requestBuffer;
|
---|
78 | void *osPrivate; /* for OS layer, including scheduler */
|
---|
79 | Mask clientAsMask;
|
---|
80 | short index;
|
---|
81 | unsigned char majorOp, minorOp;
|
---|
82 | unsigned int swapped:1;
|
---|
83 | unsigned int local:1;
|
---|
84 | unsigned int big_requests:1; /* supports large requests */
|
---|
85 | unsigned int clientGone:1;
|
---|
86 | unsigned int closeDownMode:2;
|
---|
87 | unsigned int clientState:2;
|
---|
88 | signed char smart_priority;
|
---|
89 | short noClientException; /* this client died or needs to be killed */
|
---|
90 | int priority;
|
---|
91 | ReplySwapPtr pSwapReplyFunc;
|
---|
92 | XID errorValue;
|
---|
93 | int sequence;
|
---|
94 | int ignoreCount; /* count for Attend/IgnoreClient */
|
---|
95 | int numSaved;
|
---|
96 | SaveSetElt *saveSet;
|
---|
97 | int (**requestVector) (ClientPtr /* pClient */ );
|
---|
98 | CARD32 req_len; /* length of current request */
|
---|
99 | unsigned int replyBytesRemaining;
|
---|
100 | PrivateRec *devPrivates;
|
---|
101 | unsigned short xkbClientFlags;
|
---|
102 | unsigned short mapNotifyMask;
|
---|
103 | unsigned short newKeyboardNotifyMask;
|
---|
104 | unsigned short vMajor, vMinor;
|
---|
105 | KeyCode minKC, maxKC;
|
---|
106 |
|
---|
107 | int smart_start_tick;
|
---|
108 | int smart_stop_tick;
|
---|
109 |
|
---|
110 | DeviceIntPtr clientPtr;
|
---|
111 | ClientIdPtr clientIds;
|
---|
112 | #if XTRANS_SEND_FDS
|
---|
113 | int req_fds;
|
---|
114 | #endif
|
---|
115 | } ClientRec;
|
---|
116 |
|
---|
117 | #if XTRANS_SEND_FDS
|
---|
118 | static inline void
|
---|
119 | SetReqFds(ClientPtr client, int req_fds) {
|
---|
120 | if (client->req_fds != 0 && req_fds != client->req_fds)
|
---|
121 | LogMessage(X_ERROR, "Mismatching number of request fds %d != %d\n", req_fds, client->req_fds);
|
---|
122 | client->req_fds = req_fds;
|
---|
123 | }
|
---|
124 | #endif
|
---|
125 |
|
---|
126 | /*
|
---|
127 | * Scheduling interface
|
---|
128 | */
|
---|
129 | extern _X_EXPORT long SmartScheduleTime;
|
---|
130 | extern _X_EXPORT long SmartScheduleInterval;
|
---|
131 | extern _X_EXPORT long SmartScheduleSlice;
|
---|
132 | extern _X_EXPORT long SmartScheduleMaxSlice;
|
---|
133 | extern _X_EXPORT Bool SmartScheduleDisable;
|
---|
134 | extern _X_EXPORT void
|
---|
135 | SmartScheduleStartTimer(void);
|
---|
136 | extern _X_EXPORT void
|
---|
137 | SmartScheduleStopTimer(void);
|
---|
138 |
|
---|
139 | #define SMART_MAX_PRIORITY (20)
|
---|
140 | #define SMART_MIN_PRIORITY (-20)
|
---|
141 |
|
---|
142 | extern _X_EXPORT void
|
---|
143 | SmartScheduleInit(void);
|
---|
144 |
|
---|
145 | /* This prototype is used pervasively in Xext, dix */
|
---|
146 | #define DISPATCH_PROC(func) int func(ClientPtr /* client */)
|
---|
147 |
|
---|
148 | typedef struct _WorkQueue {
|
---|
149 | struct _WorkQueue *next;
|
---|
150 | Bool (*function) (ClientPtr /* pClient */ ,
|
---|
151 | void * /* closure */
|
---|
152 | );
|
---|
153 | ClientPtr client;
|
---|
154 | void *closure;
|
---|
155 | } WorkQueueRec;
|
---|
156 |
|
---|
157 | extern _X_EXPORT TimeStamp currentTime;
|
---|
158 |
|
---|
159 | extern _X_EXPORT int
|
---|
160 | CompareTimeStamps(TimeStamp /*a */ ,
|
---|
161 | TimeStamp /*b */ );
|
---|
162 |
|
---|
163 | extern _X_EXPORT TimeStamp
|
---|
164 | ClientTimeToServerTime(CARD32 /*c */ );
|
---|
165 |
|
---|
166 | typedef struct _CallbackRec {
|
---|
167 | CallbackProcPtr proc;
|
---|
168 | void *data;
|
---|
169 | Bool deleted;
|
---|
170 | struct _CallbackRec *next;
|
---|
171 | } CallbackRec, *CallbackPtr;
|
---|
172 |
|
---|
173 | typedef struct _CallbackList {
|
---|
174 | int inCallback;
|
---|
175 | Bool deleted;
|
---|
176 | int numDeleted;
|
---|
177 | CallbackPtr list;
|
---|
178 | } CallbackListRec;
|
---|
179 |
|
---|
180 | /* proc vectors */
|
---|
181 |
|
---|
182 | extern _X_EXPORT int (*InitialVector[3]) (ClientPtr /*client */ );
|
---|
183 |
|
---|
184 | extern _X_EXPORT int (*ProcVector[256]) (ClientPtr /*client */ );
|
---|
185 |
|
---|
186 | extern _X_EXPORT int (*SwappedProcVector[256]) (ClientPtr /*client */ );
|
---|
187 |
|
---|
188 | extern _X_EXPORT ReplySwapPtr ReplySwapVector[256];
|
---|
189 |
|
---|
190 | extern _X_EXPORT int
|
---|
191 | ProcBadRequest(ClientPtr /*client */ );
|
---|
192 |
|
---|
193 | #endif /* DIXSTRUCT_H */
|
---|