From 84bf37cd89f8a0dc41e8efdc04e93bbd787a4dcd Mon Sep 17 00:00:00 2001 From: "R.Eugenio" Date: Fri, 2 Jan 2026 11:32:42 +0100 Subject: [PATCH] feat(context): Ghost Drawing - suppress_commands flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nuevo flag para "Dibujo Fantasma": - suppress_commands: bool en Context - pushCommand() y pushOverlayCommand() retornan si está activo - Permite procesar input (draw) sin generar comandos (ahorra CPU) Solución de Gemini para immediate-mode + dirty panels 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/core/context.zig | 9 +++++++++ 1 file changed, 9 insertions(+) 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 {}; }