diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-10 11:00:46 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-17 15:04:02 +1000 |
commit | cc10ac8f0e07854647e1fd7cc70b7e9f8d919fd1 (patch) | |
tree | 31e83c606f4b8b9fd7d67440133ad8308b8cb18a /Xi/extinit.c | |
parent | 151d44149a09dd125e25b3d94f22a609f0221548 (diff) |
Xi: fix swapping for barrier events
Protocol events don't contain pointers, so it's easier to copy everything
over, then swap in-place.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Diffstat (limited to 'Xi/extinit.c')
-rw-r--r-- | Xi/extinit.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/Xi/extinit.c b/Xi/extinit.c index 606d61c88..73b084cd9 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -845,30 +845,27 @@ STouchOwnershipEvent(xXITouchOwnershipEvent * from, xXITouchOwnershipEvent * to) static void SBarrierEvent(xXIBarrierEvent * from, xXIBarrierEvent * to) { - to->type = from->type; - - cpswaps(from->sequenceNumber, to->sequenceNumber); - cpswapl(from->length, to->length); - cpswaps(from->evtype, to->evtype); - cpswapl(from->time, to->time); - cpswaps(from->deviceid, to->deviceid); - cpswaps(from->sourceid, to->sourceid); - cpswapl(from->event, to->event); - cpswapl(from->root, to->root); - cpswapl(from->root_x, to->root_x); - cpswapl(from->root_y, to->root_y); - -#define SWAP_FP3232(x, y) \ - do { \ - cpswapl((x).integral, (y).integral); \ - cpswapl((x).frac, (y).frac); \ - } while(0) - - SWAP_FP3232(from->dx, to->dx); - SWAP_FP3232(from->dy, to->dy); - cpswapl(from->dtime, to->dtime); - cpswapl(from->barrier, to->barrier); - cpswapl(from->eventid, to->eventid); + + *to = *from; + + swaps(&from->sequenceNumber); + swapl(&from->length); + swaps(&from->evtype); + swapl(&from->time); + swaps(&from->deviceid); + swaps(&from->sourceid); + swapl(&from->event); + swapl(&from->root); + swapl(&from->root_x); + swapl(&from->root_y); + + swapl(&from->dx.integral); + swapl(&from->dx.frac); + swapl(&from->dy.integral); + swapl(&from->dy.frac); + swapl(&from->dtime); + swapl(&from->barrier); + swapl(&from->eventid); } /** Event swapping function for XI2 events. */ |