]> git.sesse.net Git - rdpsrv/blob - Xserver/programs/Xserver/dix/tables.c
Import X server from vnc-3.3.7.
[rdpsrv] / Xserver / programs / Xserver / dix / tables.c
1 /***********************************************************
2
3 Copyright (c) 1987  X Consortium
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 Except as contained in this notice, the name of the X Consortium shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from the X Consortium.
25
26
27 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
28
29                         All Rights Reserved
30
31 Permission to use, copy, modify, and distribute this software and its 
32 documentation for any purpose and without fee is hereby granted, 
33 provided that the above copyright notice appear in all copies and that
34 both that copyright notice and this permission notice appear in 
35 supporting documentation, and that the name of Digital not be
36 used in advertising or publicity pertaining to distribution of the
37 software without specific, written prior permission.  
38
39 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
40 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
41 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
43 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45 SOFTWARE.
46
47 ******************************************************************/
48 /* $XConsortium: tables.c,v 1.25 94/04/17 20:26:46 gildea Exp $ */
49 /* $XFree86: xc/programs/Xserver/dix/tables.c,v 3.1 1996/05/06 05:56:25 dawes Exp $ */
50
51 #include "X.h"
52 #define NEED_EVENTS
53 #define NEED_REPLIES
54 #include "Xproto.h"
55 #include "windowstr.h"
56 #include "extnsionst.h"
57 #include "dixstruct.h"
58 #include "dispatch.h"
59 #include "swaprep.h"
60 #include "swapreq.h"
61
62 #ifdef K5AUTH
63 extern int
64     k5_stage1(), k5_stage2(), k5_stage3(), k5_bad();
65 #endif
66
67 int (* InitialVector[3]) (
68 #if NeedNestedPrototypes
69         ClientPtr /* client */
70 #endif
71     ) =
72 {
73     0,
74     ProcInitialConnection,
75     ProcEstablishConnection
76 };
77
78 int (* ProcVector[256]) (
79 #if NeedNestedPrototypes
80         ClientPtr /* client */
81 #endif
82     ) =
83 {
84     ProcBadRequest,
85     ProcCreateWindow,
86     ProcChangeWindowAttributes,
87     ProcGetWindowAttributes,
88     ProcDestroyWindow,
89     ProcDestroySubwindows,              /* 5 */
90     ProcChangeSaveSet,
91     ProcReparentWindow,
92     ProcMapWindow,
93     ProcMapSubwindows,
94     ProcUnmapWindow,                    /* 10 */
95     ProcUnmapSubwindows,
96     ProcConfigureWindow,
97     ProcCirculateWindow,
98     ProcGetGeometry,
99     ProcQueryTree,                      /* 15 */
100     ProcInternAtom,
101     ProcGetAtomName,
102     ProcChangeProperty,
103     ProcDeleteProperty,
104     ProcGetProperty,                    /* 20 */
105     ProcListProperties,
106     ProcSetSelectionOwner,
107     ProcGetSelectionOwner,
108     ProcConvertSelection,
109     ProcSendEvent,                      /* 25 */
110     ProcGrabPointer,
111     ProcUngrabPointer,
112     ProcGrabButton,
113     ProcUngrabButton,
114     ProcChangeActivePointerGrab,        /* 30 */
115     ProcGrabKeyboard,
116     ProcUngrabKeyboard,
117     ProcGrabKey,
118     ProcUngrabKey,
119     ProcAllowEvents,                    /* 35 */
120     ProcGrabServer,
121     ProcUngrabServer,
122     ProcQueryPointer,
123     ProcGetMotionEvents,
124     ProcTranslateCoords,                /* 40 */
125     ProcWarpPointer,
126     ProcSetInputFocus,
127     ProcGetInputFocus,
128     ProcQueryKeymap,
129     ProcOpenFont,                       /* 45 */
130     ProcCloseFont,
131     ProcQueryFont,
132     ProcQueryTextExtents,
133     ProcListFonts,
134     ProcListFontsWithInfo,              /* 50 */
135     ProcSetFontPath,
136     ProcGetFontPath,
137     ProcCreatePixmap,
138     ProcFreePixmap,
139     ProcCreateGC,                       /* 55 */
140     ProcChangeGC,
141     ProcCopyGC,
142     ProcSetDashes,
143     ProcSetClipRectangles,
144     ProcFreeGC,                         /* 60 */
145     ProcClearToBackground,
146     ProcCopyArea,
147     ProcCopyPlane,
148     ProcPolyPoint,
149     ProcPolyLine,                       /* 65 */
150     ProcPolySegment,
151     ProcPolyRectangle,
152     ProcPolyArc,
153     ProcFillPoly,
154     ProcPolyFillRectangle,              /* 70 */
155     ProcPolyFillArc,
156     ProcPutImage,
157     ProcGetImage,
158     ProcPolyText,
159     ProcPolyText,                       /* 75 */
160     ProcImageText8,
161     ProcImageText16,
162     ProcCreateColormap,
163     ProcFreeColormap,
164     ProcCopyColormapAndFree,            /* 80 */
165     ProcInstallColormap,
166     ProcUninstallColormap,
167     ProcListInstalledColormaps,
168     ProcAllocColor,
169     ProcAllocNamedColor,                /* 85 */
170     ProcAllocColorCells,
171     ProcAllocColorPlanes,
172     ProcFreeColors,
173     ProcStoreColors,
174     ProcStoreNamedColor,                /* 90 */
175     ProcQueryColors,
176     ProcLookupColor,
177     ProcCreateCursor,
178     ProcCreateGlyphCursor,
179     ProcFreeCursor,                     /* 95 */
180     ProcRecolorCursor,
181     ProcQueryBestSize,
182     ProcQueryExtension,
183     ProcListExtensions,
184     ProcChangeKeyboardMapping,          /* 100 */
185     ProcGetKeyboardMapping,
186     ProcChangeKeyboardControl,
187     ProcGetKeyboardControl,
188     ProcBell,
189     ProcChangePointerControl,           /* 105 */
190     ProcGetPointerControl,
191     ProcSetScreenSaver,
192     ProcGetScreenSaver,
193     ProcChangeHosts,
194     ProcListHosts,                      /* 110 */
195     ProcChangeAccessControl,
196     ProcChangeCloseDownMode,
197     ProcKillClient,
198     ProcRotateProperties,
199     ProcForceScreenSaver,               /* 115 */
200     ProcSetPointerMapping,
201     ProcGetPointerMapping,
202     ProcSetModifierMapping,
203     ProcGetModifierMapping,
204     0,                                  /* 120 */
205     0,
206     0,
207     0,
208     0,
209     0,                                  /* 125 */
210     0,
211     ProcNoOperation    
212 };
213
214 int (* SwappedProcVector[256]) (
215 #if NeedNestedPrototypes
216         ClientPtr /* client */
217 #endif
218     ) =
219 {
220     ProcBadRequest,
221     SProcCreateWindow,
222     SProcChangeWindowAttributes,
223     SProcResourceReq,                   /* GetWindowAttributes */
224     SProcResourceReq,                   /* DestroyWindow */
225     SProcResourceReq,                   /* 5 DestroySubwindows */
226     SProcResourceReq,                   /* SProcChangeSaveSet, */
227     SProcReparentWindow,
228     SProcResourceReq,                   /* MapWindow */
229     SProcResourceReq,                   /* MapSubwindows */
230     SProcResourceReq,                   /* 10 UnmapWindow */
231     SProcResourceReq,                   /* UnmapSubwindows */
232     SProcConfigureWindow,
233     SProcResourceReq,                   /* SProcCirculateWindow, */
234     SProcResourceReq,                   /* GetGeometry */
235     SProcResourceReq,                   /* 15 QueryTree */
236     SProcInternAtom,
237     SProcResourceReq,                   /* SProcGetAtomName, */
238     SProcChangeProperty,
239     SProcDeleteProperty,
240     SProcGetProperty,                   /* 20 */
241     SProcResourceReq,                   /* SProcListProperties, */
242     SProcSetSelectionOwner,
243     SProcResourceReq,                   /* SProcGetSelectionOwner, */
244     SProcConvertSelection,
245     SProcSendEvent,                     /* 25 */
246     SProcGrabPointer,
247     SProcResourceReq,                   /* SProcUngrabPointer, */
248     SProcGrabButton,
249     SProcUngrabButton,
250     SProcChangeActivePointerGrab,       /* 30 */
251     SProcGrabKeyboard,
252     SProcResourceReq,                   /* SProcUngrabKeyboard, */
253     SProcGrabKey,
254     SProcUngrabKey,
255     SProcResourceReq,                   /* 35 SProcAllowEvents, */
256     SProcSimpleReq,                     /* SProcGrabServer, */
257     SProcSimpleReq,                     /* SProcUngrabServer, */
258     SProcResourceReq,                   /* SProcQueryPointer, */
259     SProcGetMotionEvents,
260     SProcTranslateCoords,               /*40 */
261     SProcWarpPointer,
262     SProcSetInputFocus,
263     SProcSimpleReq,                     /* SProcGetInputFocus, */
264     SProcSimpleReq,                     /* QueryKeymap, */
265     SProcOpenFont,                      /* 45 */
266     SProcResourceReq,                   /* SProcCloseFont, */
267     SProcResourceReq,                   /* SProcQueryFont, */
268     SProcResourceReq,                   /* SProcQueryTextExtents,  */
269     SProcListFonts,
270     SProcListFontsWithInfo,             /* 50 */
271     SProcSetFontPath,
272     SProcSimpleReq,                     /* GetFontPath, */
273     SProcCreatePixmap,
274     SProcResourceReq,                   /* SProcFreePixmap, */
275     SProcCreateGC,                      /* 55 */
276     SProcChangeGC,
277     SProcCopyGC,
278     SProcSetDashes,
279     SProcSetClipRectangles,
280     SProcResourceReq,                   /* 60 SProcFreeGC, */
281     SProcClearToBackground,
282     SProcCopyArea,
283     SProcCopyPlane,
284     SProcPoly,                          /* PolyPoint, */
285     SProcPoly,                          /* 65 PolyLine */
286     SProcPoly,                          /* PolySegment, */
287     SProcPoly,                          /* PolyRectangle, */
288     SProcPoly,                          /* PolyArc, */
289     SProcFillPoly,
290     SProcPoly,                          /* 70 PolyFillRectangle */
291     SProcPoly,                          /* PolyFillArc, */
292     SProcPutImage,
293     SProcGetImage,
294     SProcPolyText,
295     SProcPolyText,                      /* 75 */
296     SProcImageText,
297     SProcImageText,
298     SProcCreateColormap,
299     SProcResourceReq,                   /* SProcFreeColormap, */
300     SProcCopyColormapAndFree,           /* 80 */
301     SProcResourceReq,                   /* SProcInstallColormap, */
302     SProcResourceReq,                   /* SProcUninstallColormap, */
303     SProcResourceReq,                   /* SProcListInstalledColormaps, */
304     SProcAllocColor,
305     SProcAllocNamedColor,               /* 85 */
306     SProcAllocColorCells,
307     SProcAllocColorPlanes,
308     SProcFreeColors,
309     SProcStoreColors,
310     SProcStoreNamedColor,               /* 90 */
311     SProcQueryColors,
312     SProcLookupColor,
313     SProcCreateCursor,
314     SProcCreateGlyphCursor,
315     SProcResourceReq,                   /* 95 SProcFreeCursor, */
316     SProcRecolorCursor,
317     SProcQueryBestSize,
318     SProcQueryExtension,
319     SProcSimpleReq,                     /* ListExtensions, */
320     SProcChangeKeyboardMapping,         /* 100 */
321     SProcSimpleReq,                     /* GetKeyboardMapping, */
322     SProcChangeKeyboardControl,
323     SProcSimpleReq,                     /* GetKeyboardControl, */
324     SProcSimpleReq,                     /* Bell, */
325     SProcChangePointerControl,          /* 105 */
326     SProcSimpleReq,                     /* GetPointerControl, */
327     SProcSetScreenSaver,
328     SProcSimpleReq,                     /* GetScreenSaver, */
329     SProcChangeHosts,
330     SProcSimpleReq,                     /* 110 ListHosts, */
331     SProcSimpleReq,                     /* SProcChangeAccessControl, */
332     SProcSimpleReq,                     /* SProcChangeCloseDownMode, */
333     SProcResourceReq,                   /* SProcKillClient, */
334     SProcRotateProperties,
335     SProcSimpleReq,                     /* 115 ForceScreenSaver */
336     SProcSimpleReq,                     /* SetPointerMapping, */
337     SProcSimpleReq,                     /* GetPointerMapping, */
338     SProcSimpleReq,                     /* SetModifierMapping, */
339     SProcSimpleReq,                     /* GetModifierMapping, */
340     0,                                  /* 120 */
341     0,
342     0,
343     0,
344     0,
345     0,                                  /* 125 */
346     0,
347     SProcNoOperation
348 };
349
350 EventSwapPtr EventSwapVector[128] =
351 {
352     (EventSwapPtr)SErrorEvent,
353     NotImplemented,
354     SKeyButtonPtrEvent,
355     SKeyButtonPtrEvent,
356     SKeyButtonPtrEvent,
357     SKeyButtonPtrEvent,                 /* 5 */
358     SKeyButtonPtrEvent,
359     SEnterLeaveEvent,
360     SEnterLeaveEvent,
361     SFocusEvent,
362     SFocusEvent,                        /* 10 */
363     SKeymapNotifyEvent,
364     SExposeEvent,
365     SGraphicsExposureEvent,
366     SNoExposureEvent,
367     SVisibilityEvent,                   /* 15 */
368     SCreateNotifyEvent,
369     SDestroyNotifyEvent,
370     SUnmapNotifyEvent,
371     SMapNotifyEvent,
372     SMapRequestEvent,                   /* 20 */
373     SReparentEvent,
374     SConfigureNotifyEvent,
375     SConfigureRequestEvent,
376     SGravityEvent,
377     SResizeRequestEvent,                /* 25 */
378     SCirculateEvent,
379     SCirculateEvent,
380     SPropertyEvent,
381     SSelectionClearEvent,
382     SSelectionRequestEvent,             /* 30 */
383     SSelectionNotifyEvent,
384     SColormapEvent,
385     SClientMessageEvent,
386     SMappingEvent,
387 };
388
389
390 ReplySwapPtr ReplySwapVector[256] =
391 {
392     ReplyNotSwappd,
393     ReplyNotSwappd,
394     ReplyNotSwappd,
395     (ReplySwapPtr)SGetWindowAttributesReply,
396     ReplyNotSwappd,
397     ReplyNotSwappd,                             /* 5 */
398     ReplyNotSwappd,
399     ReplyNotSwappd,
400     ReplyNotSwappd,
401     ReplyNotSwappd,
402     ReplyNotSwappd,                             /* 10 */
403     ReplyNotSwappd,
404     ReplyNotSwappd,
405     ReplyNotSwappd,
406     (ReplySwapPtr)SGetGeometryReply,
407     (ReplySwapPtr)SQueryTreeReply,              /* 15 */
408     (ReplySwapPtr)SInternAtomReply,
409     (ReplySwapPtr)SGetAtomNameReply,
410     ReplyNotSwappd,
411     ReplyNotSwappd,
412     (ReplySwapPtr)SGetPropertyReply,            /* 20 */
413     (ReplySwapPtr)SListPropertiesReply,
414     ReplyNotSwappd,
415     (ReplySwapPtr)SGetSelectionOwnerReply,
416     ReplyNotSwappd,
417     ReplyNotSwappd,                             /* 25 */
418     (ReplySwapPtr)SGenericReply,                /* SGrabPointerReply, */
419     ReplyNotSwappd,
420     ReplyNotSwappd,
421     ReplyNotSwappd,
422     ReplyNotSwappd,                             /* 30 */
423     (ReplySwapPtr)SGenericReply,                /* SGrabKeyboardReply, */
424     ReplyNotSwappd,
425     ReplyNotSwappd,
426     ReplyNotSwappd,
427     ReplyNotSwappd,                             /* 35 */
428     ReplyNotSwappd,
429     ReplyNotSwappd,
430     (ReplySwapPtr)SQueryPointerReply,
431     (ReplySwapPtr)SGetMotionEventsReply,
432     (ReplySwapPtr)STranslateCoordsReply,        /* 40 */
433     ReplyNotSwappd,
434     ReplyNotSwappd,
435     (ReplySwapPtr)SGetInputFocusReply,
436     (ReplySwapPtr)SQueryKeymapReply,
437     ReplyNotSwappd,                             /* 45 */
438     ReplyNotSwappd,
439     (ReplySwapPtr)SQueryFontReply,
440     (ReplySwapPtr)SQueryTextExtentsReply,
441     (ReplySwapPtr)SListFontsReply,
442     (ReplySwapPtr)SListFontsWithInfoReply,      /* 50 */
443     ReplyNotSwappd,
444     (ReplySwapPtr)SGetFontPathReply,
445     ReplyNotSwappd,
446     ReplyNotSwappd,
447     ReplyNotSwappd,                             /* 55 */
448     ReplyNotSwappd,
449     ReplyNotSwappd,
450     ReplyNotSwappd,
451     ReplyNotSwappd,
452     ReplyNotSwappd,                             /* 60 */
453     ReplyNotSwappd,
454     ReplyNotSwappd,
455     ReplyNotSwappd,
456     ReplyNotSwappd,
457     ReplyNotSwappd,                             /* 65 */
458     ReplyNotSwappd,
459     ReplyNotSwappd,
460     ReplyNotSwappd,
461     ReplyNotSwappd,
462     ReplyNotSwappd,                             /* 70 */
463     ReplyNotSwappd,
464     ReplyNotSwappd,
465     (ReplySwapPtr)SGetImageReply,
466     ReplyNotSwappd,
467     ReplyNotSwappd,                             /* 75 */
468     ReplyNotSwappd,
469     ReplyNotSwappd,
470     ReplyNotSwappd,
471     ReplyNotSwappd,
472     ReplyNotSwappd,                             /* 80 */
473     ReplyNotSwappd,
474     ReplyNotSwappd,
475     (ReplySwapPtr)SListInstalledColormapsReply,
476     (ReplySwapPtr)SAllocColorReply,
477     (ReplySwapPtr)SAllocNamedColorReply,        /* 85 */
478     (ReplySwapPtr)SAllocColorCellsReply,
479     (ReplySwapPtr)SAllocColorPlanesReply,
480     ReplyNotSwappd,
481     ReplyNotSwappd,
482     ReplyNotSwappd,                             /* 90 */
483     (ReplySwapPtr)SQueryColorsReply,
484     (ReplySwapPtr)SLookupColorReply,
485     ReplyNotSwappd,
486     ReplyNotSwappd,
487     ReplyNotSwappd,                             /* 95 */
488     ReplyNotSwappd,
489     (ReplySwapPtr)SQueryBestSizeReply,
490     (ReplySwapPtr)SGenericReply,                /* SQueryExtensionReply, */
491     (ReplySwapPtr)SListExtensionsReply,
492     ReplyNotSwappd,                             /* 100 */
493     (ReplySwapPtr)SGetKeyboardMappingReply,
494     ReplyNotSwappd,
495     (ReplySwapPtr)SGetKeyboardControlReply,
496     ReplyNotSwappd,
497     ReplyNotSwappd,                             /* 105 */
498     (ReplySwapPtr)SGetPointerControlReply,
499     ReplyNotSwappd,
500     (ReplySwapPtr)SGetScreenSaverReply,
501     ReplyNotSwappd,
502     (ReplySwapPtr)SListHostsReply,              /* 110 */
503     ReplyNotSwappd,
504     ReplyNotSwappd,
505     ReplyNotSwappd,
506     ReplyNotSwappd,
507     ReplyNotSwappd,                             /* 115 */
508     (ReplySwapPtr)SGenericReply,                /* SetPointerMapping */
509     (ReplySwapPtr)SGetPointerMappingReply,
510     (ReplySwapPtr)SGenericReply,                /* SetModifierMapping */
511     (ReplySwapPtr)SGetModifierMappingReply,     /* 119 */
512     ReplyNotSwappd,                             /* 120 */
513     ReplyNotSwappd,                             /* 121 */
514     ReplyNotSwappd,                             /* 122 */
515     ReplyNotSwappd,                             /* 123 */
516     ReplyNotSwappd,                             /* 124 */
517     ReplyNotSwappd,                             /* 125 */
518     ReplyNotSwappd,                             /* 126 */
519     ReplyNotSwappd,                             /* NoOperation */
520     ReplyNotSwappd
521 };
522
523 #ifdef K5AUTH
524 int (*k5_Vector[256])() =
525 {
526     k5_bad,
527     k5_stage1,
528     k5_bad,
529     k5_stage3
530 };
531 #endif