예제 #1
0
static void
handle_pointer_motion_absolute(
	struct libinput_device *libinput_device,
	struct libinput_event_pointer *pointer_event)
{
	struct evdev_device *device =
		libinput_device_get_user_data(libinput_device);
	struct weston_output *output = device->output;
	uint32_t time;
	wl_fixed_t x, y;
	uint32_t width, height;

	if (!output)
		return;

	time = libinput_event_pointer_get_time(pointer_event);
	width = device->output->current_mode->width;
	height = device->output->current_mode->height;

	x = wl_fixed_from_double(
		libinput_event_pointer_get_absolute_x_transformed(pointer_event,
								  width));
	y = wl_fixed_from_double(
		libinput_event_pointer_get_absolute_y_transformed(pointer_event,
								  height));

	weston_output_transform_coordinate(device->output, x, y, &x, &y);
	notify_motion_absolute(device->seat, time, x, y);
}
예제 #2
0
static void
ss_seat_handle_motion(void *data, struct wl_pointer *pointer,
		      uint32_t time, wl_fixed_t x, wl_fixed_t y)
{
	struct ss_seat *seat = data;

	/* No transformation of input position is required here because we are
	 * always receiving the input in the same coordinates as the output. */

	notify_motion_absolute(&seat->base, time, x, y);
}
예제 #3
0
파일: evdev.c 프로젝트: anderco/weston
static void
evdev_flush_motion(struct evdev_device *device, uint32_t time)
{
	struct weston_seat *master = device->seat;

	if (!(device->pending_events & EVDEV_SYN))
		return;

	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) {
		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_absolute(master, time,
			      wl_fixed_from_int(device->abs.x),
			      wl_fixed_from_int(device->abs.y));
		device->pending_events &= ~EVDEV_ABSOLUTE_MOTION;
	}
}
예제 #4
0
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;
	}
}