The previous "minimal fix" (
5148c2aa3140) worked but was a bit of a
hack, as it basically un-minimized and then immediately minimized the
view again at map. It's not actually too difficult to make the map
handlers aware of minimized views, eliminating the need for the hack.
Note: this depends on the previous commit ("xwayland: connect commit
and surface_destroy handlers together") otherwise the xwayland map
handler registers the commit handler twice, leading to a crash.
foreign_toplevel_create(struct view *view)
{
assert(view);
- assert(view->mapped);
struct foreign_toplevel *toplevel = znew(*toplevel);
wlr_foreign_toplevel_init(&toplevel->wlr_toplevel, view);
void
view_impl_map(struct view *view)
{
- desktop_focus_view(view, /*raise*/ true);
+ /* Leave minimized, if minimized before map */
+ if (!view->minimized) {
+ desktop_focus_view(view, /*raise*/ true);
+ }
if (!view->been_mapped) {
window_rules_apply(view, LAB_WINDOW_RULE_EVENT_ON_FIRST_MAP);
}
handle_map(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, mappable.map);
- if (view->minimized) {
- /*
- * The view->impl functions do not directly support
- * mapping a view while minimized. Instead, mark it as
- * not minimized, map it, and then minimize it again.
- */
- view->minimized = false;
- view->impl->map(view);
- view_minimize(view, true);
- } else {
- view->impl->map(view);
- }
+ view->impl->map(view);
}
static void
return;
}
- view->mapped = true;
-
/*
* An output should have been chosen when the surface was first
* created, but take one more opportunity to assign an output if not.
if (!view->output) {
view_set_output(view, output_nearest_to_cursor(view->server));
}
- struct wlr_xdg_surface *xdg_surface = xdg_surface_from_view(view);
- wlr_scene_node_set_enabled(&view->scene_tree->node, true);
+
+ /*
+ * For initially minimized views, we do not set view->mapped
+ * nor enable the scene node. All other map logic (positioning,
+ * creating foreign toplevel, etc.) happens as normal.
+ */
+ if (!view->minimized) {
+ view->mapped = true;
+ wlr_scene_node_set_enabled(&view->scene_tree->node, true);
+ }
if (!view->foreign_toplevel) {
init_foreign_toplevel(view);
* dimensions remain zero until handle_commit().
*/
if (wlr_box_empty(&view->pending)) {
+ struct wlr_xdg_surface *xdg_surface =
+ xdg_surface_from_view(view);
view->pending.width = xdg_surface->geometry.width;
view->pending.height = xdg_surface->geometry.height;
}
*/
handle_map_request(&xwayland_view->map_request, NULL);
- view->mapped = true;
- wlr_scene_node_set_enabled(&view->scene_tree->node, true);
+ /*
+ * For initially minimized views, we do not set view->mapped
+ * nor enable the scene node. All other map logic (positioning,
+ * creating foreign toplevel, etc.) happens as normal.
+ */
+ if (!view->minimized) {
+ view->mapped = true;
+ wlr_scene_node_set_enabled(&view->scene_tree->node, true);
+ }
if (view->surface != xwayland_surface->surface) {
set_surface(view, xwayland_surface->surface);