Root: simplify scene tree reparenting
Making these reparent() calls unconditional avoids inconsistent state. It's also simpler and less error-prone and the wlroots function returns immediately if the parent doesn't change anyways.
This commit is contained in:
parent
f5d37f9b4d
commit
db7de8151c
@ -673,24 +673,12 @@ fn commitTransaction(root: *Root) void {
|
|||||||
while (focus_stack_it.next()) |view| {
|
while (focus_stack_it.next()) |view| {
|
||||||
assert(view.inflight.output == output);
|
assert(view.inflight.output == output);
|
||||||
|
|
||||||
if (view.current.output != view.inflight.output or
|
|
||||||
(output.current.fullscreen == view and output.inflight.fullscreen != view))
|
|
||||||
{
|
|
||||||
if (view.inflight.float) {
|
if (view.inflight.float) {
|
||||||
view.tree.node.reparent(output.layers.float);
|
view.tree.node.reparent(output.layers.float);
|
||||||
} else {
|
} else {
|
||||||
view.tree.node.reparent(output.layers.layout);
|
view.tree.node.reparent(output.layers.layout);
|
||||||
}
|
}
|
||||||
view.popup_tree.node.reparent(output.layers.popups);
|
view.popup_tree.node.reparent(output.layers.popups);
|
||||||
}
|
|
||||||
|
|
||||||
if (view.current.float != view.inflight.float) {
|
|
||||||
if (view.inflight.float) {
|
|
||||||
view.tree.node.reparent(output.layers.float);
|
|
||||||
} else {
|
|
||||||
view.tree.node.reparent(output.layers.layout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
view.commitTransaction();
|
view.commitTransaction();
|
||||||
|
|
||||||
@ -703,7 +691,6 @@ fn commitTransaction(root: *Root) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output.inflight.fullscreen != output.current.fullscreen) {
|
|
||||||
if (output.inflight.fullscreen) |view| {
|
if (output.inflight.fullscreen) |view| {
|
||||||
assert(view.inflight.output == output);
|
assert(view.inflight.output == output);
|
||||||
assert(view.current.output == output);
|
assert(view.current.output == output);
|
||||||
@ -711,7 +698,6 @@ fn commitTransaction(root: *Root) void {
|
|||||||
}
|
}
|
||||||
output.current.fullscreen = output.inflight.fullscreen;
|
output.current.fullscreen = output.inflight.fullscreen;
|
||||||
output.layers.fullscreen.node.setEnabled(output.current.fullscreen != null);
|
output.layers.fullscreen.node.setEnabled(output.current.fullscreen != null);
|
||||||
}
|
|
||||||
|
|
||||||
output.status.handleTransactionCommit(output);
|
output.status.handleTransactionCommit(output);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user