diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 9cf58c47f..9aa4ab1fa 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c @@ -192,12 +192,12 @@ static void state_add_button(struct seatop_default_event *e, uint32_t button) { static void cursor_do_rebase(struct sway_cursor *cursor, uint32_t time_msec, struct sway_node *node, struct wlr_surface *surface, double sx, double sy) { + struct wlr_seat *wlr_seat = cursor->seat->wlr_seat; // Handle cursor image if (surface) { - // Reset cursor if switching between clients - struct wl_client *client = wl_resource_get_client(surface->resource); - if (client != cursor->image_client) { - cursor_set_image(cursor, "left_ptr", client); + if (seat_is_input_allowed(cursor->seat, surface)) { + wlr_seat_pointer_notify_enter(wlr_seat, surface, sx, sy); + wlr_seat_pointer_notify_motion(wlr_seat, time_msec, sx, sy); } } else if (node && node->type == N_CONTAINER) { // Try a node's resize edge @@ -217,14 +217,7 @@ static void cursor_do_rebase(struct sway_cursor *cursor, uint32_t time_msec, cursor_set_image(cursor, "left_ptr", NULL); } - // Send pointer enter/leave - struct wlr_seat *wlr_seat = cursor->seat->wlr_seat; - if (surface) { - if (seat_is_input_allowed(cursor->seat, surface)) { - wlr_seat_pointer_notify_enter(wlr_seat, surface, sx, sy); - wlr_seat_pointer_notify_motion(wlr_seat, time_msec, sx, sy); - } - } else { + if (surface == NULL) { wlr_seat_pointer_clear_focus(wlr_seat); } } diff --git a/sway/input/seatop_move_floating.c b/sway/input/seatop_move_floating.c index 73e489642..8f133c36f 100644 --- a/sway/input/seatop_move_floating.c +++ b/sway/input/seatop_move_floating.c @@ -60,4 +60,5 @@ void seatop_begin_move_floating(struct sway_seat *seat, container_raise_floating(con); cursor_set_image(seat->cursor, "grab", NULL); + wlr_seat_pointer_clear_focus(seat->wlr_seat); } diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c index 64a16c098..7c31e695a 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c @@ -327,6 +327,7 @@ void seatop_begin_move_tiling_threshold(struct sway_seat *seat, seat->seatop_data = e; container_raise_floating(con); + wlr_seat_pointer_clear_focus(seat->wlr_seat); } void seatop_begin_move_tiling(struct sway_seat *seat, diff --git a/sway/input/seatop_resize_floating.c b/sway/input/seatop_resize_floating.c index b6950bbf3..3d95295c5 100644 --- a/sway/input/seatop_resize_floating.c +++ b/sway/input/seatop_resize_floating.c @@ -160,4 +160,5 @@ void seatop_begin_resize_floating(struct sway_seat *seat, const char *image = edge == WLR_EDGE_NONE ? "se-resize" : wlr_xcursor_get_resize_name(edge); cursor_set_image(seat->cursor, image, NULL); + wlr_seat_pointer_clear_focus(seat->wlr_seat); } diff --git a/sway/input/seatop_resize_tiling.c b/sway/input/seatop_resize_tiling.c index 6b705823a..020bba1b1 100644 --- a/sway/input/seatop_resize_tiling.c +++ b/sway/input/seatop_resize_tiling.c @@ -105,4 +105,6 @@ void seatop_begin_resize_tiling(struct sway_seat *seat, seat->seatop_impl = &seatop_impl; seat->seatop_data = e; + + wlr_seat_pointer_clear_focus(seat->wlr_seat); }