seat: Rewrite the pointer interface in terms of MetaWaylandPointer

This commit is contained in:
Jasper St. Pierre 2014-04-17 17:02:42 -04:00
parent 15d89d451f
commit f3d88ca1d1

View File

@ -48,13 +48,6 @@ unbind_resource (struct wl_resource *resource)
wl_list_remove (wl_resource_get_link (resource));
}
static void
set_cursor_surface (MetaWaylandSeat *seat,
MetaWaylandSurface *surface)
{
meta_wayland_pointer_set_cursor_surface (&seat->pointer, surface);
}
static void
pointer_set_cursor (struct wl_client *client,
struct wl_resource *resource,
@ -62,22 +55,22 @@ pointer_set_cursor (struct wl_client *client,
struct wl_resource *surface_resource,
int32_t x, int32_t y)
{
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
MetaWaylandPointer *pointer = wl_resource_get_user_data (resource);
MetaWaylandSurface *surface;
surface = (surface_resource ? wl_resource_get_user_data (surface_resource) : NULL);
if (seat->pointer.focus_surface == NULL)
if (pointer->focus_surface == NULL)
return;
if (wl_resource_get_client (seat->pointer.focus_surface->resource) != client)
if (wl_resource_get_client (pointer->focus_surface->resource) != client)
return;
if (seat->pointer.focus_serial - serial > G_MAXUINT32 / 2)
if (pointer->focus_serial - serial > G_MAXUINT32 / 2)
return;
seat->pointer.hotspot_x = x;
seat->pointer.hotspot_y = y;
set_cursor_surface (seat, surface);
meta_wayland_pointer_update_cursor_surface (&seat->pointer);
pointer->hotspot_x = x;
pointer->hotspot_y = y;
meta_wayland_pointer_set_cursor_surface (pointer, surface);
meta_wayland_pointer_update_cursor_surface (pointer);
}
static void
@ -103,7 +96,7 @@ seat_get_pointer (struct wl_client *client,
cr = wl_resource_create (client, &wl_pointer_interface,
MIN (META_WL_POINTER_VERSION, wl_resource_get_version (resource)), id);
wl_resource_set_implementation (cr, &pointer_interface, seat, unbind_resource);
wl_resource_set_implementation (cr, &pointer_interface, pointer, unbind_resource);
wl_list_insert (&pointer->resource_list, wl_resource_get_link (cr));
if (pointer->focus_surface && wl_resource_get_client (pointer->focus_surface->resource) == client)