Verify focus on cursor image changes
This commit is contained in:
parent
0bdfdde29b
commit
9dfbb462ca
1 changed files with 15 additions and 1 deletions
|
@ -116,7 +116,21 @@ request_set_cursor_notify(struct wl_listener *listener, void *data)
|
||||||
struct kiwmi_cursor *cursor =
|
struct kiwmi_cursor *cursor =
|
||||||
wl_container_of(listener, cursor, request_set_cursor);
|
wl_container_of(listener, cursor, request_set_cursor);
|
||||||
struct wlr_seat_pointer_request_set_cursor_event *event = data;
|
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(
|
wlr_cursor_set_surface(
|
||||||
cursor->cursor, event->surface, event->hotspot_x, event->hotspot_y);
|
cursor->cursor, event->surface, event->hotspot_x, event->hotspot_y);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue