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
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 Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
29 Permission to use, copy, modify, and distribute this software and its
30 documentation for any purpose and without fee is hereby granted,
31 provided that the above copyright notice appear in all copies and that
32 both that copyright notice and this permission notice appear in
33 supporting documentation, and that the name of Hewlett-Packard not be
34 used in advertising or publicity pertaining to distribution of the
35 software without specific, written prior permission.
37 HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39 HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45 ********************************************************/
47 /***********************************************************************
49 * Function to return the dont-propagate-list for an extension device.
53 #ifdef HAVE_DIX_CONFIG_H
54 #include <dix-config.h>
57 #include "inputstr.h" /* DeviceIntPtr */
58 #include "windowstr.h" /* window structs */
59 #include <X11/extensions/XI.h>
60 #include <X11/extensions/XIproto.h>
61 #include "exglobals.h"
66 extern XExtEventInfo EventInfo
[];
67 extern int ExtEventIndex
;
69 /***********************************************************************
71 * Handle a request from a client with a different byte order.
76 SProcXGetDeviceDontPropagateList(ClientPtr client
)
78 REQUEST(xGetDeviceDontPropagateListReq
);
79 swaps(&stuff
->length
);
80 REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq
);
81 swapl(&stuff
->window
);
82 return (ProcXGetDeviceDontPropagateList(client
));
85 /***********************************************************************
87 * This procedure lists the input devices available to the server.
92 ProcXGetDeviceDontPropagateList(ClientPtr client
)
96 XEventClass
*buf
= NULL
, *tbuf
;
98 xGetDeviceDontPropagateListReply rep
;
99 OtherInputMasks
*others
;
101 REQUEST(xGetDeviceDontPropagateListReq
);
102 REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq
);
104 rep
= (xGetDeviceDontPropagateListReply
) {
106 .RepType
= X_GetDeviceDontPropagateList
,
107 .sequenceNumber
= client
->sequence
,
112 rc
= dixLookupWindow(&pWin
, stuff
->window
, client
, DixGetAttrAccess
);
116 if ((others
= wOtherInputMasks(pWin
)) != 0) {
117 for (i
= 0; i
< EMASKSIZE
; i
++)
118 ClassFromMask(NULL
, others
->dontPropagateMask
[i
], i
, &count
, COUNT
);
121 buf
= (XEventClass
*) malloc(rep
.count
* sizeof(XEventClass
));
122 rep
.length
= bytes_to_int32(rep
.count
* sizeof(XEventClass
));
125 for (i
= 0; i
< EMASKSIZE
; i
++)
126 tbuf
= ClassFromMask(tbuf
, others
->dontPropagateMask
[i
], i
,
131 WriteReplyToClient(client
, sizeof(xGetDeviceDontPropagateListReply
), &rep
);
134 client
->pSwapReplyFunc
= (ReplySwapPtr
) Swap32Write
;
135 WriteSwappedDataToClient(client
, count
* sizeof(XEventClass
), buf
);
141 /***********************************************************************
143 * This procedure gets a list of event classes from a mask word.
144 * A single mask may translate to more than one event class.
149 * ClassFromMask(XEventClass
* buf
, Mask mask
, int maskndx
, CARD16
*count
,
154 Mask tmask
= 0x80000000;
156 for (i
= 0; i
< 32; i
++, tmask
>>= 1)
158 for (j
= 0; j
< ExtEventIndex
; j
++)
159 if (EventInfo
[j
].mask
== tmask
) {
163 *buf
++ = (id
<< 8) | EventInfo
[j
].type
;
169 /***********************************************************************
171 * This procedure writes the reply for the XGetDeviceDontPropagateList function,
172 * if the client and server have a different byte ordering.
177 SRepXGetDeviceDontPropagateList(ClientPtr client
, int size
,
178 xGetDeviceDontPropagateListReply
* rep
)
180 swaps(&rep
->sequenceNumber
);
183 WriteToClient(client
, size
, rep
);