Пример #1
0
static void
drag_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time,
		int touch_id, wl_fixed_t sx, wl_fixed_t sy)
{
	struct weston_touch_drag *touch_drag =
		container_of(grab, struct weston_touch_drag, grab);
	struct weston_touch *touch = grab->touch;
	wl_fixed_t view_x, view_y;
	float fx, fy;

	if (touch_id != touch->grab_touch_id)
		return;

	drag_grab_touch_focus(touch_drag);
	if (touch_drag->base.icon) {
		fx = wl_fixed_to_double(touch->grab_x) + touch_drag->base.dx;
		fy = wl_fixed_to_double(touch->grab_y) + touch_drag->base.dy;
		weston_view_set_position(touch_drag->base.icon, fx, fy);
		weston_view_schedule_repaint(touch_drag->base.icon);
	}

	if (touch_drag->base.focus_resource) {
		weston_view_from_global_fixed(touch_drag->base.focus,
					touch->grab_x, touch->grab_y,
					&view_x, &view_y);
		wl_data_device_send_motion(touch_drag->base.focus_resource, time,
					view_x, view_y);
	}
}
Пример #2
0
static void
drag_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
		 wl_fixed_t x, wl_fixed_t y)
{
	struct weston_pointer_drag *drag =
		container_of(grab, struct weston_pointer_drag, grab);
	struct weston_pointer *pointer = drag->grab.pointer;
	float fx, fy;
	wl_fixed_t sx, sy;

	weston_pointer_move(pointer, x, y);

	if (drag->base.icon) {
		fx = wl_fixed_to_double(pointer->x) + drag->base.dx;
		fy = wl_fixed_to_double(pointer->y) + drag->base.dy;
		weston_view_set_position(drag->base.icon, fx, fy);
		weston_view_schedule_repaint(drag->base.icon);
	}

	if (drag->base.focus_resource) {
		weston_view_from_global_fixed(drag->base.focus,
					      pointer->x, pointer->y,
					      &sx, &sy);

		wl_data_device_send_motion(drag->base.focus_resource, time, sx, sy);
	}
}
Пример #3
0
static void
drag_grab_motion(struct wl_pointer_grab *grab,
		 uint32_t time, wl_fixed_t x, wl_fixed_t y)
{
	struct wl_seat *seat = container_of(grab, struct wl_seat, drag_grab);

	if (seat->drag_focus_resource)
		wl_data_device_send_motion(seat->drag_focus_resource,
					   time, x, y);
}
Пример #4
0
static void
drag_grab_motion (MetaWaylandPointerGrab *grab,
		  const ClutterEvent     *event)
{
  MetaWaylandDragGrab *drag_grab = (MetaWaylandDragGrab*) grab;
  wl_fixed_t sx, sy;

  if (drag_grab->drag_focus_data_device)
    {
      meta_wayland_pointer_get_relative_coordinates (grab->pointer,
						     drag_grab->drag_focus,
						     &sx, &sy);
      wl_data_device_send_motion (drag_grab->drag_focus_data_device,
				  clutter_event_get_time (event),
				  sx, sy);
    }

  if (drag_grab->drag_surface)
    meta_feedback_actor_update (META_FEEDBACK_ACTOR (drag_grab->feedback_actor),
                                event);
}