mirror of
https://github.com/swaywm/sway.git
synced 2026-06-13 14:33:19 -04:00
tree/load_layout: give placeholder leaves L_HORIZ layout
A placeholder leaf has view==NULL, so arrange_container routes it
to its view-less branch, which calls arrange_children with the
container's layout. arrange_children asserts on L_NONE, so a
plain { swallows: [...] } JSON entry crashed assert-enabled
builds before any window could match.
Default the layout to L_HORIZ when JSON does not specify one.
The placeholder has no children, so the iteration short-circuits
without rendering anything until promoted.
This commit is contained in:
parent
d882281cde
commit
6382fe1469
1 changed files with 5 additions and 3 deletions
|
|
@ -386,10 +386,12 @@ static struct sway_container *build_node(struct json_object *obj,
|
|||
c->swallows = sw;
|
||||
// Retained so IPC can echo it verbatim for round-trip.
|
||||
c->swallows_json = json_object_get(swallows_v);
|
||||
// arrange_children asserts on L_NONE; placeholders end up there
|
||||
// via the view-less branch even with no children.
|
||||
if (c->pending.layout == L_NONE) {
|
||||
c->pending.layout = L_HORIZ;
|
||||
}
|
||||
} else {
|
||||
// Leaf without swallows is an empty split with no children. i3 does
|
||||
// not produce these; treat as an error to avoid silently leaving
|
||||
// orphaned containers.
|
||||
*error_out = format_str("append_layout: node has neither nodes nor "
|
||||
"swallows");
|
||||
free_transient_subtree(c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue