From 4333d62eb722d753274d0ae31938da8c581edd18 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Mon, 4 Mar 2019 10:38:17 -0500 Subject: [PATCH] cursor: refocus floater before move/resize This refocuses floaters before moving or resizing them to close any popups or other surfaces that extend over the bounds of the container. This prevents artifacts from occurring. --- sway/input/cursor.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index b96fde889..93d8b43d4 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -728,6 +728,8 @@ void dispatch_cursor_button(struct sway_cursor *cursor, while (cont->parent) { cont = cont->parent; } + // refocus container to close anything that extends over the bounds + seat_set_focus_container(seat, NULL); seat_set_focus_container(seat, cont); seat_pointer_notify_button(seat, time_msec, button, state); seatop_begin_move_floating(seat, cont, button); @@ -740,6 +742,9 @@ void dispatch_cursor_button(struct sway_cursor *cursor, state == WLR_BUTTON_PRESSED) { // Via border if (button == BTN_LEFT && resize_edge != WLR_EDGE_NONE) { + // refocus container to close anything that extends over the bounds + seat_set_focus_container(seat, NULL); + seat_set_focus_container(seat, cont); seat_pointer_notify_button(seat, time_msec, button, state); seatop_begin_resize_floating(seat, cont, button, resize_edge); return; @@ -758,6 +763,9 @@ void dispatch_cursor_button(struct sway_cursor *cursor, WLR_EDGE_RIGHT : WLR_EDGE_LEFT; edge |= cursor->cursor->y > floater->y + floater->height / 2 ? WLR_EDGE_BOTTOM : WLR_EDGE_TOP; + // refocus container to close anything that extends over the bounds + seat_set_focus_container(seat, NULL); + seat_set_focus_container(seat, cont); seat_pointer_notify_button(seat, time_msec, button, state); seatop_begin_resize_floating(seat, floater, button, edge); return;