optimize out double rendering
This commit is contained in:
+5
-13
@@ -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.
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -505,6 +505,12 @@ fn updateDefaultLayerOutput(self: *Wm) void {
|
||||
self.default_layer_output = out;
|
||||
}
|
||||
|
||||
/// Ask river for a manage sequence.
|
||||
///
|
||||
/// Only needed for state changes river cannot see for itself: key bindings,
|
||||
/// pointer gestures and IPC commands. River already follows every batch of
|
||||
/// state events it sends us with a manage_start of its own, so calling this
|
||||
/// from an event handler asks for a second, redundant sequence.
|
||||
pub fn needsManage(self: *Wm) void {
|
||||
if (self.manage_requested) return;
|
||||
self.manage_requested = true;
|
||||
|
||||
Reference in New Issue
Block a user