static void
evdev_flush_motion(struct wl_input_device *device, uint32_t time,
- struct evdev_motion_accumulator accum)
+ struct evdev_motion_accumulator *accum)
{
- if (accum.type == EVDEV_RELATIVE_MOTION)
- notify_motion(device, time, accum.x + accum.dx,
- accum.y + accum.dy);
- if (accum.type == EVDEV_ABSOLUTE_MOTION)
- notify_motion(device, time, accum.x, accum.y);
+ if (accum->type == EVDEV_RELATIVE_MOTION) {
+ notify_motion(device, time, accum->x + accum->dx,
+ accum->y + accum->dy);
+ accum->dx = accum->dy = 0;
+ }
+ if (accum->type == EVDEV_ABSOLUTE_MOTION)
+ notify_motion(device, time, accum->x, accum->y);
+
+ accum->type = 0;
}
static int
if (!ec->focus)
return 1;
- accumulator.dx = 0;
- accumulator.dy = 0;
- accumulator.type = 0;
+ memset(&accumulator, 0, sizeof accumulator);
accumulator.x = device->master->base.input_device.x;
accumulator.y = device->master->base.input_device.y;
/* we try to minimize the amount of notifications to be
* forwarded to the compositor, so we accumulate motion
* events and send as a bunch */
- if (!is_motion_event(e)) {
+ if (!is_motion_event(e))
evdev_flush_motion(&device->master->base.input_device,
- time, accumulator);
- accumulator.dx = 0;
- accumulator.dy = 0;
- accumulator.type = 0;
- }
-
+ time, &accumulator);
switch (e->type) {
case EV_REL:
evdev_process_relative_motion(e, &accumulator);
}
evdev_flush_motion(&device->master->base.input_device, time,
- accumulator);
+ &accumulator);
return 1;
}