From 31914928d22934a09d2f19ef996500c324bd5ff2 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 14 Dec 2021 08:15:45 +0100 Subject: [PATCH] seat: Only resend keyboard/pointer enter to focused clients Otherwise it will send enter events to clients that already have keyboard/pointer focus. Notably Qt applications warns about this. --- types/seat/wlr_seat_keyboard.c | 2 +- types/seat/wlr_seat_pointer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/seat/wlr_seat_keyboard.c b/types/seat/wlr_seat_keyboard.c index e97b4825..57dbfe2f 100644 --- a/types/seat/wlr_seat_keyboard.c +++ b/types/seat/wlr_seat_keyboard.c @@ -415,7 +415,7 @@ void seat_client_create_keyboard(struct wlr_seat_client *seat_client, seat_client->seat->keyboard_state.focused_surface; // Send an enter event if there is a focused client/surface stored - if (focused_client != NULL && focused_surface != NULL) { + if (focused_client == seat_client && focused_surface != NULL) { uint32_t *keycodes = keyboard->keycodes; size_t num_keycodes = keyboard->num_keycodes; diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c index 27ece5e8..2fa911ee 100644 --- a/types/seat/wlr_seat_pointer.c +++ b/types/seat/wlr_seat_pointer.c @@ -446,7 +446,7 @@ void seat_client_create_pointer(struct wlr_seat_client *seat_client, seat_client->seat->pointer_state.focused_surface; // Send an enter event if there is a focused client/surface stored - if (focused_client != NULL && focused_surface != NULL) { + if (focused_client == seat_client && focused_surface != NULL) { double sx = seat_client->seat->pointer_state.sx; double sy = seat_client->seat->pointer_state.sy;