mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 10:29:49 +01:00
Check client is focused before setting client cursor
This commit is contained in:
parent
4d157fe5de
commit
f44c44502d
1 changed files with 15 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue