VirtualBox

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

Last change on this file since 61522 was 36308, checked in by vboxsync, 14 years ago

fix OSE

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