diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-11-04 11:29:01 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-09 14:56:23 +1000 |
commit | 86bb3781b336c09e4279136ed81974de5acdba7f (patch) | |
tree | 56f325228d63a7a77507df0bc524bcf9c4fe095b /Xi/xipassivegrab.c | |
parent | b8b90cd1610331ff12fa3f70bf372670af7795ec (diff) |
input: swap the server over to use the XI2mask struct
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'Xi/xipassivegrab.c')
-rw-r--r-- | Xi/xipassivegrab.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c index 4fa887a42..4860757fc 100644 --- a/Xi/xipassivegrab.c +++ b/Xi/xipassivegrab.c @@ -44,6 +44,7 @@ #include "xipassivegrab.h" #include "dixgrabs.h" #include "misc.h" +#include "inpututils.h" int SProcXIPassiveGrabDevice(ClientPtr client) @@ -82,7 +83,7 @@ ProcXIPassiveGrabDevice(ClientPtr client) int i, ret = Success; uint32_t *modifiers; xXIGrabModifierInfo *modifiers_failed; - GrabMask mask; + GrabMask mask = { 0 }; GrabParameters param; void *tmp; int mask_len; @@ -124,9 +125,12 @@ ProcXIPassiveGrabDevice(ClientPtr client) stuff->mask_len * 4) != Success) return BadValue; - mask_len = min(sizeof(mask.xi2mask[stuff->deviceid]), stuff->mask_len * 4); - memset(mask.xi2mask, 0, sizeof(mask.xi2mask)); - memcpy(mask.xi2mask[stuff->deviceid], &stuff[1], mask_len * 4); + mask.xi2mask = xi2mask_new(); + if (!mask.xi2mask) + return BadAlloc; + + mask_len = min(xi2mask_mask_size(mask.xi2mask), stuff->mask_len * 4); + xi2mask_set_one_mask(mask.xi2mask, stuff->deviceid, (unsigned char*)&stuff[1], mask_len * 4); rep.repType = X_Reply; rep.RepType = X_XIPassiveGrabDevice; @@ -212,6 +216,7 @@ ProcXIPassiveGrabDevice(ClientPtr client) free(modifiers_failed); out: + xi2mask_free(&mask.xi2mask); return ret; } |