VirtualBox

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

Last change on this file since 47550 was 43272, checked in by vboxsync, 12 years ago

Additions/x11: more original X server headers.

  • Property svn:eol-style set to native
File size: 15.7 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#include "cursor.h"
55#include "geext.h"
56#include "events.h"
57#include <X11/extensions/XI.h>
58
59#define EARLIER -1
60#define SAMETIME 0
61#define LATER 1
62
63#define NullClient ((ClientPtr) 0)
64#define REQUEST(type) \
65 type *stuff = (type *)client->requestBuffer
66
67
68#define REQUEST_SIZE_MATCH(req)\
69 if ((sizeof(req) >> 2) != client->req_len)\
70 return(BadLength)
71
72#define REQUEST_AT_LEAST_SIZE(req) \
73 if ((sizeof(req) >> 2) > client->req_len )\
74 return(BadLength)
75
76#define REQUEST_FIXED_SIZE(req, n)\
77 if (((sizeof(req) >> 2) > client->req_len) || \
78 (((sizeof(req) + (n) + 3) >> 2) != client->req_len)) \
79 return(BadLength)
80
81#define LEGAL_NEW_RESOURCE(id,client)\
82 if (!LegalNewID(id,client)) \
83 {\
84 client->errorValue = id;\
85 return(BadIDChoice);\
86 }
87
88#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\
89 {\
90 int rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\
91 if (rc != Success)\
92 return rc;\
93 rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\
94 if (rc != Success)\
95 return rc;\
96 if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\
97 return (BadMatch);\
98 }\
99 if (pGC->serialNumber != pDraw->serialNumber)\
100 ValidateGC(pDraw, pGC);
101
102
103#define WriteReplyToClient(pClient, size, pReply) { \
104 if ((pClient)->swapped) \
105 (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \
106 (pClient, (int)(size), pReply); \
107 else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); }
108
109#define WriteSwappedDataToClient(pClient, size, pbuf) \
110 if ((pClient)->swapped) \
111 (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \
112 else (void) WriteToClient (pClient, (int)(size), (char *)(pbuf));
113
114typedef struct _TimeStamp *TimeStampPtr;
115
116#ifndef _XTYPEDEF_CLIENTPTR
117typedef struct _Client *ClientPtr; /* also in misc.h */
118#define _XTYPEDEF_CLIENTPTR
119#endif
120
121typedef struct _WorkQueue *WorkQueuePtr;
122
123extern _X_EXPORT ClientPtr clients[MAXCLIENTS];
124extern _X_EXPORT ClientPtr serverClient;
125extern _X_EXPORT int currentMaxClients;
126extern _X_EXPORT char dispatchExceptionAtReset;
127
128typedef int HWEventQueueType;
129typedef HWEventQueueType* HWEventQueuePtr;
130
131extern _X_EXPORT HWEventQueuePtr checkForInput[2];
132
133typedef struct _TimeStamp {
134 CARD32 months; /* really ~49.7 days */
135 CARD32 milliseconds;
136} TimeStamp;
137
138/* dispatch.c */
139
140extern _X_EXPORT void SetInputCheck(
141 HWEventQueuePtr /*c0*/,
142 HWEventQueuePtr /*c1*/);
143
144extern _X_EXPORT void CloseDownClient(
145 ClientPtr /*client*/);
146
147extern _X_EXPORT void UpdateCurrentTime(void);
148
149extern _X_EXPORT void UpdateCurrentTimeIf(void);
150
151extern _X_EXPORT int dixDestroyPixmap(
152 pointer /*value*/,
153 XID /*pid*/);
154
155extern _X_EXPORT void InitClient(
156 ClientPtr /*client*/,
157 int /*i*/,
158 pointer /*ospriv*/);
159
160extern _X_EXPORT ClientPtr NextAvailableClient(
161 pointer /*ospriv*/);
162
163extern _X_EXPORT void SendErrorToClient(
164 ClientPtr /*client*/,
165 unsigned int /*majorCode*/,
166 unsigned int /*minorCode*/,
167 XID /*resId*/,
168 int /*errorCode*/);
169
170extern _X_EXPORT void MarkClientException(
171 ClientPtr /*client*/);
172
173extern _X_HIDDEN Bool CreateConnectionBlock(void);
174/* dixutils.c */
175
176extern _X_EXPORT void CopyISOLatin1Lowered(
177 unsigned char * /*dest*/,
178 unsigned char * /*source*/,
179 int /*length*/);
180
181extern _X_EXPORT int CompareISOLatin1Lowered(
182 unsigned char * /*a*/,
183 int alen,
184 unsigned char * /*b*/,
185 int blen);
186
187extern _X_EXPORT int dixLookupWindow(
188 WindowPtr *result,
189 XID id,
190 ClientPtr client,
191 Mask access_mode);
192
193extern _X_EXPORT int dixLookupDrawable(
194 DrawablePtr *result,
195 XID id,
196 ClientPtr client,
197 Mask type_mask,
198 Mask access_mode);
199
200extern _X_EXPORT int dixLookupGC(
201 GCPtr *result,
202 XID id,
203 ClientPtr client,
204 Mask access_mode);
205
206extern _X_EXPORT int dixLookupClient(
207 ClientPtr *result,
208 XID id,
209 ClientPtr client,
210 Mask access_mode);
211
212extern _X_EXPORT void NoopDDA(void);
213
214extern _X_EXPORT int AlterSaveSetForClient(
215 ClientPtr /*client*/,
216 WindowPtr /*pWin*/,
217 unsigned /*mode*/,
218 Bool /*toRoot*/,
219 Bool /*map*/);
220
221extern _X_EXPORT void DeleteWindowFromAnySaveSet(
222 WindowPtr /*pWin*/);
223
224extern _X_EXPORT void BlockHandler(
225 pointer /*pTimeout*/,
226 pointer /*pReadmask*/);
227
228extern _X_EXPORT void WakeupHandler(
229 int /*result*/,
230 pointer /*pReadmask*/);
231
232void
233EnableLimitedSchedulingLatency(void);
234
235void
236DisableLimitedSchedulingLatency(void);
237
238typedef void (* WakeupHandlerProcPtr)(
239 pointer /* blockData */,
240 int /* result */,
241 pointer /* pReadmask */);
242
243extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(
244 BlockHandlerProcPtr /*blockHandler*/,
245 WakeupHandlerProcPtr /*wakeupHandler*/,
246 pointer /*blockData*/);
247
248extern _X_EXPORT void RemoveBlockAndWakeupHandlers(
249 BlockHandlerProcPtr /*blockHandler*/,
250 WakeupHandlerProcPtr /*wakeupHandler*/,
251 pointer /*blockData*/);
252
253extern _X_EXPORT void InitBlockAndWakeupHandlers(void);
254
255extern _X_EXPORT void ProcessWorkQueue(void);
256
257extern _X_EXPORT void ProcessWorkQueueZombies(void);
258
259extern _X_EXPORT Bool QueueWorkProc(
260 Bool (* /*function*/)(
261 ClientPtr /*clientUnused*/,
262 pointer /*closure*/),
263 ClientPtr /*client*/,
264 pointer /*closure*/
265);
266
267typedef Bool (* ClientSleepProcPtr)(
268 ClientPtr /*client*/,
269 pointer /*closure*/);
270
271extern _X_EXPORT Bool ClientSleep(
272 ClientPtr /*client*/,
273 ClientSleepProcPtr /* function */,
274 pointer /*closure*/);
275
276#ifndef ___CLIENTSIGNAL_DEFINED___
277#define ___CLIENTSIGNAL_DEFINED___
278extern _X_EXPORT Bool ClientSignal(
279 ClientPtr /*client*/);
280#endif /* ___CLIENTSIGNAL_DEFINED___ */
281
282extern _X_EXPORT void ClientWakeup(
283 ClientPtr /*client*/);
284
285extern _X_EXPORT Bool ClientIsAsleep(
286 ClientPtr /*client*/);
287
288/* atom.c */
289
290extern _X_EXPORT Atom MakeAtom(
291 const char * /*string*/,
292 unsigned /*len*/,
293 Bool /*makeit*/);
294
295extern _X_EXPORT Bool ValidAtom(
296 Atom /*atom*/);
297
298extern _X_EXPORT const char *NameForAtom(
299 Atom /*atom*/);
300
301extern _X_EXPORT void AtomError(void);
302
303extern _X_EXPORT void FreeAllAtoms(void);
304
305extern _X_EXPORT void InitAtoms(void);
306
307/* main.c */
308
309extern _X_EXPORT void SetVendorRelease(int release);
310
311extern _X_EXPORT void SetVendorString(char *string);
312
313/* events.c */
314
315extern void SetMaskForEvent(
316 int /* deviceid */,
317 Mask /* mask */,
318 int /* event */);
319
320extern _X_EXPORT void ConfineToShape(
321 DeviceIntPtr /* pDev */,
322 RegionPtr /* shape */,
323 int* /* px */,
324 int* /* py */);
325
326extern _X_EXPORT Bool IsParent(
327 WindowPtr /* maybeparent */,
328 WindowPtr /* child */);
329
330extern _X_EXPORT WindowPtr GetCurrentRootWindow(DeviceIntPtr pDev);
331
332extern _X_EXPORT WindowPtr GetSpriteWindow(DeviceIntPtr pDev);
333
334
335extern _X_EXPORT void NoticeEventTime(InternalEvent *ev);
336
337extern void EnqueueEvent(
338 InternalEvent * /* ev */,
339 DeviceIntPtr /* device */);
340
341extern void ActivatePointerGrab(
342 DeviceIntPtr /* mouse */,
343 GrabPtr /* grab */,
344 TimeStamp /* time */,
345 Bool /* autoGrab */);
346
347extern void DeactivatePointerGrab(
348 DeviceIntPtr /* mouse */);
349
350extern void ActivateKeyboardGrab(
351 DeviceIntPtr /* keybd */,
352 GrabPtr /* grab */,
353 TimeStamp /* time */,
354 Bool /* passive */);
355
356extern void DeactivateKeyboardGrab(
357 DeviceIntPtr /* keybd */);
358
359extern BOOL ActivateFocusInGrab(
360 DeviceIntPtr /* dev */,
361 WindowPtr /* old */,
362 WindowPtr /* win */);
363
364extern void AllowSome(
365 ClientPtr /* client */,
366 TimeStamp /* time */,
367 DeviceIntPtr /* thisDev */,
368 int /* newState */);
369
370extern void ReleaseActiveGrabs(
371 ClientPtr client);
372
373extern _X_EXPORT int DeliverEventsToWindow(
374 DeviceIntPtr /* pWin */,
375 WindowPtr /* pWin */,
376 xEventPtr /* pEvents */,
377 int /* count */,
378 Mask /* filter */,
379 GrabPtr /* grab */);
380
381extern int DeliverDeviceEvents(
382 WindowPtr /* pWin */,
383 InternalEvent* /* event */,
384 GrabPtr /* grab */,
385 WindowPtr /* stopAt */,
386 DeviceIntPtr /* dev */);
387
388extern void InitializeSprite(
389 DeviceIntPtr /* pDev */,
390 WindowPtr /* pWin */);
391
392extern void UpdateSpriteForScreen(
393 DeviceIntPtr /* pDev */,
394 ScreenPtr /* pScreen */);
395
396extern _X_EXPORT void WindowHasNewCursor(
397 WindowPtr /* pWin */);
398
399extern Bool CheckDeviceGrabs(
400 DeviceIntPtr /* device */,
401 DeviceEvent* /* event */,
402 int /* checkFirst */);
403
404extern void DeliverFocusedEvent(
405 DeviceIntPtr /* keybd */,
406 InternalEvent* /* event */,
407 WindowPtr /* window */);
408
409extern void DeliverGrabbedEvent(
410 InternalEvent* /* event */,
411 DeviceIntPtr /* thisDev */,
412 Bool /* deactivateGrab */);
413
414extern void FixKeyState(
415 DeviceEvent* /* event */,
416 DeviceIntPtr /* keybd */);
417
418extern void RecalculateDeliverableEvents(
419 WindowPtr /* pWin */);
420
421extern _X_EXPORT int OtherClientGone(
422 pointer /* value */,
423 XID /* id */);
424
425extern void DoFocusEvents(
426 DeviceIntPtr /* dev */,
427 WindowPtr /* fromWin */,
428 WindowPtr /* toWin */,
429 int /* mode */);
430
431extern int SetInputFocus(
432 ClientPtr /* client */,
433 DeviceIntPtr /* dev */,
434 Window /* focusID */,
435 CARD8 /* revertTo */,
436 Time /* ctime */,
437 Bool /* followOK */);
438
439extern int GrabDevice(
440 ClientPtr /* client */,
441 DeviceIntPtr /* dev */,
442 unsigned /* this_mode */,
443 unsigned /* other_mode */,
444 Window /* grabWindow */,
445 unsigned /* ownerEvents */,
446 Time /* ctime */,
447 GrabMask* /* mask */,
448 int /* grabtype */,
449 Cursor /* curs */,
450 Window /* confineToWin */,
451 CARD8 * /* status */);
452
453extern void InitEvents(void);
454
455extern void CloseDownEvents(void);
456
457extern void DeleteWindowFromAnyEvents(
458 WindowPtr /* pWin */,
459 Bool /* freeResources */);
460
461
462extern Mask EventMaskForClient(
463 WindowPtr /* pWin */,
464 ClientPtr /* client */);
465
466
467
468extern _X_EXPORT int DeliverEvents(
469 WindowPtr /*pWin*/,
470 xEventPtr /*xE*/,
471 int /*count*/,
472 WindowPtr /*otherParent*/);
473
474extern Bool CheckMotion(
475 DeviceEvent* /* ev */,
476 DeviceIntPtr /* pDev */);
477
478extern _X_EXPORT void WriteEventsToClient(
479 ClientPtr /*pClient*/,
480 int /*count*/,
481 xEventPtr /*events*/);
482
483extern _X_EXPORT int TryClientEvents(
484 ClientPtr /*client*/,
485 DeviceIntPtr /* device */,
486 xEventPtr /*pEvents*/,
487 int /*count*/,
488 Mask /*mask*/,
489 Mask /*filter*/,
490 GrabPtr /*grab*/);
491
492extern _X_EXPORT void WindowsRestructured(void);
493
494extern int SetClientPointer(
495 ClientPtr /* client */,
496 DeviceIntPtr /* device */);
497
498extern _X_EXPORT DeviceIntPtr PickPointer(
499 ClientPtr /* client */);
500
501extern _X_EXPORT DeviceIntPtr PickKeyboard(
502 ClientPtr /* client */);
503
504extern Bool IsInterferingGrab(
505 ClientPtr /* client */,
506 DeviceIntPtr /* dev */,
507 xEvent* /* events */);
508
509#ifdef PANORAMIX
510extern _X_EXPORT void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff);
511#endif
512
513#ifdef RANDR
514extern _X_EXPORT void
515ScreenRestructured (ScreenPtr pScreen);
516#endif
517
518extern _X_EXPORT int ffs(int i);
519
520/*
521 * callback manager stuff
522 */
523
524#ifndef _XTYPEDEF_CALLBACKLISTPTR
525typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */
526#define _XTYPEDEF_CALLBACKLISTPTR
527#endif
528
529typedef void (*CallbackProcPtr) (
530 CallbackListPtr *, pointer, pointer);
531
532extern _X_EXPORT Bool AddCallback(
533 CallbackListPtr * /*pcbl*/,
534 CallbackProcPtr /*callback*/,
535 pointer /*data*/);
536
537extern _X_EXPORT Bool DeleteCallback(
538 CallbackListPtr * /*pcbl*/,
539 CallbackProcPtr /*callback*/,
540 pointer /*data*/);
541
542extern _X_EXPORT void CallCallbacks(
543 CallbackListPtr * /*pcbl*/,
544 pointer /*call_data*/);
545
546extern _X_EXPORT void DeleteCallbackList(
547 CallbackListPtr * /*pcbl*/);
548
549extern _X_EXPORT void InitCallbackManager(void);
550
551/*
552 * ServerGrabCallback stuff
553 */
554
555extern _X_EXPORT CallbackListPtr ServerGrabCallback;
556
557typedef enum {SERVER_GRABBED, SERVER_UNGRABBED,
558 CLIENT_PERVIOUS, CLIENT_IMPERVIOUS } ServerGrabState;
559
560typedef struct {
561 ClientPtr client;
562 ServerGrabState grabstate;
563} ServerGrabInfoRec;
564
565/*
566 * EventCallback stuff
567 */
568
569extern _X_EXPORT CallbackListPtr EventCallback;
570
571typedef struct {
572 ClientPtr client;
573 xEventPtr events;
574 int count;
575} EventInfoRec;
576
577/*
578 * DeviceEventCallback stuff
579 */
580
581extern _X_EXPORT CallbackListPtr DeviceEventCallback;
582
583typedef struct {
584 InternalEvent *event;
585 DeviceIntPtr device;
586} DeviceEventInfoRec;
587
588extern int XItoCoreType(int xi_type);
589extern Bool DevHasCursor(DeviceIntPtr pDev);
590extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev);
591extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev);
592extern Bool IsPointerEvent(InternalEvent *event);
593extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev);
594
595extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
596extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);
597extern _X_HIDDEN int CoreKeyboardProc(DeviceIntPtr dev, int what);
598
599
600/*
601 * These are deprecated compatibility functions and will be removed soon!
602 * Please use the noted replacements instead.
603 */
604/* replaced by dixLookupWindow */
605extern _X_EXPORT WindowPtr SecurityLookupWindow(
606 XID id,
607 ClientPtr client,
608 Mask access_mode);
609/* replaced by dixLookupWindow */
610extern _X_EXPORT WindowPtr LookupWindow(
611 XID id,
612 ClientPtr client);
613
614/* replaced by dixLookupDrawable */
615extern _X_EXPORT pointer SecurityLookupDrawable(
616 XID id,
617 ClientPtr client,
618 Mask access_mode);
619
620/* replaced by dixLookupDrawable */
621extern _X_EXPORT pointer LookupDrawable(
622 XID id,
623 ClientPtr client);
624
625/* replaced by dixLookupClient */
626extern _X_EXPORT ClientPtr LookupClient(
627 XID id,
628 ClientPtr client);
629
630#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