aboutsummaryrefslogtreecommitdiff
path: root/rootston/roots_cursor.c
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-11-08 15:23:56 -0500
committerTony Crisci <tony@dubstepdish.com>2017-11-08 15:23:56 -0500
commit428bf18ec70a29d6e3d778ab3baf175a3cead0af (patch)
tree1b2d54a95b02a7dc6a2af5cbec7eb7c7f497c3e0 /rootston/roots_cursor.c
parent992f931ae9319999f338298d8e0538f13ee388d7 (diff)
rootston: request set cursor
Diffstat (limited to 'rootston/roots_cursor.c')
-rw-r--r--rootston/roots_cursor.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/rootston/roots_cursor.c b/rootston/roots_cursor.c
index 833551d1..c44b0e7f 100644
--- a/rootston/roots_cursor.c
+++ b/rootston/roots_cursor.c
@@ -281,3 +281,24 @@ void roots_cursor_handle_tool_tip(struct roots_cursor *cursor,
roots_cursor_press_button(cursor, event->device,
event->time_msec, BTN_LEFT, event->state);
}
+
+void roots_cursor_handle_request_set_cursor(struct roots_cursor *cursor,
+ struct wlr_seat_pointer_request_set_cursor_event *event) {
+ struct wlr_surface *focused_surface =
+ event->seat_client->seat->pointer_state.focused_surface;
+ bool has_focused = focused_surface != NULL && focused_surface->resource != NULL;
+ struct wl_client *focused_client = NULL;
+ if (has_focused) {
+ focused_client = wl_resource_get_client(focused_surface->resource);
+ }
+ if (event->seat_client->client != focused_client ||
+ cursor->mode != ROOTS_CURSOR_PASSTHROUGH) {
+ wlr_log(L_DEBUG, "Denying request to set cursor from unfocused client");
+ return;
+ }
+
+ wlr_log(L_DEBUG, "Setting client cursor");
+ wlr_cursor_set_surface(cursor->cursor, event->surface, event->hotspot_x,
+ event->hotspot_y);
+ cursor->cursor_client = event->seat_client->client;
+}