diff --git a/kiwmi/input/cursor.c b/kiwmi/input/cursor.c index e63e518..b532426 100644 --- a/kiwmi/input/cursor.c +++ b/kiwmi/input/cursor.c @@ -116,7 +116,21 @@ request_set_cursor_notify(struct wl_listener *listener, void *data) struct kiwmi_cursor *cursor = wl_container_of(listener, cursor, request_set_cursor); struct wlr_seat_pointer_request_set_cursor_event *event = data; - // FIXME: this should verify if the window has focus + + struct wlr_surface *focused_surface = + event->seat_client->seat->pointer_state.focused_surface; + struct wl_client *focused_client = NULL; + + if (focused_surface && focused_surface->resource) { + focused_client = wl_resource_get_client(focused_surface->resource); + } + + if (event->seat_client->client != focused_client) { + wlr_log( + WLR_DEBUG, "Ignoring request to set cursor on unfocused client"); + return; + } + wlr_cursor_set_surface( cursor->cursor, event->surface, event->hotspot_x, event->hotspot_y); }