VirtualBox

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

Last change on this file since 78374 was 54163, checked in by vboxsync, 10 years ago

Additions/x11/vboxvideo: support X.Org Server 1.17 (still untested).

  • Property svn:eol-style set to native
File size: 18.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
25Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
26
27 All Rights Reserved
28
29Permission to use, copy, modify, and distribute this software and its
30documentation for any purpose and without fee is hereby granted,
31provided that the above copyright notice appear in all copies and that
32both that copyright notice and this permission notice appear in
33supporting documentation, and that the name of Digital not be
34used in advertising or publicity pertaining to distribution of the
35software without specific, written prior permission.
36
37DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43SOFTWARE.
44
45******************************************************************/
46
47#ifndef DIX_H
48#define DIX_H
49
50#include "callback.h"
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#define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]))
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_AT_LEAST_EXTRA_SIZE(req, extra) \
78 if (((sizeof(req) + ((uint64_t) extra)) >> 2) > client->req_len ) \
79 return(BadLength)
80
81#define REQUEST_FIXED_SIZE(req, n)\
82 if (((sizeof(req) >> 2) > client->req_len) || \
83 (((n) >> 2) >= client->req_len) || \
84 ((((uint64_t) sizeof(req) + (n) + 3) >> 2) != (uint64_t) client->req_len)) \
85 return(BadLength)
86
87#define LEGAL_NEW_RESOURCE(id,client)\
88 if (!LegalNewID(id,client)) \
89 {\
90 client->errorValue = id;\
91 return BadIDChoice;\
92 }
93
94#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\
95 {\
96 int tmprc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\
97 if (tmprc != Success)\
98 return tmprc;\
99 tmprc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\
100 if (tmprc != Success)\
101 return tmprc;\
102 if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\
103 return BadMatch;\
104 }\
105 if (pGC->serialNumber != pDraw->serialNumber)\
106 ValidateGC(pDraw, pGC);
107
108#define WriteReplyToClient(pClient, size, pReply) { \
109 if ((pClient)->swapped) \
110 (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \
111 (pClient, (int)(size), pReply); \
112 else WriteToClient(pClient, (int)(size), (pReply)); }
113
114#define WriteSwappedDataToClient(pClient, size, pbuf) \
115 if ((pClient)->swapped) \
116 (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \
117 else WriteToClient(pClient, (int)(size), (pbuf));
118
119typedef struct _TimeStamp *TimeStampPtr;
120
121#ifndef _XTYPEDEF_CLIENTPTR
122typedef struct _Client *ClientPtr; /* also in misc.h */
123
124#define _XTYPEDEF_CLIENTPTR
125#endif
126
127typedef struct _WorkQueue *WorkQueuePtr;
128
129extern _X_EXPORT ClientPtr clients[MAXCLIENTS];
130extern _X_EXPORT ClientPtr serverClient;
131extern _X_EXPORT int currentMaxClients;
132extern _X_EXPORT char dispatchExceptionAtReset;
133
134typedef int HWEventQueueType;
135typedef HWEventQueueType *HWEventQueuePtr;
136
137extern _X_EXPORT HWEventQueuePtr checkForInput[2];
138
139typedef struct _TimeStamp {
140 CARD32 months; /* really ~49.7 days */
141 CARD32 milliseconds;
142} TimeStamp;
143
144/* dispatch.c */
145
146extern _X_EXPORT void SetInputCheck(HWEventQueuePtr /*c0 */ ,
147 HWEventQueuePtr /*c1 */ );
148
149extern _X_EXPORT void CloseDownClient(ClientPtr /*client */ );
150
151extern _X_EXPORT void UpdateCurrentTime(void);
152
153extern _X_EXPORT void UpdateCurrentTimeIf(void);
154
155extern _X_EXPORT int dixDestroyPixmap(void *value,
156 XID pid);
157
158extern _X_EXPORT void InitClient(ClientPtr client,
159 int i,
160 void *ospriv);
161
162extern _X_EXPORT ClientPtr NextAvailableClient(void *ospriv);
163
164extern _X_EXPORT void SendErrorToClient(ClientPtr /*client */ ,
165 unsigned int /*majorCode */ ,
166 unsigned int /*minorCode */ ,
167 XID /*resId */ ,
168 int /*errorCode */ );
169
170extern _X_EXPORT void MarkClientException(ClientPtr /*client */ );
171
172extern _X_HIDDEN Bool CreateConnectionBlock(void);
173
174/* dixutils.c */
175
176extern _X_EXPORT int CompareISOLatin1Lowered(const unsigned char * /*a */ ,
177 int alen,
178 const unsigned char * /*b */ ,
179 int blen);
180
181extern _X_EXPORT int dixLookupWindow(WindowPtr *result,
182 XID id,
183 ClientPtr client, Mask access_mode);
184
185extern _X_EXPORT int dixLookupDrawable(DrawablePtr *result,
186 XID id,
187 ClientPtr client,
188 Mask type_mask, Mask access_mode);
189
190extern _X_EXPORT int dixLookupGC(GCPtr *result,
191 XID id, ClientPtr client, Mask access_mode);
192
193extern _X_EXPORT int dixLookupFontable(FontPtr *result,
194 XID id,
195 ClientPtr client, Mask access_mode);
196
197extern _X_EXPORT int dixLookupClient(ClientPtr *result,
198 XID id,
199 ClientPtr client, Mask access_mode);
200
201extern _X_EXPORT void NoopDDA(void);
202
203extern _X_EXPORT int AlterSaveSetForClient(ClientPtr /*client */ ,
204 WindowPtr /*pWin */ ,
205 unsigned /*mode */ ,
206 Bool /*toRoot */ ,
207 Bool /*map */ );
208
209extern _X_EXPORT void DeleteWindowFromAnySaveSet(WindowPtr /*pWin */ );
210
211extern _X_EXPORT void BlockHandler(void *pTimeout,
212 void *pReadmask);
213
214extern _X_EXPORT void WakeupHandler(int result,
215 void *pReadmask);
216
217void
218 EnableLimitedSchedulingLatency(void);
219
220void
221 DisableLimitedSchedulingLatency(void);
222
223typedef void (*WakeupHandlerProcPtr) (void *blockData,
224 int result,
225 void *pReadmask);
226
227extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
228 WakeupHandlerProcPtr wakeupHandler,
229 void *blockData);
230
231extern _X_EXPORT void RemoveBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
232 WakeupHandlerProcPtr wakeupHandler,
233 void *blockData);
234
235extern _X_EXPORT void InitBlockAndWakeupHandlers(void);
236
237extern _X_EXPORT void ProcessWorkQueue(void);
238
239extern _X_EXPORT void ProcessWorkQueueZombies(void);
240
241extern _X_EXPORT Bool QueueWorkProc(Bool (*function)(ClientPtr clientUnused,
242 void *closure),
243 ClientPtr client,
244 void *closure);
245
246typedef Bool (*ClientSleepProcPtr) (ClientPtr client,
247 void *closure);
248
249extern _X_EXPORT Bool ClientSleep(ClientPtr client,
250 ClientSleepProcPtr function,
251 void *closure);
252
253#ifndef ___CLIENTSIGNAL_DEFINED___
254#define ___CLIENTSIGNAL_DEFINED___
255extern _X_EXPORT Bool ClientSignal(ClientPtr /*client */ );
256#endif /* ___CLIENTSIGNAL_DEFINED___ */
257
258extern _X_EXPORT void ClientWakeup(ClientPtr /*client */ );
259
260extern _X_EXPORT Bool ClientIsAsleep(ClientPtr /*client */ );
261
262extern _X_EXPORT void SendGraphicsExpose(ClientPtr /*client */ ,
263 RegionPtr /*pRgn */ ,
264 XID /*drawable */ ,
265 int /*major */ ,
266 int /*minor */);
267
268/* atom.c */
269
270extern _X_EXPORT Atom MakeAtom(const char * /*string */ ,
271 unsigned /*len */ ,
272 Bool /*makeit */ );
273
274extern _X_EXPORT Bool ValidAtom(Atom /*atom */ );
275
276extern _X_EXPORT const char *NameForAtom(Atom /*atom */ );
277
278extern _X_EXPORT void
279AtomError(void)
280 _X_NORETURN;
281
282extern _X_EXPORT void
283FreeAllAtoms(void);
284
285extern _X_EXPORT void
286InitAtoms(void);
287
288/* main.c */
289
290extern _X_EXPORT void
291SetVendorRelease(int release);
292
293extern _X_EXPORT void
294SetVendorString(const char *string);
295
296int
297dix_main(int argc, char *argv[], char *envp[]);
298
299/* events.c */
300
301extern void
302SetMaskForEvent(int /* deviceid */ ,
303 Mask /* mask */ ,
304 int /* event */ );
305
306extern _X_EXPORT void
307ConfineToShape(DeviceIntPtr /* pDev */ ,
308 RegionPtr /* shape */ ,
309 int * /* px */ ,
310 int * /* py */ );
311
312extern _X_EXPORT Bool
313IsParent(WindowPtr /* maybeparent */ ,
314 WindowPtr /* child */ );
315
316extern _X_EXPORT WindowPtr
317GetCurrentRootWindow(DeviceIntPtr pDev);
318
319extern _X_EXPORT WindowPtr
320GetSpriteWindow(DeviceIntPtr pDev);
321
322extern _X_EXPORT void
323NoticeTime(const DeviceIntPtr dev,
324 TimeStamp time);
325extern _X_EXPORT void
326NoticeEventTime(InternalEvent *ev,
327 DeviceIntPtr dev);
328extern _X_EXPORT TimeStamp
329LastEventTime(int deviceid);
330extern _X_EXPORT Bool
331LastEventTimeWasReset(int deviceid);
332extern _X_EXPORT void
333LastEventTimeToggleResetFlag(int deviceid, Bool state);
334extern _X_EXPORT void
335LastEventTimeToggleResetAll(Bool state);
336
337extern void
338EnqueueEvent(InternalEvent * /* ev */ ,
339 DeviceIntPtr /* device */ );
340extern void
341PlayReleasedEvents(void);
342
343extern void
344ActivatePointerGrab(DeviceIntPtr /* mouse */ ,
345 GrabPtr /* grab */ ,
346 TimeStamp /* time */ ,
347 Bool /* autoGrab */ );
348
349extern void
350DeactivatePointerGrab(DeviceIntPtr /* mouse */ );
351
352extern void
353ActivateKeyboardGrab(DeviceIntPtr /* keybd */ ,
354 GrabPtr /* grab */ ,
355 TimeStamp /* time */ ,
356 Bool /* passive */ );
357
358extern void
359DeactivateKeyboardGrab(DeviceIntPtr /* keybd */ );
360
361extern BOOL
362ActivateFocusInGrab(DeviceIntPtr /* dev */ ,
363 WindowPtr /* old */ ,
364 WindowPtr /* win */ );
365
366extern void
367AllowSome(ClientPtr /* client */ ,
368 TimeStamp /* time */ ,
369 DeviceIntPtr /* thisDev */ ,
370 int /* newState */ );
371
372extern void
373ReleaseActiveGrabs(ClientPtr client);
374
375extern GrabPtr
376CheckPassiveGrabsOnWindow(WindowPtr /* pWin */ ,
377 DeviceIntPtr /* device */ ,
378 InternalEvent * /* event */ ,
379 BOOL /* checkCore */ ,
380 BOOL /* activate */ );
381
382extern _X_EXPORT int
383DeliverEventsToWindow(DeviceIntPtr /* pWin */ ,
384 WindowPtr /* pWin */ ,
385 xEventPtr /* pEvents */ ,
386 int /* count */ ,
387 Mask /* filter */ ,
388 GrabPtr /* grab */ );
389
390extern _X_EXPORT void
391DeliverRawEvent(RawDeviceEvent * /* ev */ ,
392 DeviceIntPtr /* dev */
393 );
394
395extern int
396DeliverDeviceEvents(WindowPtr /* pWin */ ,
397 InternalEvent * /* event */ ,
398 GrabPtr /* grab */ ,
399 WindowPtr /* stopAt */ ,
400 DeviceIntPtr /* dev */ );
401
402extern int
403DeliverOneGrabbedEvent(InternalEvent * /* event */ ,
404 DeviceIntPtr /* dev */ ,
405 enum InputLevel /* level */ );
406
407extern void
408DeliverTouchEvents(DeviceIntPtr /* dev */ ,
409 TouchPointInfoPtr /* ti */ ,
410 InternalEvent * /* ev */ ,
411 XID /* resource */ );
412
413extern void
414InitializeSprite(DeviceIntPtr /* pDev */ ,
415 WindowPtr /* pWin */ );
416extern void
417FreeSprite(DeviceIntPtr pDev);
418
419extern void
420UpdateSpriteForScreen(DeviceIntPtr /* pDev */ ,
421 ScreenPtr /* pScreen */ );
422
423extern _X_EXPORT void
424WindowHasNewCursor(WindowPtr /* pWin */ );
425
426extern Bool
427CheckDeviceGrabs(DeviceIntPtr /* device */ ,
428 DeviceEvent * /* event */ ,
429 WindowPtr /* ancestor */ );
430
431extern void
432DeliverFocusedEvent(DeviceIntPtr /* keybd */ ,
433 InternalEvent * /* event */ ,
434 WindowPtr /* window */ );
435
436extern int
437DeliverGrabbedEvent(InternalEvent * /* event */ ,
438 DeviceIntPtr /* thisDev */ ,
439 Bool /* deactivateGrab */ );
440
441extern void
442FixKeyState(DeviceEvent * /* event */ ,
443 DeviceIntPtr /* keybd */ );
444
445extern void
446RecalculateDeliverableEvents(WindowPtr /* pWin */ );
447
448extern _X_EXPORT int
449OtherClientGone(void *value,
450 XID id);
451
452extern void
453DoFocusEvents(DeviceIntPtr /* dev */ ,
454 WindowPtr /* fromWin */ ,
455 WindowPtr /* toWin */ ,
456 int /* mode */ );
457
458extern int
459SetInputFocus(ClientPtr /* client */ ,
460 DeviceIntPtr /* dev */ ,
461 Window /* focusID */ ,
462 CARD8 /* revertTo */ ,
463 Time /* ctime */ ,
464 Bool /* followOK */ );
465
466extern int
467GrabDevice(ClientPtr /* client */ ,
468 DeviceIntPtr /* dev */ ,
469 unsigned /* this_mode */ ,
470 unsigned /* other_mode */ ,
471 Window /* grabWindow */ ,
472 unsigned /* ownerEvents */ ,
473 Time /* ctime */ ,
474 GrabMask * /* mask */ ,
475 int /* grabtype */ ,
476 Cursor /* curs */ ,
477 Window /* confineToWin */ ,
478 CARD8 * /* status */ );
479
480extern void
481InitEvents(void);
482
483extern void
484CloseDownEvents(void);
485
486extern void
487DeleteWindowFromAnyEvents(WindowPtr /* pWin */ ,
488 Bool /* freeResources */ );
489
490extern Mask
491EventMaskForClient(WindowPtr /* pWin */ ,
492 ClientPtr /* client */ );
493
494extern _X_EXPORT int
495DeliverEvents(WindowPtr /*pWin */ ,
496 xEventPtr /*xE */ ,
497 int /*count */ ,
498 WindowPtr /*otherParent */ );
499
500extern Bool
501CheckMotion(DeviceEvent * /* ev */ ,
502 DeviceIntPtr /* pDev */ );
503
504extern _X_EXPORT void
505WriteEventsToClient(ClientPtr /*pClient */ ,
506 int /*count */ ,
507 xEventPtr /*events */ );
508
509extern _X_EXPORT int
510TryClientEvents(ClientPtr /*client */ ,
511 DeviceIntPtr /* device */ ,
512 xEventPtr /*pEvents */ ,
513 int /*count */ ,
514 Mask /*mask */ ,
515 Mask /*filter */ ,
516 GrabPtr /*grab */ );
517
518extern _X_EXPORT void
519WindowsRestructured(void);
520
521extern int
522SetClientPointer(ClientPtr /* client */ ,
523 DeviceIntPtr /* device */ );
524
525extern _X_EXPORT DeviceIntPtr
526PickPointer(ClientPtr /* client */ );
527
528extern _X_EXPORT DeviceIntPtr
529PickKeyboard(ClientPtr /* client */ );
530
531extern Bool
532IsInterferingGrab(ClientPtr /* client */ ,
533 DeviceIntPtr /* dev */ ,
534 xEvent * /* events */ );
535
536#ifdef PANORAMIX
537extern _X_EXPORT void
538ReinitializeRootWindow(WindowPtr win, int xoff, int yoff);
539#endif
540
541#ifdef RANDR
542extern _X_EXPORT void
543ScreenRestructured(ScreenPtr pScreen);
544#endif
545
546#ifndef HAVE_FFS
547extern _X_EXPORT int
548ffs(int i);
549#endif
550
551/*
552 * ServerGrabCallback stuff
553 */
554
555extern _X_EXPORT CallbackListPtr ServerGrabCallback;
556
557typedef enum { SERVER_GRABBED, SERVER_UNGRABBED,
558 CLIENT_PERVIOUS, CLIENT_IMPERVIOUS
559} ServerGrabState;
560
561typedef struct {
562 ClientPtr client;
563 ServerGrabState grabstate;
564} ServerGrabInfoRec;
565
566/*
567 * EventCallback stuff
568 */
569
570extern _X_EXPORT CallbackListPtr EventCallback;
571
572typedef struct {
573 ClientPtr client;
574 xEventPtr events;
575 int count;
576} EventInfoRec;
577
578/*
579 * DeviceEventCallback stuff
580 */
581
582extern _X_EXPORT CallbackListPtr DeviceEventCallback;
583
584typedef struct {
585 InternalEvent *event;
586 DeviceIntPtr device;
587} DeviceEventInfoRec;
588
589extern int
590XItoCoreType(int xi_type);
591extern Bool
592DevHasCursor(DeviceIntPtr pDev);
593extern _X_EXPORT Bool
594IsPointerDevice(DeviceIntPtr dev);
595extern _X_EXPORT Bool
596IsKeyboardDevice(DeviceIntPtr dev);
597extern Bool
598IsPointerEvent(InternalEvent *event);
599extern Bool
600IsTouchEvent(InternalEvent *event);
601extern _X_EXPORT Bool
602IsMaster(DeviceIntPtr dev);
603extern _X_EXPORT Bool
604IsFloating(DeviceIntPtr dev);
605
606extern _X_HIDDEN void
607CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
608extern _X_HIDDEN int
609CorePointerProc(DeviceIntPtr dev, int what);
610extern _X_HIDDEN int
611CoreKeyboardProc(DeviceIntPtr dev, int what);
612
613extern _X_EXPORT void *lastGLContext;
614
615#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