VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.5.3/dix.h@ 99743

Last change on this file since 99743 was 17471, checked in by vboxsync, 16 years ago

export to OSE

  • Property svn:eol-style set to native
File size: 13.9 KB
Line 
1/***********************************************************
2
3Copyright 1987, 1998 The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25
26Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28 All Rights Reserved
29
30Permission to use, copy, modify, and distribute this software and its
31documentation for any purpose and without fee is hereby granted,
32provided that the above copyright notice appear in all copies and that
33both that copyright notice and this permission notice appear in
34supporting documentation, and that the name of Digital not be
35used in advertising or publicity pertaining to distribution of the
36software without specific, written prior permission.
37
38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44SOFTWARE.
45
46******************************************************************/
47
48#ifndef DIX_H
49#define DIX_H
50
51#include "gc.h"
52#include "window.h"
53#include "input.h"
54
55#define EARLIER -1
56#define SAMETIME 0
57#define LATER 1
58
59#define NullClient ((ClientPtr) 0)
60#define REQUEST(type) \
61 register type *stuff = (type *)client->requestBuffer
62
63
64#define REQUEST_SIZE_MATCH(req)\
65 if ((sizeof(req) >> 2) != client->req_len)\
66 return(BadLength)
67
68#define REQUEST_AT_LEAST_SIZE(req) \
69 if ((sizeof(req) >> 2) > client->req_len )\
70 return(BadLength)
71
72#define REQUEST_FIXED_SIZE(req, n)\
73 if (((sizeof(req) >> 2) > client->req_len) || \
74 (((sizeof(req) + (n) + 3) >> 2) != client->req_len)) \
75 return(BadLength)
76
77#define LEGAL_NEW_RESOURCE(id,client)\
78 if (!LegalNewID(id,client)) \
79 {\
80 client->errorValue = id;\
81 return(BadIDChoice);\
82 }
83
84#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\
85 {\
86 int rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\
87 if (rc != Success)\
88 return rc;\
89 rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\
90 if (rc != Success)\
91 return rc;\
92 if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\
93 return (BadMatch);\
94 }\
95 if (pGC->serialNumber != pDraw->serialNumber)\
96 ValidateGC(pDraw, pGC);
97
98
99#define WriteReplyToClient(pClient, size, pReply) { \
100 if ((pClient)->swapped) \
101 (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \
102 (pClient, (int)(size), pReply); \
103 else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); }
104
105#define WriteSwappedDataToClient(pClient, size, pbuf) \
106 if ((pClient)->swapped) \
107 (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \
108 else (void) WriteToClient (pClient, (int)(size), (char *)(pbuf));
109
110typedef struct _TimeStamp *TimeStampPtr;
111
112#ifndef _XTYPEDEF_CLIENTPTR
113typedef struct _Client *ClientPtr; /* also in misc.h */
114#define _XTYPEDEF_CLIENTPTR
115#endif
116
117typedef struct _WorkQueue *WorkQueuePtr;
118
119#ifdef XPRINT
120extern ClientPtr requestingClient;
121#endif
122extern ClientPtr *clients;
123extern ClientPtr serverClient;
124extern int currentMaxClients;
125extern char dispatchExceptionAtReset;
126
127typedef int HWEventQueueType;
128typedef HWEventQueueType* HWEventQueuePtr;
129
130extern HWEventQueuePtr checkForInput[2];
131
132typedef struct _TimeStamp {
133 CARD32 months; /* really ~49.7 days */
134 CARD32 milliseconds;
135} TimeStamp;
136
137/* dispatch.c */
138
139extern void SetInputCheck(
140 HWEventQueuePtr /*c0*/,
141 HWEventQueuePtr /*c1*/);
142
143extern void CloseDownClient(
144 ClientPtr /*client*/);
145
146extern void UpdateCurrentTime(void);
147
148extern void UpdateCurrentTimeIf(void);
149
150extern int dixDestroyPixmap(
151 pointer /*value*/,
152 XID /*pid*/);
153
154extern void InitClient(
155 ClientPtr /*client*/,
156 int /*i*/,
157 pointer /*ospriv*/);
158
159extern ClientPtr NextAvailableClient(
160 pointer /*ospriv*/);
161
162extern void SendErrorToClient(
163 ClientPtr /*client*/,
164 unsigned int /*majorCode*/,
165 unsigned int /*minorCode*/,
166 XID /*resId*/,
167 int /*errorCode*/);
168
169extern void MarkClientException(
170 ClientPtr /*client*/);
171
172#if defined(DDXBEFORERESET)
173extern void ddxBeforeReset (void);
174#endif
175
176/* dixutils.c */
177
178extern void CopyISOLatin1Lowered(
179 unsigned char * /*dest*/,
180 unsigned char * /*source*/,
181 int /*length*/);
182
183extern int CompareISOLatin1Lowered(
184 unsigned char * /*a*/,
185 int alen,
186 unsigned char * /*b*/,
187 int blen);
188
189extern int dixLookupWindow(
190 WindowPtr *result,
191 XID id,
192 ClientPtr client,
193 Mask access_mode);
194
195extern int dixLookupDrawable(
196 DrawablePtr *result,
197 XID id,
198 ClientPtr client,
199 Mask type_mask,
200 Mask access_mode);
201
202extern int dixLookupGC(
203 GCPtr *result,
204 XID id,
205 ClientPtr client,
206 Mask access_mode);
207
208extern int dixLookupClient(
209 ClientPtr *result,
210 XID id,
211 ClientPtr client,
212 Mask access_mode);
213
214extern void NoopDDA(void);
215
216extern int AlterSaveSetForClient(
217 ClientPtr /*client*/,
218 WindowPtr /*pWin*/,
219 unsigned /*mode*/,
220 Bool /*toRoot*/,
221 Bool /*remap*/);
222
223extern void DeleteWindowFromAnySaveSet(
224 WindowPtr /*pWin*/);
225
226extern void BlockHandler(
227 pointer /*pTimeout*/,
228 pointer /*pReadmask*/);
229
230extern void WakeupHandler(
231 int /*result*/,
232 pointer /*pReadmask*/);
233
234typedef void (* WakeupHandlerProcPtr)(
235 pointer /* blockData */,
236 int /* result */,
237 pointer /* pReadmask */);
238
239extern Bool RegisterBlockAndWakeupHandlers(
240 BlockHandlerProcPtr /*blockHandler*/,
241 WakeupHandlerProcPtr /*wakeupHandler*/,
242 pointer /*blockData*/);
243
244extern void RemoveBlockAndWakeupHandlers(
245 BlockHandlerProcPtr /*blockHandler*/,
246 WakeupHandlerProcPtr /*wakeupHandler*/,
247 pointer /*blockData*/);
248
249extern void InitBlockAndWakeupHandlers(void);
250
251extern void ProcessWorkQueue(void);
252
253extern void ProcessWorkQueueZombies(void);
254
255extern Bool QueueWorkProc(
256 Bool (* /*function*/)(
257 ClientPtr /*clientUnused*/,
258 pointer /*closure*/),
259 ClientPtr /*client*/,
260 pointer /*closure*/
261);
262
263typedef Bool (* ClientSleepProcPtr)(
264 ClientPtr /*client*/,
265 pointer /*closure*/);
266
267extern Bool ClientSleep(
268 ClientPtr /*client*/,
269 ClientSleepProcPtr /* function */,
270 pointer /*closure*/);
271
272#ifndef ___CLIENTSIGNAL_DEFINED___
273#define ___CLIENTSIGNAL_DEFINED___
274extern Bool ClientSignal(
275 ClientPtr /*client*/);
276#endif /* ___CLIENTSIGNAL_DEFINED___ */
277
278extern void ClientWakeup(
279 ClientPtr /*client*/);
280
281extern Bool ClientIsAsleep(
282 ClientPtr /*client*/);
283
284/* atom.c */
285
286extern Atom MakeAtom(
287 char * /*string*/,
288 unsigned /*len*/,
289 Bool /*makeit*/);
290
291extern Bool ValidAtom(
292 Atom /*atom*/);
293
294extern char *NameForAtom(
295 Atom /*atom*/);
296
297extern void AtomError(void);
298
299extern void FreeAllAtoms(void);
300
301extern void InitAtoms(void);
302
303/* main.c */
304
305extern void SetVendorRelease(int release);
306
307extern void SetVendorString(char *string);
308
309/* events.c */
310
311extern void SetMaskForEvent(
312 Mask /* mask */,
313 int /* event */);
314
315
316extern Bool IsParent(
317 WindowPtr /* maybeparent */,
318 WindowPtr /* child */);
319
320extern WindowPtr GetCurrentRootWindow(void);
321
322extern WindowPtr GetSpriteWindow(void);
323
324
325extern void NoticeEventTime(xEventPtr /* xE */);
326
327extern void EnqueueEvent(
328 xEventPtr /* xE */,
329 DeviceIntPtr /* device */,
330 int /* count */);
331
332extern void ActivatePointerGrab(
333 DeviceIntPtr /* mouse */,
334 GrabPtr /* grab */,
335 TimeStamp /* time */,
336 Bool /* autoGrab */);
337
338extern void DeactivatePointerGrab(
339 DeviceIntPtr /* mouse */);
340
341extern void ActivateKeyboardGrab(
342 DeviceIntPtr /* keybd */,
343 GrabPtr /* grab */,
344 TimeStamp /* time */,
345 Bool /* passive */);
346
347extern void DeactivateKeyboardGrab(
348 DeviceIntPtr /* keybd */);
349
350extern void AllowSome(
351 ClientPtr /* client */,
352 TimeStamp /* time */,
353 DeviceIntPtr /* thisDev */,
354 int /* newState */);
355
356extern void ReleaseActiveGrabs(
357 ClientPtr client);
358
359extern int DeliverEventsToWindow(
360 WindowPtr /* pWin */,
361 xEventPtr /* pEvents */,
362 int /* count */,
363 Mask /* filter */,
364 GrabPtr /* grab */,
365 int /* mskidx */);
366
367extern int DeliverDeviceEvents(
368 WindowPtr /* pWin */,
369 xEventPtr /* xE */,
370 GrabPtr /* grab */,
371 WindowPtr /* stopAt */,
372 DeviceIntPtr /* dev */,
373 int /* count */);
374
375extern void DefineInitialRootWindow(
376 WindowPtr /* win */);
377
378extern void UpdateSpriteForScreen(
379 ScreenPtr /* pScreen */);
380
381extern void WindowHasNewCursor(
382 WindowPtr /* pWin */);
383
384extern Bool CheckDeviceGrabs(
385 DeviceIntPtr /* device */,
386 xEventPtr /* xE */,
387 int /* checkFirst */,
388 int /* count */);
389
390extern void DeliverFocusedEvent(
391 DeviceIntPtr /* keybd */,
392 xEventPtr /* xE */,
393 WindowPtr /* window */,
394 int /* count */);
395
396extern void DeliverGrabbedEvent(
397 xEventPtr /* xE */,
398 DeviceIntPtr /* thisDev */,
399 Bool /* deactivateGrab */,
400 int /* count */);
401
402#ifdef XKB
403extern void FixKeyState(
404 xEvent * /* xE */,
405 DeviceIntPtr /* keybd */);
406#endif /* XKB */
407
408extern void RecalculateDeliverableEvents(
409 WindowPtr /* pWin */);
410
411extern int OtherClientGone(
412 pointer /* value */,
413 XID /* id */);
414
415extern void DoFocusEvents(
416 DeviceIntPtr /* dev */,
417 WindowPtr /* fromWin */,
418 WindowPtr /* toWin */,
419 int /* mode */);
420
421extern int SetInputFocus(
422 ClientPtr /* client */,
423 DeviceIntPtr /* dev */,
424 Window /* focusID */,
425 CARD8 /* revertTo */,
426 Time /* ctime */,
427 Bool /* followOK */);
428
429extern int GrabDevice(
430 ClientPtr /* client */,
431 DeviceIntPtr /* dev */,
432 unsigned /* this_mode */,
433 unsigned /* other_mode */,
434 Window /* grabWindow */,
435 unsigned /* ownerEvents */,
436 Time /* ctime */,
437 Mask /* mask */,
438 CARD8 * /* status */);
439
440extern void InitEvents(void);
441
442extern void CloseDownEvents(void);
443
444extern void DeleteWindowFromAnyEvents(
445 WindowPtr /* pWin */,
446 Bool /* freeResources */);
447
448
449extern Mask EventMaskForClient(
450 WindowPtr /* pWin */,
451 ClientPtr /* client */);
452
453
454
455extern int DeliverEvents(
456 WindowPtr /*pWin*/,
457 xEventPtr /*xE*/,
458 int /*count*/,
459 WindowPtr /*otherParent*/);
460
461
462extern void WriteEventsToClient(
463 ClientPtr /*pClient*/,
464 int /*count*/,
465 xEventPtr /*events*/);
466
467extern int TryClientEvents(
468 ClientPtr /*client*/,
469 xEventPtr /*pEvents*/,
470 int /*count*/,
471 Mask /*mask*/,
472 Mask /*filter*/,
473 GrabPtr /*grab*/);
474
475extern void WindowsRestructured(void);
476
477#ifdef PANORAMIX
478extern void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff);
479#endif
480
481#ifdef RANDR
482void
483ScreenRestructured (ScreenPtr pScreen);
484#endif
485
486extern int ffs(int i);
487
488/*
489 * callback manager stuff
490 */
491
492#ifndef _XTYPEDEF_CALLBACKLISTPTR
493typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */
494#define _XTYPEDEF_CALLBACKLISTPTR
495#endif
496
497typedef void (*CallbackProcPtr) (
498 CallbackListPtr *, pointer, pointer);
499
500extern Bool AddCallback(
501 CallbackListPtr * /*pcbl*/,
502 CallbackProcPtr /*callback*/,
503 pointer /*data*/);
504
505extern Bool DeleteCallback(
506 CallbackListPtr * /*pcbl*/,
507 CallbackProcPtr /*callback*/,
508 pointer /*data*/);
509
510extern void CallCallbacks(
511 CallbackListPtr * /*pcbl*/,
512 pointer /*call_data*/);
513
514extern void DeleteCallbackList(
515 CallbackListPtr * /*pcbl*/);
516
517extern void InitCallbackManager(void);
518
519/*
520 * ServerGrabCallback stuff
521 */
522
523extern CallbackListPtr ServerGrabCallback;
524
525typedef enum {SERVER_GRABBED, SERVER_UNGRABBED,
526 CLIENT_PERVIOUS, CLIENT_IMPERVIOUS } ServerGrabState;
527
528typedef struct {
529 ClientPtr client;
530 ServerGrabState grabstate;
531} ServerGrabInfoRec;
532
533/*
534 * EventCallback stuff
535 */
536
537extern CallbackListPtr EventCallback;
538
539typedef struct {
540 ClientPtr client;
541 xEventPtr events;
542 int count;
543} EventInfoRec;
544
545/*
546 * DeviceEventCallback stuff
547 */
548
549extern CallbackListPtr DeviceEventCallback;
550
551typedef struct {
552 xEventPtr events;
553 int count;
554} DeviceEventInfoRec;
555
556/* strcasecmp.c */
557#if NEED_STRCASECMP
558#define strcasecmp xstrcasecmp
559extern int xstrcasecmp(const char *s1, const char *s2);
560#endif
561
562#if NEED_STRNCASECMP
563#define strncasecmp xstrncasecmp
564extern int xstrncasecmp(const char *s1, const char *s2, size_t n);
565#endif
566
567#if NEED_STRCASESTR
568#define strcasestr xstrcasestr
569extern char *xstrcasestr(const char *s, const char *find);
570#endif
571
572/*
573 * These are deprecated compatibility functions and will be removed soon!
574 * Please use the noted replacements instead.
575 */
576
577/* replaced by dixLookupWindow */
578extern WindowPtr SecurityLookupWindow(
579 XID id,
580 ClientPtr client,
581 Mask access_mode);
582
583/* replaced by dixLookupWindow */
584extern WindowPtr LookupWindow(
585 XID id,
586 ClientPtr client);
587
588/* replaced by dixLookupDrawable */
589extern pointer SecurityLookupDrawable(
590 XID id,
591 ClientPtr client,
592 Mask access_mode);
593
594/* replaced by dixLookupDrawable */
595extern pointer LookupDrawable(
596 XID id,
597 ClientPtr client);
598
599/* replaced by dixLookupClient */
600extern ClientPtr LookupClient(
601 XID id,
602 ClientPtr client);
603
604#endif /* DIX_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette