Clear pointer focus during move and resize seatops

This commit is contained in:
Alex Maese 2019-04-19 16:13:49 -05:00 committed by Simon Ser
parent 812651d53e
commit 866a19b743
5 changed files with 10 additions and 12 deletions

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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,

View File

@ -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);
}

View File

@ -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);
}