summaryrefslogtreecommitdiff
path: root/Xi/setbmap.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2008-08-12 00:35:56 +0300
committerDaniel Stone <daniel@fooishbar.org>2009-01-22 15:08:58 +1100
commitbc909f71367a02297e725bb5769c2bcadab22395 (patch)
tree509819678ca888479e3142446d6e1c25cf68d3c0 /Xi/setbmap.c
parentf06a9d2e05e13466c115fc706966a90b1fb0518e (diff)
Input: Centralise pointer map changing
Replace both core and Xi functions with one function that validates the proposed map, and sends out both kinds of notification. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi/setbmap.c')
-rw-r--r--Xi/setbmap.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/Xi/setbmap.c b/Xi/setbmap.c
index 0bcfbb8eb..b6f62dddb 100644
--- a/Xi/setbmap.c
+++ b/Xi/setbmap.c
@@ -107,21 +107,15 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.status = MappingSuccess;
- ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
- if (ret != Success)
- return ret;
-
- ret = SetButtonMapping(client, dev, stuff->map_length, (BYTE *) & stuff[1]);
-
- if (ret == BadValue || ret == BadMatch)
- return ret;
- else {
- rep.status = ret;
- WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
- }
-
- if (ret != MappingBusy)
- SendDevicePointerMappingNotify(client, dev);
+ ret = ApplyPointerMapping(dev, (CARD8 *) &stuff[1], stuff->map_length, client);
+ if (ret == -1)
+ return BadValue;
+ else if (ret == MappingBusy)
+ rep.status = ret;
+ else if (ret != Success)
+ return ret;
+
+ WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
return Success;
}