aboutsummaryrefslogtreecommitdiff
path: root/rootston/cursor.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-10-09 13:06:53 +0200
committeremersion <contact@emersion.fr>2017-10-09 13:06:53 +0200
commitf44c44502df83a6774947bce161784c51c79e645 (patch)
tree833f37ce78f410572435d6f2a6bfbd4e0b85f7c7 /rootston/cursor.c
parent4d157fe5de78d632548df8f523f04a53b5688417 (diff)
Check client is focused before setting client cursor
Diffstat (limited to 'rootston/cursor.c')
-rw-r--r--rootston/cursor.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 106e054f..2df9bcb5 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -299,6 +299,21 @@ static void handle_request_set_cursor(struct wl_listener *listener,
request_set_cursor);
struct wlr_seat_pointer_request_set_cursor_event *event = data;
+ struct wlr_surface *focused_surface = NULL;
+ double sx, sy;
+ view_at(input->server->desktop, input->cursor->x, input->cursor->y,
+ &focused_surface, &sx, &sy);
+ bool ok = focused_surface != NULL;
+ if (focused_surface != NULL) {
+ struct wl_client *focused_client =
+ wl_resource_get_client(focused_surface->resource);
+ ok = event->client == focused_client;
+ }
+ if (!ok) {
+ wlr_log(L_DEBUG, "Denying request to set cursor outside view");
+ return;
+ }
+
wlr_log(L_DEBUG, "Setting client cursor");
struct roots_output *output;