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>
This commit is contained in:
parent
151d44149a
commit
cc10ac8f0e
39
Xi/extinit.c
39
Xi/extinit.c
|
@ -845,30 +845,27 @@ STouchOwnershipEvent(xXITouchOwnershipEvent * from, xXITouchOwnershipEvent * to)
|
||||||
static void
|
static void
|
||||||
SBarrierEvent(xXIBarrierEvent * from,
|
SBarrierEvent(xXIBarrierEvent * from,
|
||||||
xXIBarrierEvent * to) {
|
xXIBarrierEvent * to) {
|
||||||
to->type = from->type;
|
|
||||||
|
|
||||||
cpswaps(from->sequenceNumber, to->sequenceNumber);
|
*to = *from;
|
||||||
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) \
|
swaps(&from->sequenceNumber);
|
||||||
do { \
|
swapl(&from->length);
|
||||||
cpswapl((x).integral, (y).integral); \
|
swaps(&from->evtype);
|
||||||
cpswapl((x).frac, (y).frac); \
|
swapl(&from->time);
|
||||||
} while(0)
|
swaps(&from->deviceid);
|
||||||
|
swaps(&from->sourceid);
|
||||||
|
swapl(&from->event);
|
||||||
|
swapl(&from->root);
|
||||||
|
swapl(&from->root_x);
|
||||||
|
swapl(&from->root_y);
|
||||||
|
|
||||||
SWAP_FP3232(from->dx, to->dx);
|
swapl(&from->dx.integral);
|
||||||
SWAP_FP3232(from->dy, to->dy);
|
swapl(&from->dx.frac);
|
||||||
cpswapl(from->dtime, to->dtime);
|
swapl(&from->dy.integral);
|
||||||
cpswapl(from->barrier, to->barrier);
|
swapl(&from->dy.frac);
|
||||||
cpswapl(from->eventid, to->eventid);
|
swapl(&from->dtime);
|
||||||
|
swapl(&from->barrier);
|
||||||
|
swapl(&from->eventid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event swapping function for XI2 events. */
|
/** Event swapping function for XI2 events. */
|
||||||
|
|
Loading…
Reference in New Issue