The unmap() handlers should only call desktop_focus_topmost_view() if
the unmapped view was the focused view. Unmapping a view that was not
focused should not change the focus.
I expect this rarely had any effect in practice; it would only matter in
a focus-follows-mouse config where some view other than the one on top
was focused. But it still seems better to fix.
Rather than repeating the logic in two places, create a small
view_impl_unmap() helper. Perhaps more common "unmap" logic could be
moved there in future.
void view_impl_move_to_back(struct view *view);
void view_impl_move_sub_views(struct view *parent, enum z_direction z_direction);
void view_impl_map(struct view *view);
+void view_impl_unmap(struct view *view);
/*
* Updates view geometry at commit based on current position/size,
view_get_string_prop(view, "title"));
}
+void
+view_impl_unmap(struct view *view)
+{
+ struct seat *seat = &view->server->seat;
+ if (seat->seat->keyboard_state.focused_surface == view->surface) {
+ desktop_focus_topmost_view(view->server);
+ }
+}
+
static bool
resizing_edge(struct view *view, uint32_t edge)
{
view->mapped = false;
wlr_scene_node_set_enabled(&view->scene_tree->node, false);
wl_list_remove(&view->commit.link);
- desktop_focus_topmost_view(view->server);
+ view_impl_unmap(view);
}
}
view->mapped = false;
wl_list_remove(&view->commit.link);
wlr_scene_node_set_enabled(&view->scene_tree->node, false);
- desktop_focus_topmost_view(view->server);
+ view_impl_unmap(view);
/*
* If the view was explicitly unmapped by the client (rather