static void evdev_flush_motion(struct evdev_device *device, uint32_t time) { struct weston_seat *master = device->seat; if (!device->pending_events) return; if (device->pending_events & EVDEV_RELATIVE_MOTION) { notify_motion(master, time, master->seat.pointer->x + device->rel.dx, master->seat.pointer->y + device->rel.dy); device->pending_events &= ~EVDEV_RELATIVE_MOTION; device->rel.dx = 0; device->rel.dy = 0; } if (device->pending_events & EVDEV_ABSOLUTE_MT_DOWN) { notify_touch(master, time, device->mt.slot, wl_fixed_from_int(device->mt.x[device->mt.slot]), wl_fixed_from_int(device->mt.y[device->mt.slot]), WL_TOUCH_DOWN); device->pending_events &= ~EVDEV_ABSOLUTE_MT_DOWN; device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION; } if (device->pending_events & EVDEV_ABSOLUTE_MT_MOTION) { notify_touch(master, time, device->mt.slot, wl_fixed_from_int(device->mt.x[device->mt.slot]), wl_fixed_from_int(device->mt.y[device->mt.slot]), WL_TOUCH_MOTION); device->pending_events &= ~EVDEV_ABSOLUTE_MT_DOWN; device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION; } if (device->pending_events & EVDEV_ABSOLUTE_MT_UP) { notify_touch(master, time, device->mt.slot, 0, 0, WL_TOUCH_UP); device->pending_events &= ~EVDEV_ABSOLUTE_MT_UP; } if (device->pending_events & EVDEV_ABSOLUTE_MOTION) { transform_absolute(device); notify_motion(master, time, wl_fixed_from_int(device->abs.x), wl_fixed_from_int(device->abs.y)); device->pending_events &= ~EVDEV_ABSOLUTE_MOTION; } }
static void evdev_flush_pending_event(struct evdev_device *device, uint32_t time) { int32_t cx, cy; int slot; struct libinput_device *base = &device->base; slot = device->mt.slot; switch (device->pending_event) { case EVDEV_NONE: return; case EVDEV_RELATIVE_MOTION: pointer_notify_motion(base, time, device->rel.dx, device->rel.dy); device->rel.dx = 0; device->rel.dy = 0; goto handled; case EVDEV_ABSOLUTE_MT_DOWN: touch_notify_touch(base, time, slot, li_fixed_from_int(device->mt.slots[slot].x), li_fixed_from_int(device->mt.slots[slot].y), LIBINPUT_TOUCH_TYPE_DOWN); goto handled; case EVDEV_ABSOLUTE_MT_MOTION: touch_notify_touch(base, time, slot, li_fixed_from_int(device->mt.slots[slot].x), li_fixed_from_int(device->mt.slots[slot].y), LIBINPUT_TOUCH_TYPE_MOTION); goto handled; case EVDEV_ABSOLUTE_MT_UP: touch_notify_touch(base, time, slot, 0, 0, LIBINPUT_TOUCH_TYPE_UP); goto handled; case EVDEV_ABSOLUTE_TOUCH_DOWN: transform_absolute(device, &cx, &cy); touch_notify_touch(base, time, slot, li_fixed_from_int(cx), li_fixed_from_int(cy), LIBINPUT_TOUCH_TYPE_DOWN); goto handled; case EVDEV_ABSOLUTE_MOTION: transform_absolute(device, &cx, &cy); if (device->caps & EVDEV_TOUCH) { touch_notify_touch(base, time, slot, li_fixed_from_int(cx), li_fixed_from_int(cy), LIBINPUT_TOUCH_TYPE_DOWN); } else { pointer_notify_motion_absolute(base, time, li_fixed_from_int(cx), li_fixed_from_int(cy)); } goto handled; case EVDEV_ABSOLUTE_TOUCH_UP: touch_notify_touch(base, time, 0, 0, 0, LIBINPUT_TOUCH_TYPE_UP); goto handled; } assert(0 && "Unknown pending event type"); handled: device->pending_event = EVDEV_NONE; }
static void evdev_flush_motion(struct evdev_device *device, uint32_t time) { struct weston_seat *master = device->seat; wl_fixed_t x, y; int slot; if (!(device->pending_events & EVDEV_SYN)) return; slot = device->mt.slot; device->pending_events &= ~EVDEV_SYN; if (device->pending_events & EVDEV_RELATIVE_MOTION) { notify_motion(master, time, device->rel.dx, device->rel.dy); device->pending_events &= ~EVDEV_RELATIVE_MOTION; device->rel.dx = 0; device->rel.dy = 0; } if (device->pending_events & EVDEV_ABSOLUTE_MT_DOWN) { weston_output_transform_coordinate(device->output, device->mt.x[slot], device->mt.y[slot], &x, &y); notify_touch(master, time, device->mt.slot, x, y, WL_TOUCH_DOWN); device->pending_events &= ~EVDEV_ABSOLUTE_MT_DOWN; device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION; } if (device->pending_events & EVDEV_ABSOLUTE_MT_MOTION) { weston_output_transform_coordinate(device->output, device->mt.x[slot], device->mt.y[slot], &x, &y); notify_touch(master, time, device->mt.slot, x, y, WL_TOUCH_MOTION); device->pending_events &= ~EVDEV_ABSOLUTE_MT_DOWN; device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION; } if (device->pending_events & EVDEV_ABSOLUTE_MT_UP) { notify_touch(master, time, device->mt.slot, 0, 0, WL_TOUCH_UP); device->pending_events &= ~EVDEV_ABSOLUTE_MT_UP; } if (device->pending_events & EVDEV_ABSOLUTE_MOTION) { transform_absolute(device); weston_output_transform_coordinate(device->output, device->abs.x, device->abs.y, &x, &y); if (device->caps & EVDEV_TOUCH) { if (master->num_tp == 0) notify_touch(master, time, 0, x, y, WL_TOUCH_DOWN); else notify_touch(master, time, 0, x, y, WL_TOUCH_MOTION); } else notify_motion_absolute(master, time, x, y); device->pending_events &= ~EVDEV_ABSOLUTE_MOTION; } }