aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/rootston/input.h2
-rw-r--r--rootston/cursor.c23
-rw-r--r--types/wlr_seat.c5
3 files changed, 29 insertions, 1 deletions
diff --git a/include/rootston/input.h b/include/rootston/input.h
index 9caf66c0..bdd2a104 100644
--- a/include/rootston/input.h
+++ b/include/rootston/input.h
@@ -107,6 +107,8 @@ struct roots_input {
struct wl_listener cursor_tool_tip;
struct wl_listener pointer_grab_end;
+
+ struct wl_listener request_set_cursor;
};
struct roots_input *input_create(struct roots_server *server,
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,
diff --git a/types/wlr_seat.c b/types/wlr_seat.c
index 25c39235..a543936d 100644
--- a/types/wlr_seat.c
+++ b/types/wlr_seat.c
@@ -24,7 +24,10 @@ static void wl_pointer_set_cursor(struct wl_client *client,
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_surface *surface = NULL;
+ if (surface_resource != NULL) {
+ 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));