Esempio n. 1
0
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;
	}
}
Esempio n. 2
0
static void
handle_pointer_motion(struct libinput_device *libinput_device,
		      struct libinput_event_pointer *pointer_event)
{
	struct evdev_device *device =
		libinput_device_get_user_data(libinput_device);

	notify_motion(device->seat,
		      libinput_event_pointer_get_time(pointer_event),
		      libinput_event_pointer_get_dx(pointer_event),
		      libinput_event_pointer_get_dy(pointer_event));
}
Esempio n. 3
0
static void
input_handle_motion(void *data, struct wl_pointer *pointer,
		    uint32_t time, wl_fixed_t x, wl_fixed_t y)
{
	struct wayland_input *input = data;
	struct wayland_compositor *c = input->compositor;

	check_focus(input, x, y);
	if (input->focus)
		notify_motion(&input->base, time,
			      x - wl_fixed_from_int(c->border.left) -
			      input->base.pointer->x,
			      y - wl_fixed_from_int(c->border.top) -
			      input->base.pointer->y);
}
Esempio n. 4
0
static void
handle_pointer_motion(struct libinput_device *libinput_device,
		      struct libinput_event_pointer *pointer_event)
{
	struct evdev_device *device =
		libinput_device_get_user_data(libinput_device);
	wl_fixed_t dx, dy;

	dx = wl_fixed_from_double(libinput_event_pointer_get_dx(pointer_event));
	dy = wl_fixed_from_double(libinput_event_pointer_get_dy(pointer_event));
	notify_motion(device->seat,
		      libinput_event_pointer_get_time(pointer_event),
		      dx,
		      dy);
}
Esempio n. 5
0
static void
handle_button_event (ClaylandSeat *seat,
                     const ClutterButtonEvent *event)
{
  ClaylandPointer *pointer = &seat->pointer;
  gboolean state = event->type == CLUTTER_BUTTON_PRESS;
  uint32_t button;

  notify_motion (seat, (const ClutterEvent *) event);

  switch (event->button)
    {
      /* The evdev input right and middle button numbers are swapped
         relative to how Clutter numbers them */
    case 2:
      button = BTN_MIDDLE;
      break;

    case 3:
      button = BTN_RIGHT;
      break;

    default:
      button = event->button + BTN_LEFT - 1;
      break;
    }

  if (state)
    {
      if (pointer->button_count == 0)
        {
          pointer->grab_button = button;
          pointer->grab_time = event->time;
          pointer->grab_x = pointer->x;
          pointer->grab_y = pointer->y;
        }

      pointer->button_count++;
    }
  else
    pointer->button_count--;

  pointer->grab->interface->button (pointer->grab, event->time, button, state);

  if (pointer->button_count == 1)
    pointer->grab_serial = wl_display_get_serial (seat->display);
}
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);
}
Esempio n. 7
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;
	}
}
Esempio n. 8
0
static void
handle_motion_event (ClaylandSeat *seat,
                     const ClutterMotionEvent *event)
{
  notify_motion (seat, (const ClutterEvent *) event);
}