aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xi/setmmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/Xi/setmmap.c')
-rw-r--r--xorg-server/Xi/setmmap.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/xorg-server/Xi/setmmap.c b/xorg-server/Xi/setmmap.c
index 34efde595..cbe5dc8c5 100644
--- a/xorg-server/Xi/setmmap.c
+++ b/xorg-server/Xi/setmmap.c
@@ -50,14 +50,13 @@ SOFTWARE.
*
*/
-#define NEED_EVENTS /* for inputstr.h */
-#define NEED_REPLIES
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
+#include <X11/extensions/XI2.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
@@ -93,33 +92,39 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
int ret;
xSetDeviceModifierMappingReply rep;
DeviceIntPtr dev;
- KeyClassPtr kp;
REQUEST(xSetDeviceModifierMappingReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
- ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
- if (ret != Success)
- return ret;
+ if (stuff->length != bytes_to_int32(sizeof(xSetDeviceModifierMappingReq)) +
+ (stuff->numKeyPerModifier << 1))
+ return BadLength;
rep.repType = X_Reply;
rep.RepType = X_SetDeviceModifierMapping;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- ret = SetModifierMapping(client, dev, stuff->length,
- (sizeof(xSetDeviceModifierMappingReq) >> 2),
- stuff->numKeyPerModifier, (BYTE *) & stuff[1],
- &kp);
+ ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
+ if (ret != Success)
+ return ret;
+
+ ret = change_modmap(client, dev, (KeyCode *) &stuff[1],
+ stuff->numKeyPerModifier);
+ if (ret == Success)
+ ret = MappingSuccess;
if (ret == MappingSuccess || ret == MappingBusy || ret == MappingFailed) {
rep.success = ret;
- if (ret == MappingSuccess)
- SendDeviceMappingNotify(client, MappingModifier, 0, 0, dev);
WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),
&rep);
- } else if (ret == -1)
- return BadValue;
+ }
+ else if (ret == -1) {
+ return BadValue;
+ }
+ else {
+ return ret;
+ }
return Success;
}