static void handle_touch_with_coords(struct libinput_device *libinput_device, struct libinput_event_touch *touch_event, int touch_type) { struct evdev_device *device = libinput_device_get_user_data(libinput_device); wl_fixed_t x; wl_fixed_t y; uint32_t width, height; uint32_t time; int32_t slot; if (!device->output) return; time = libinput_event_touch_get_time(touch_event); slot = libinput_event_touch_get_seat_slot(touch_event); width = device->output->current_mode->width; height = device->output->current_mode->height; x = wl_fixed_from_double( libinput_event_touch_get_x_transformed(touch_event, width)); y = wl_fixed_from_double( libinput_event_touch_get_y_transformed(touch_event, height)); weston_output_transform_coordinate(device->output, x, y, &x, &y); notify_touch(device->seat, time, slot, x, y, touch_type); }
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; } }
void touch_work_func(struct work_struct *work) { int perc; BAT_DBG(" %s enter\n", __func__); mutex_lock(&batt_info_mutex); perc = batt_info.percentage; mutex_unlock(&batt_info_mutex); notify_touch(perc); }
static void handle_touch_up(struct libinput_device *libinput_device, struct libinput_event_touch *touch_event) { struct evdev_device *device = libinput_device_get_user_data(libinput_device); uint32_t time = libinput_event_touch_get_time(touch_event); int32_t slot = libinput_event_touch_get_seat_slot(touch_event); notify_touch(device->seat, time, slot, 0, 0, WL_TOUCH_UP); }
static inline void evdev_process_key(struct evdev_device *device, struct input_event *e, int time) { /* ignore kernel key repeat */ if (e->value == 2) return; switch (e->code) { case BTN_LEFT: case BTN_RIGHT: case BTN_MIDDLE: case BTN_SIDE: case BTN_EXTRA: case BTN_FORWARD: case BTN_BACK: case BTN_TASK: notify_button(device->seat, time, e->code, e->value ? WL_POINTER_BUTTON_STATE_PRESSED : WL_POINTER_BUTTON_STATE_RELEASED); break; case BTN_TOUCH: if (e->value == 0 && !device->is_mt) notify_touch(device->seat, time, 0, 0, 0, WL_TOUCH_UP); break; default: notify_key(device->seat, time, e->code, e->value ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED, STATE_UPDATE_AUTOMATIC); break; } }
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; } }