diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index b97f0152c2..ca1b7b7ea6 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c @@ -659,10 +659,13 @@ static void handle_modifier_event(struct sway_keyboard *keyboard) { wlr_input_method_keyboard_grab_v2_send_modifiers(kb_grab, &keyboard->wlr->modifiers); } else { - struct wlr_seat *wlr_seat = keyboard->seat_device->sway_seat->wlr_seat; + struct sway_seat *seat = keyboard->seat_device->sway_seat; + struct wlr_seat *wlr_seat = seat->wlr_seat; wlr_seat_set_keyboard(wlr_seat, keyboard->wlr); wlr_seat_keyboard_notify_modifiers(wlr_seat, &keyboard->wlr->modifiers); + wlr_seat_client_notify_modifiers(wlr_seat, + wlr_seat->pointer_state.focused_client); } uint32_t modifiers = wlr_keyboard_get_modifiers(keyboard->wlr); diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index c56330fd90..84a4ce9872 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c @@ -609,6 +609,10 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { double sx, sy; struct sway_node *node = node_at_coords(seat, cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); + struct wlr_seat_client *prev_focus_seat_client; + struct wlr_seat_client *curr_focus_seat_client; + struct wl_client *prev_focus_client; + struct wl_client *curr_focus_client; if (config->focus_follows_mouse != FOLLOWS_NO) { check_focus_follows_mouse(seat, e, node); @@ -616,8 +620,17 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { if (surface) { if (seat_is_input_allowed(seat, surface)) { + prev_focus_seat_client = seat->wlr_seat->pointer_state.focused_client; + prev_focus_client = prev_focus_seat_client ? prev_focus_seat_client->client : NULL; + wlr_seat_pointer_notify_enter(seat->wlr_seat, surface, sx, sy); wlr_seat_pointer_notify_motion(seat->wlr_seat, time_msec, sx, sy); + + curr_focus_seat_client = seat->wlr_seat->pointer_state.focused_client; + curr_focus_client = curr_focus_seat_client ? curr_focus_seat_client->client : NULL; + + if (prev_focus_client != curr_focus_client) + wlr_seat_client_notify_modifiers(seat->wlr_seat, curr_focus_seat_client); } } else { cursor_update_image(cursor, node);