Replace tail call recursion in gui.zig with a standard while loop.

This brings us one tiny step closer to overlapping with the set of supported features of the x86 backend.
This commit is contained in:
IntegratedQuantum 2025-03-11 21:59:05 +01:00
parent 4bdf1240b8
commit 39fe3bd1a7

View File

@ -505,7 +505,9 @@ pub fn secondaryButtonReleased() void {
}
pub fn updateWindowPositions() void {
var wasChanged: bool = false;
var wasChanged: bool = true;
while(wasChanged) {
wasChanged = false;
for(windowList.items) |window| {
const oldPos = window.pos;
window.updateWindowPosition();
@ -514,7 +516,7 @@ pub fn updateWindowPositions() void {
wasChanged = true;
}
}
if(wasChanged) @call(.always_tail, updateWindowPositions, .{}); // Very efficient O(n²) algorithm :P
}
}
pub fn updateAndRenderGui() void {