diff options
author | Tiago Vignatti <tiago.vignatti@intel.com> | 2011-11-22 12:05:22 +0200 |
---|---|---|
committer | Tiago Vignatti <tiago.vignatti@intel.com> | 2011-11-22 12:05:22 +0200 |
commit | f547bd36e67c85de8aaf1be6b704f153a15b36d6 (patch) | |
tree | 4e57761ecfa1ceab900add8dff6e5b78202cbee0 | |
parent | 5c900ce08ddf2a34c6b69de4af1c1223f366c03a (diff) |
evdev: fetch absolute coordinates inside flush_motion only
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
-rw-r--r-- | compositor/evdev.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/compositor/evdev.c b/compositor/evdev.c index 96fb0cd9..06913cf4 100644 --- a/compositor/evdev.c +++ b/compositor/evdev.c @@ -208,8 +208,9 @@ evdev_flush_motion(struct wl_input_device *device, uint32_t time, struct evdev_motion_accumulator *accum) { if (accum->type == EVDEV_RELATIVE_MOTION) { - notify_motion(device, time, accum->x + accum->dx, - accum->y + accum->dy); + 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_ABSOLUTE_MOTION) @@ -233,16 +234,14 @@ evdev_input_device_data(int fd, uint32_t mask, void *data) if (!ec->focus) return 1; - memset(&accumulator, 0, sizeof accumulator); - accumulator.x = device->master->base.input_device.x; - accumulator.y = device->master->base.input_device.y; - len = read(fd, &ev, sizeof ev); if (len < 0 || len % sizeof e[0] != 0) { /* FIXME: call device_removed when errno is ENODEV. */; return 1; } + memset(&accumulator, 0, sizeof accumulator); + e = ev; end = (void *) ev + len; for (e = ev; e < end; e++) { |