示例#1
0
static void
handle_pointer_axis(struct libinput_device *libinput_device,
		    struct libinput_event_pointer *pointer_event)
{
	struct evdev_device *device =
		libinput_device_get_user_data(libinput_device);
	double value;
	enum libinput_pointer_axis axis;

	axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
	if (libinput_event_pointer_has_axis(pointer_event, axis)) {
		value = normalize_scroll(pointer_event, axis);
		notify_axis(device->seat,
			    libinput_event_pointer_get_time(pointer_event),
			    WL_POINTER_AXIS_VERTICAL_SCROLL,
			    wl_fixed_from_double(value));
	}

	axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
	if (libinput_event_pointer_has_axis(pointer_event, axis)) {
		value = normalize_scroll(pointer_event, axis);
		notify_axis(device->seat,
			    libinput_event_pointer_get_time(pointer_event),
			    WL_POINTER_AXIS_HORIZONTAL_SCROLL,
			    wl_fixed_from_double(value));
	}
}
示例#2
0
static void
input_handle_axis(void *data, struct wl_pointer *pointer,
		  uint32_t time, uint32_t axis, wl_fixed_t value)
{
	struct wayland_input *input = data;

	notify_axis(&input->base, time, axis, value);
}
示例#3
0
static void
ss_seat_handle_axis(void *data, struct wl_pointer *pointer,
		    uint32_t time, uint32_t axis, wl_fixed_t value)
{
	struct ss_seat *seat = data;

	notify_axis(&seat->base, time, axis, value);
}
示例#4
0
文件: evdev.c 项目: anderco/weston
static inline void
evdev_process_relative(struct evdev_device *device,
		       struct input_event *e, uint32_t time)
{
	switch (e->code) {
	case REL_X:
		device->rel.dx += wl_fixed_from_int(e->value);
		device->pending_events |= EVDEV_RELATIVE_MOTION;
		break;
	case REL_Y:
		device->rel.dy += wl_fixed_from_int(e->value);
		device->pending_events |= EVDEV_RELATIVE_MOTION;
		break;
	case REL_WHEEL:
		switch (e->value) {
		case -1:
			/* Scroll down */
		case 1:
			/* Scroll up */
			notify_axis(device->seat,
				    time,
				    WL_POINTER_AXIS_VERTICAL_SCROLL,
				    -1 * e->value * DEFAULT_AXIS_STEP_DISTANCE);
			break;
		default:
			break;
		}
		break;
	case REL_HWHEEL:
		switch (e->value) {
		case -1:
			/* Scroll left */
		case 1:
			/* Scroll right */
			notify_axis(device->seat,
				    time,
				    WL_POINTER_AXIS_HORIZONTAL_SCROLL,
				    e->value * DEFAULT_AXIS_STEP_DISTANCE);
			break;
		default:
			break;

		}
	}
}
示例#5
0
static void
handle_pointer_axis(struct libinput_device *libinput_device,
		    struct libinput_event_pointer *pointer_event)
{
	struct evdev_device *device =
		libinput_device_get_user_data(libinput_device);

	notify_axis(device->seat,
		    libinput_event_pointer_get_time(pointer_event),
		    libinput_event_pointer_get_axis(pointer_event),
		    libinput_event_pointer_get_axis_value(pointer_event));
}
static void
weston_mouse_motion (SpiceMouseInstance *sin, int dx, int dy, int dz,
        uint32_t buttons_state)
{
    spice_compositor_t *c = container_of(sin, spice_compositor_t, mouse_sin);

    dprint (3, "called. delta: (%d,%d,%d), buttons: %x",
            dx,dy,dz,buttons_state);
    if (!c->core_seat.has_pointer) {
        return;
    }
    notify_motion(&c->core_seat, weston_compositor_get_time(), 50*dx, 50*dy );
    notify_axis (&c->core_seat, weston_compositor_get_time(),
            WL_POINTER_AXIS_VERTICAL_SCROLL,
            dz*DEFAULT_AXIS_STEP_DISTANCE );

    weston_mouse_button_notify (c, buttons_state);
}