Make window rules frame perfect

This moves window initialization earlier in the manage sequence.
Previously, it was on the Window's first manage() call, but this is
after the layout has already been calculated, which matters both because
of tags and whether the window starts floating or not.

Now, initialization is handled in a separate function that gets called
in Output.calculatePrimaryStackLayout() instead.
This commit is contained in:
Ben Buhse 2026-02-17 16:51:57 -06:00
commit c4da4ef30a
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4
3 changed files with 30 additions and 20 deletions

View file

@ -617,6 +617,9 @@ fn calculatePrimaryStackLayout(output: *Output) void {
var active_count: u31 = 0;
var it = output.windows.iterator(.forward);
while (it.next()) |window| {
// Initialize new windows before checking tags/float so that
// window rules are reflected in the first frame's layout.
window.initialize();
if (output.tags & window.tags != 0x0000) {
// Floating windows should be shown but not included in this layout generation
const will_float = window.pending_manage.floating orelse window.floating;