mirror of
https://github.com/swaywm/sway.git
synced 2024-12-01 19:06:38 +00:00
Clear pointer focus during move and resize seatops
This commit is contained in:
parent
812651d53e
commit
866a19b743
|
@ -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,
|
static void cursor_do_rebase(struct sway_cursor *cursor, uint32_t time_msec,
|
||||||
struct sway_node *node, struct wlr_surface *surface,
|
struct sway_node *node, struct wlr_surface *surface,
|
||||||
double sx, double sy) {
|
double sx, double sy) {
|
||||||
|
struct wlr_seat *wlr_seat = cursor->seat->wlr_seat;
|
||||||
// Handle cursor image
|
// Handle cursor image
|
||||||
if (surface) {
|
if (surface) {
|
||||||
// Reset cursor if switching between clients
|
if (seat_is_input_allowed(cursor->seat, surface)) {
|
||||||
struct wl_client *client = wl_resource_get_client(surface->resource);
|
wlr_seat_pointer_notify_enter(wlr_seat, surface, sx, sy);
|
||||||
if (client != cursor->image_client) {
|
wlr_seat_pointer_notify_motion(wlr_seat, time_msec, sx, sy);
|
||||||
cursor_set_image(cursor, "left_ptr", client);
|
|
||||||
}
|
}
|
||||||
} else if (node && node->type == N_CONTAINER) {
|
} else if (node && node->type == N_CONTAINER) {
|
||||||
// Try a node's resize edge
|
// 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);
|
cursor_set_image(cursor, "left_ptr", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send pointer enter/leave
|
if (surface == NULL) {
|
||||||
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 {
|
|
||||||
wlr_seat_pointer_clear_focus(wlr_seat);
|
wlr_seat_pointer_clear_focus(wlr_seat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,4 +60,5 @@ void seatop_begin_move_floating(struct sway_seat *seat,
|
||||||
container_raise_floating(con);
|
container_raise_floating(con);
|
||||||
|
|
||||||
cursor_set_image(seat->cursor, "grab", NULL);
|
cursor_set_image(seat->cursor, "grab", NULL);
|
||||||
|
wlr_seat_pointer_clear_focus(seat->wlr_seat);
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,6 +327,7 @@ void seatop_begin_move_tiling_threshold(struct sway_seat *seat,
|
||||||
seat->seatop_data = e;
|
seat->seatop_data = e;
|
||||||
|
|
||||||
container_raise_floating(con);
|
container_raise_floating(con);
|
||||||
|
wlr_seat_pointer_clear_focus(seat->wlr_seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void seatop_begin_move_tiling(struct sway_seat *seat,
|
void seatop_begin_move_tiling(struct sway_seat *seat,
|
||||||
|
|
|
@ -160,4 +160,5 @@ void seatop_begin_resize_floating(struct sway_seat *seat,
|
||||||
const char *image = edge == WLR_EDGE_NONE ?
|
const char *image = edge == WLR_EDGE_NONE ?
|
||||||
"se-resize" : wlr_xcursor_get_resize_name(edge);
|
"se-resize" : wlr_xcursor_get_resize_name(edge);
|
||||||
cursor_set_image(seat->cursor, image, NULL);
|
cursor_set_image(seat->cursor, image, NULL);
|
||||||
|
wlr_seat_pointer_clear_focus(seat->wlr_seat);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,4 +105,6 @@ void seatop_begin_resize_tiling(struct sway_seat *seat,
|
||||||
|
|
||||||
seat->seatop_impl = &seatop_impl;
|
seat->seatop_impl = &seatop_impl;
|
||||||
seat->seatop_data = e;
|
seat->seatop_data = e;
|
||||||
|
|
||||||
|
wlr_seat_pointer_clear_focus(seat->wlr_seat);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue