From f062e90a95f9b7ae5458ef2100615e8ace9b66a7 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 16 Apr 2008 19:15:30 +0300 Subject: Input: Remove modifierKeyMap Since modifierKeyMap is generated from modifierMap, just remove it, and only generate it when we need to send the modifier map to the client. Signed-off-by: Daniel Stone Signed-off-by: Peter Hutterer --- Xi/setmmap.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'Xi/setmmap.c') diff --git a/Xi/setmmap.c b/Xi/setmmap.c index ddfc1bd3e..8a0ab3e81 100644 --- a/Xi/setmmap.c +++ b/Xi/setmmap.c @@ -91,33 +91,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 != ((sizeof(xSetDeviceModifierMappingReq) >> 2) + + (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; } -- cgit v1.2.1