Simplify evdev_flush_motion() a tiny bit
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 23 Nov 2011 00:24:25 +0000 (19:24 -0500)
committerJonas Ådahl <jadahl@gmail.com>
Sun, 10 Nov 2013 16:51:26 +0000 (17:51 +0100)
compositor/evdev.c

index 06913cf..d36c9b4 100644 (file)
@@ -207,16 +207,13 @@ static void
 evdev_flush_motion(struct wl_input_device *device, uint32_t time,
                   struct evdev_motion_accumulator *accum)
 {
-       if (accum->type == EVDEV_RELATIVE_MOTION) {
-               accum->dx += device->x;
-               accum->dy += device->y;
-               notify_motion(device, time, accum->dx, accum->dy);
-               accum->dx = accum->dy = 0;
-       }
+       if (accum->type == EVDEV_RELATIVE_MOTION)
+               notify_motion(device, time,
+                             device->x + accum->dx, device->y + accum->dy);
        if (accum->type == EVDEV_ABSOLUTE_MOTION)
                notify_motion(device, time, accum->x, accum->y);
 
-       accum->type = 0;
+       memset(accum, 0, sizeof *accum);
 }
 
 static int