diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index d3d3e00d..d267924c 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -125,11 +125,20 @@ struct wlr_seat { struct wl_signal keyboard_grab_begin; struct wl_signal keyboard_grab_end; + + struct wl_signal request_set_cursor; } events; void *data; }; +struct wlr_seat_pointer_request_set_cursor_event { + struct wl_client *client; + struct wlr_seat_handle *seat_handle; + struct wlr_surface *surface; + int32_t hotspot_x, hotspot_y; +}; + /** * Allocates a new wlr_seat and adds a wl_seat global to the display. */ diff --git a/types/wlr_seat.c b/types/wlr_seat.c index 4566053d..25c39235 100644 --- a/types/wlr_seat.c +++ b/types/wlr_seat.c @@ -20,12 +20,26 @@ static void pointer_send_frame(struct wl_resource *resource) { } static void wl_pointer_set_cursor(struct wl_client *client, - struct wl_resource *resource, - uint32_t serial, - struct wl_resource *surface, - int32_t hotspot_x, - int32_t hotspot_y) { - wlr_log(L_DEBUG, "TODO: wl_pointer_set_cursor"); + struct wl_resource *resource, uint32_t serial, + struct wl_resource *surface_resource, + int32_t hotspot_x, int32_t hotspot_y) { + struct wlr_seat_handle *handle = wl_resource_get_user_data(resource); + struct wlr_surface *surface = wl_resource_get_user_data(surface_resource); + + struct wlr_seat_pointer_request_set_cursor_event *event = + calloc(1, sizeof(struct wlr_seat_pointer_request_set_cursor_event)); + if (event == NULL) { + return; + } + event->client = client; + event->seat_handle = handle; + event->surface = surface; + event->hotspot_x = hotspot_x; + event->hotspot_y = hotspot_y; + + wl_signal_emit(&handle->wlr_seat->events.request_set_cursor, event); + + free(event); } static const struct wl_pointer_interface wl_pointer_impl = { @@ -285,6 +299,7 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) { wl_signal_init(&wlr_seat->events.client_bound); wl_signal_init(&wlr_seat->events.client_unbound); + wl_signal_init(&wlr_seat->events.request_set_cursor); wl_signal_init(&wlr_seat->events.pointer_grab_begin); wl_signal_init(&wlr_seat->events.pointer_grab_end);