diff --git a/src/core/context.zig b/src/core/context.zig index 3d9f0db..13ac459 100644 --- a/src/core/context.zig +++ b/src/core/context.zig @@ -97,6 +97,11 @@ pub const Context = struct { /// Dirty flags per panel (true = needs redraw) dirty_panels: std.StringHashMapUnmanaged(bool), + /// "Ghost Drawing" mode: when true, pushCommand does nothing. + /// Used to process widget input (via draw) without generating render commands. + /// Set by application for non-dirty panels to save CPU while keeping input working. + suppress_commands: bool = false, + /// Frame statistics stats: FrameStats, @@ -468,13 +473,17 @@ pub const Context = struct { } /// Push a draw command + /// If suppress_commands is true (Ghost Drawing mode), does nothing. pub fn pushCommand(self: *Self, cmd: Command.DrawCommand) void { + if (self.suppress_commands) return; self.commands.append(self.allocator, cmd) catch {}; } /// Push an overlay command (drawn AFTER all regular commands) /// Use this for dropdowns, tooltips, popups that need to appear on top + /// If suppress_commands is true (Ghost Drawing mode), does nothing. pub fn pushOverlayCommand(self: *Self, cmd: Command.DrawCommand) void { + if (self.suppress_commands) return; self.overlay_commands.append(self.allocator, cmd) catch {}; }