56
#define NEED_EVENTS /* for inputstr.h */
53
#define NEED_EVENTS /* for inputstr.h */
57
54
#define NEED_REPLIES
58
55
#ifdef HAVE_DIX_CONFIG_H
59
56
#include <dix-config.h>
62
#include <X11/X.h> /* for inputstr.h */
63
#include <X11/Xproto.h> /* Request macro */
64
#include "inputstr.h" /* DeviceIntPtr */
59
#include <X11/X.h> /* for inputstr.h */
60
#include <X11/Xproto.h> /* Request macro */
61
#include "inputstr.h" /* DeviceIntPtr */
65
62
#include <X11/extensions/XI.h>
66
63
#include <X11/extensions/XIproto.h>
67
64
#include "extnsionst.h"
68
#include "extinit.h" /* LookupDeviceIntRec */
65
#include "extinit.h" /* LookupDeviceIntRec */
69
66
#include "exglobals.h"
70
67
#include "swaprep.h"
82
SProcXGetDeviceKeyMapping(client)
83
register ClientPtr client;
79
SProcXGetDeviceKeyMapping(register ClientPtr client)
87
83
REQUEST(xGetDeviceKeyMappingReq);
88
84
swaps(&stuff->length, n);
89
return(ProcXGetDeviceKeyMapping(client));
85
return (ProcXGetDeviceKeyMapping(client));
92
88
/***********************************************************************
99
ProcXGetDeviceKeyMapping(client)
100
register ClientPtr client;
95
ProcXGetDeviceKeyMapping(register ClientPtr client)
102
97
xGetDeviceKeyMappingReply rep;
106
101
REQUEST(xGetDeviceKeyMappingReq);
107
102
REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
109
dev = LookupDeviceIntRec (stuff->deviceid);
112
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
104
dev = LookupDeviceIntRec(stuff->deviceid);
106
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0,
117
if (dev->key == NULL)
119
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
111
if (dev->key == NULL) {
112
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadMatch);
123
k = &dev->key->curKeySyms;
115
k = &dev->key->curKeySyms;
125
117
if ((stuff->firstKeyCode < k->minKeyCode) ||
126
(stuff->firstKeyCode > k->maxKeyCode))
118
(stuff->firstKeyCode > k->maxKeyCode)) {
128
119
client->errorValue = stuff->firstKeyCode;
129
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
120
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
134
if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1)
124
if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1) {
136
125
client->errorValue = stuff->count;
137
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
126
SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
142
130
rep.repType = X_Reply;
143
131
rep.RepType = X_GetDeviceKeyMapping;
144
132
rep.sequenceNumber = client->sequence;
145
133
rep.keySymsPerKeyCode = k->mapWidth;
146
rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */
134
rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */
147
135
WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
149
client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
150
WriteSwappedDataToClient(
152
k->mapWidth * stuff->count * sizeof(KeySym),
153
&k->map[(stuff->firstKeyCode - k->minKeyCode) *
137
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
138
WriteSwappedDataToClient(client,
139
k->mapWidth * stuff->count * sizeof(KeySym),
140
&k->map[(stuff->firstKeyCode - k->minKeyCode) *
159
146
/***********************************************************************
167
SRepXGetDeviceKeyMapping (client, size, rep)
170
xGetDeviceKeyMappingReply *rep;
154
SRepXGetDeviceKeyMapping(ClientPtr client, int size,
155
xGetDeviceKeyMappingReply * rep)
174
159
swaps(&rep->sequenceNumber, n);
175
160
swapl(&rep->length, n);
176
161
WriteToClient(client, size, (char *)rep);