optimize out double rendering

This commit is contained in:
2026-08-29 15:49:02 +02:00
parent 1fff449547
commit 5b41cad647
2 changed files with 11 additions and 13 deletions
+5 -13
View File
@@ -174,15 +174,6 @@ pub fn applyRules(self: *Window) void {
}
}
/// Whether this window currently has a tab drawn for it, i.e. it is tiled and
/// visible on an output that is showing the tabbed layout.
fn onTabBar(self: *Window) bool {
if (config.tabbar_height <= 0) return false;
if (!self.visible or self.floating or self.fullscreen or self.closed) return false;
const out = self.output orelse return false;
return out.state().layout == .tabbed;
}
/// Replace an owned string field, returning whether the value actually
/// changed. Clients re-send strings that have not moved — a terminal animating
/// a spinner in its title re-sets the same text several times a second — and
@@ -253,10 +244,11 @@ fn onEvent(_: *river.WindowV1, event: river.WindowV1.Event, self: *Window) void
if (self.setString(&self.title, ev.title)) {
self.applyRules();
self.wm.ipcDirty();
// The tab bar has this title painted into it, so a window that
// is wearing a tab needs the strip redrawn. Terminals retitle
// themselves constantly, so ask only when it will show.
if (self.onTabBar()) self.wm.needsManage();
// No needsManage: river sent this event, so it already knows
// the title moved and starts a manage sequence of its own.
// Asking for one here bought a second, identical manage and
// render pass for every retitle — and terminals retitle
// themselves constantly.
}
},