First import
[xorg_rtime.git] / xorg-server-1.4 / Xext / mitmisc.c
blob924b88063a4d2b39ffbbd3180c31fd746a8726ad
1 /************************************************************
3 Copyright 1989, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
25 ********************************************************/
27 /* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
30 #define NEED_EVENTS
31 #ifdef HAVE_DIX_CONFIG_H
32 #include <dix-config.h>
33 #endif
35 #include <X11/X.h>
36 #include <X11/Xproto.h>
37 #include "misc.h"
38 #include "os.h"
39 #include "dixstruct.h"
40 #include "extnsionst.h"
41 #define _MITMISC_SERVER_
42 #include <X11/extensions/mitmiscstr.h>
43 #include "modinit.h"
45 #if 0
46 static unsigned char MITReqCode;
47 #endif
49 static void MITResetProc(
50 ExtensionEntry * /* extEntry */
53 static DISPATCH_PROC(ProcMITDispatch);
54 static DISPATCH_PROC(ProcMITGetBugMode);
55 static DISPATCH_PROC(ProcMITSetBugMode);
56 static DISPATCH_PROC(SProcMITDispatch);
57 static DISPATCH_PROC(SProcMITGetBugMode);
58 static DISPATCH_PROC(SProcMITSetBugMode);
60 void
61 MITMiscExtensionInit(INITARGS)
63 #if 0
64 ExtensionEntry *extEntry;
66 if ((extEntry = AddExtension(MITMISCNAME, 0, 0,
67 ProcMITDispatch, SProcMITDispatch,
68 MITResetProc, StandardMinorOpcode)) != 0)
69 MITReqCode = (unsigned char)extEntry->base;
70 #else
71 (void) AddExtension(MITMISCNAME, 0, 0,
72 ProcMITDispatch, SProcMITDispatch,
73 MITResetProc, StandardMinorOpcode);
74 #endif
77 /*ARGSUSED*/
78 static void
79 MITResetProc (extEntry)
80 ExtensionEntry *extEntry;
84 static int
85 ProcMITSetBugMode(client)
86 register ClientPtr client;
88 REQUEST(xMITSetBugModeReq);
90 REQUEST_SIZE_MATCH(xMITSetBugModeReq);
91 if (stuff->onOff != xFalse)
92 return BadRequest;
93 return(client->noClientException);
96 static int
97 ProcMITGetBugMode(client)
98 register ClientPtr client;
100 xMITGetBugModeReply rep;
101 register int n;
103 REQUEST_SIZE_MATCH(xMITGetBugModeReq);
104 rep.type = X_Reply;
105 rep.length = 0;
106 rep.sequenceNumber = client->sequence;
107 rep.onOff = FALSE;
108 if (client->swapped) {
109 swaps(&rep.sequenceNumber, n);
110 swapl(&rep.length, n);
112 WriteToClient(client, sizeof(xMITGetBugModeReply), (char *)&rep);
113 return(client->noClientException);
116 static int
117 ProcMITDispatch (client)
118 register ClientPtr client;
120 REQUEST(xReq);
121 switch (stuff->data)
123 case X_MITSetBugMode:
124 return ProcMITSetBugMode(client);
125 case X_MITGetBugMode:
126 return ProcMITGetBugMode(client);
127 default:
128 return BadRequest;
132 static int
133 SProcMITSetBugMode(client)
134 register ClientPtr client;
136 register int n;
137 REQUEST(xMITSetBugModeReq);
139 swaps(&stuff->length, n);
140 return ProcMITSetBugMode(client);
143 static int
144 SProcMITGetBugMode(client)
145 register ClientPtr client;
147 register int n;
148 REQUEST(xMITGetBugModeReq);
150 swaps(&stuff->length, n);
151 return ProcMITGetBugMode(client);
154 static int
155 SProcMITDispatch (client)
156 register ClientPtr client;
158 REQUEST(xReq);
159 switch (stuff->data)
161 case X_MITSetBugMode:
162 return SProcMITSetBugMode(client);
163 case X_MITGetBugMode:
164 return SProcMITGetBugMode(client);
165 default:
166 return BadRequest;