input/seat: fix drag-and-drop regression and improve popup dismissal

This commit is contained in:
Furkan Sahin 2026-04-17 18:10:35 -04:00 committed by Simon Ser
parent 136765a530
commit 9a5f09c867

View file

@ -1071,6 +1071,7 @@ bool seat_is_input_allowed(struct sway_seat *seat,
static void send_unfocus(struct sway_container *con, void *data) { static void send_unfocus(struct sway_container *con, void *data) {
if (con->view) { if (con->view) {
view_close_popups(con->view);
view_set_activated(con->view, false); view_set_activated(con->view, false);
} }
} }
@ -1079,7 +1080,6 @@ static void send_unfocus(struct sway_container *con, void *data) {
static void seat_send_unfocus(struct sway_node *node, struct sway_seat *seat) { static void seat_send_unfocus(struct sway_node *node, struct sway_seat *seat) {
sway_cursor_constrain(seat->cursor, NULL); sway_cursor_constrain(seat->cursor, NULL);
wlr_seat_keyboard_notify_clear_focus(seat->wlr_seat); wlr_seat_keyboard_notify_clear_focus(seat->wlr_seat);
wlr_seat_keyboard_end_grab(seat->wlr_seat);
if (node->type == N_WORKSPACE) { if (node->type == N_WORKSPACE) {
workspace_for_each_container(node->sway_workspace, send_unfocus, seat); workspace_for_each_container(node->sway_workspace, send_unfocus, seat);
} else { } else {
@ -1136,10 +1136,6 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n
struct sway_workspace *last_workspace = seat_get_focused_workspace(seat); struct sway_workspace *last_workspace = seat_get_focused_workspace(seat);
if (node == NULL) { if (node == NULL) {
// Close any popups on the old focus
if (node_is_view(last_focus)) {
view_close_popups(last_focus->sway_container->view);
}
seat_send_unfocus(last_focus, seat); seat_send_unfocus(last_focus, seat);
sway_input_method_relay_set_focus(&seat->im_relay, NULL); sway_input_method_relay_set_focus(&seat->im_relay, NULL);
seat->has_focus = false; seat->has_focus = false;
@ -1228,11 +1224,6 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n
} }
} }
// Close any popups on the old focus
if (last_focus && node_is_view(last_focus)) {
view_close_popups(last_focus->sway_container->view);
}
// If urgent, either unset the urgency or start a timer to unset it // If urgent, either unset the urgency or start a timer to unset it
if (container && container->view && view_is_urgent(container->view) && if (container && container->view && view_is_urgent(container->view) &&
!container->view->urgent_timer) { !container->view->urgent_timer) {