mirror of
https://github.com/swaywm/sway.git
synced 2024-11-23 08:21:28 +00:00
Don't restore focus if unmapping surface wasn't focused
This commit is contained in:
parent
bcdb676abb
commit
1206a60977
|
@ -79,14 +79,17 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) {
|
||||||
wl_list_remove(&surface->commit.link);
|
wl_list_remove(&surface->commit.link);
|
||||||
|
|
||||||
if (!wlr_xwayland_surface_is_unmanaged(xsurface)) {
|
if (!wlr_xwayland_surface_is_unmanaged(xsurface)) {
|
||||||
// Restore focus
|
|
||||||
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||||
struct sway_container *previous =
|
if (seat->wlr_seat->keyboard_state.focused_surface ==
|
||||||
seat_get_focus_inactive(seat, &root_container);
|
xsurface->surface) {
|
||||||
if (previous) {
|
// Restore focus
|
||||||
// Hack to get seat to re-focus the return value of get_focus
|
struct sway_container *previous =
|
||||||
seat_set_focus(seat, previous->parent);
|
seat_get_focus_inactive(seat, &root_container);
|
||||||
seat_set_focus(seat, previous);
|
if (previous) {
|
||||||
|
// Hack to get seat to re-focus the return value of get_focus
|
||||||
|
seat_set_focus(seat, previous->parent);
|
||||||
|
seat_set_focus(seat, previous);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue