コード例 #1
0
static void
drag_grab_focus (MetaWaylandPointerGrab *grab,
                 MetaWaylandSurface     *surface)
{
  MetaWaylandDragGrab *drag_grab = (MetaWaylandDragGrab*) grab;
  MetaWaylandSeat *seat = drag_grab->seat;
  struct wl_client *client;
  struct wl_resource *data_device_resource, *offer = NULL;
  struct wl_display *display;
  guint32 serial;
  wl_fixed_t sx, sy;

  if (drag_grab->drag_focus == surface)
    return;

  if (drag_grab->drag_focus_data_device)
    {
      wl_data_device_send_leave (drag_grab->drag_focus_data_device);
      wl_list_remove (&drag_grab->drag_focus_listener.link);
      drag_grab->drag_focus_data_device = NULL;
      drag_grab->drag_focus = NULL;
    }

  if (!surface)
    return;

  if (!drag_grab->drag_data_source &&
      wl_resource_get_client (surface->resource) != drag_grab->drag_client)
    return;

  client = wl_resource_get_client (surface->resource);

  data_device_resource = wl_resource_find_for_client (&seat->data_device.resource_list, client);
  if (!data_device_resource)
    return;

  display = wl_client_get_display (client);
  serial = wl_display_next_serial (display);

  if (drag_grab->drag_data_source)
    offer = meta_wayland_data_source_send_offer (drag_grab->drag_data_source,
                                                 data_device_resource);

  meta_wayland_pointer_get_relative_coordinates (grab->pointer, surface, &sx, &sy);
  wl_data_device_send_enter (data_device_resource, serial, surface->resource,
                             sx, sy, offer);

  drag_grab->drag_focus = surface;

  drag_grab->drag_focus_data_device = data_device_resource;
  drag_grab->drag_focus_listener.notify = destroy_drag_focus;
  wl_resource_add_destroy_listener (data_device_resource, &drag_grab->drag_focus_listener);
}
コード例 #2
0
ファイル: meta-wayland-pointer.c プロジェクト: ueno/mutter
void
meta_wayland_pointer_send_motion (MetaWaylandPointer *pointer,
                                  const ClutterEvent *event)
{
  struct wl_resource *resource;
  struct wl_list *l;

  l = &pointer->focus_resource_list;
  wl_resource_for_each(resource, l)
    {
      wl_fixed_t sx, sy;

      meta_wayland_pointer_get_relative_coordinates (pointer,
                                                     pointer->focus_surface,
                                                     &sx, &sy);
      wl_pointer_send_motion (resource, clutter_event_get_time (event), sx, sy);
    }
コード例 #3
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);
}