Add request_set_cursor event

This commit is contained in:
emersion 2017-10-05 13:11:51 +02:00
parent 3f4ccd0558
commit 78d3582b70
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
2 changed files with 30 additions and 6 deletions

View File

@ -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.
*/

View File

@ -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);