diff options
author | emersion <contact@emersion.fr> | 2017-10-07 10:55:17 +0200 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-10-08 20:37:47 +0200 |
commit | 65d57920e534acb231bb04964b257b2186c7ce73 (patch) | |
tree | 26a69c80c7ada139ac1d1ec6e3c272b351ff2650 /rootston/cursor.c | |
parent | 78d3582b70dcd823c3675806bcbda6776282eb6f (diff) |
rootston: handle request_set_cursor
Diffstat (limited to 'rootston/cursor.c')
-rw-r--r-- | rootston/cursor.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c index 605920cc..3423d33b 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -274,6 +274,24 @@ static void handle_pointer_grab_end(struct wl_listener *listener, void *data) { cursor_update_position(input, 0); } +static void handle_request_set_cursor(struct wl_listener *listener, + void *data) { + struct roots_input *input = wl_container_of(listener, input, + request_set_cursor); + //struct wlr_seat_pointer_request_set_cursor_event *event = data; + + struct wlr_xcursor_image *image = input->xcursor->images[0]; + struct roots_output *output; + wl_list_for_each(output, &input->server->desktop->outputs, link) { + if (!wlr_output_set_cursor(output->wlr_output, image->buffer, + image->width, image->width, image->height, + image->hotspot_x, image->hotspot_y)) { + wlr_log(L_DEBUG, "Failed to set hardware cursor"); + return; + } + } +} + void cursor_initialize(struct roots_input *input) { struct wlr_cursor *cursor = input->cursor; @@ -304,6 +322,11 @@ void cursor_initialize(struct roots_input *input) { wl_signal_add(&input->wl_seat->events.pointer_grab_end, &input->pointer_grab_end); input->pointer_grab_end.notify = handle_pointer_grab_end; + + wl_list_init(&input->request_set_cursor.link); + wl_signal_add(&input->wl_seat->events.request_set_cursor, + &input->request_set_cursor); + input->request_set_cursor.notify = handle_request_set_cursor; } static void reset_device_mappings(struct roots_config *config, |