diff options
| author | Gabriel Schneider <[email protected]> | 2026-07-04 00:57:06 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-01 15:02:07 -0300 |
| commit | e36e946f9a56c4ab1d10cef3aace20fe7d274dfa (patch) | |
| tree | baccd0be04b9b901bb74b4f3647bdb531c8dd450 /main.zig | |
| parent | f3f0e27372d8cf111269dde674d4581cf4cb0c41 (diff) | |
| download | pardes-e36e946f9a56c4ab1d10cef3aace20fe7d274dfa.tar.gz pardes-e36e946f9a56c4ab1d10cef3aace20fe7d274dfa.zip | |
touch debug overlay: multi-touch circles with trails, finger event handling, 4x larger, fade trails, SDL GPU + WebGL overlay shaders, touch-action:none in HTML, --debug-overlay flag, pinch event dispatch for all SDL backends
Diffstat (limited to 'main.zig')
| -rw-r--r-- | main.zig | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -150,6 +150,7 @@ pub const Command = struct { winsize: vaxis.Winsize, mouse: vaxis.Mouse, paste: []const u8, // OSC 52 system-clipboard read reply (the loop decodes it) + pinch: f32, } = .nop; }; @@ -176,6 +177,7 @@ const Cli = struct { tty_toggle: u21 = default_tty_toggle, help: bool = false, perf_startup: bool = false, + debug_overlay: bool = false, }; const help_text = @@ -185,8 +187,9 @@ const help_text = \\ --tty start as one shell pane already in tty mode \\ --tty-toggle <key> use Ctrl-<key> to enter/leave tty mode \\ --tty-toggle=<key> same as above; accepts b, Ctrl-b, or ^b + \\ --debug-overlay start with debug overlay visible \\ -h, --help show this help and exit - \\ + \\\; ; fn printHelp(io: std.Io) !void { @@ -225,6 +228,8 @@ fn parseCli(args: []const [:0]const u8) !Cli { i += 1; if (i >= args.len) return error.BadArgs; cli.tty_toggle = parseCtrlKey(args[i]) orelse return error.BadArgs; + } else if (std.mem.eql(u8, a, "--debug-overlay")) { + cli.debug_overlay = true; } else { return error.BadArgs; } @@ -305,6 +310,7 @@ var colors_on: bool = true; // The stats overlay, toggled by the "Debug" builtin. Global (like colors_on) so the // central command dispatcher can flip it; the render reads it. var show_debug: bool = false; +var ov_pinch_scale: f32 = 1.0; // Builtins. Executing the name (middle-click / Tab) runs the action through the ONE // dispatcher (onSelect + actOnSelection), no matter where the name is shown — a pane @@ -2804,6 +2810,7 @@ pub fn main(init: std.process.Init) !void { const tty_only = cli.tty_only; const tty_toggle = cli.tty_toggle; const perf_startup = cli.perf_startup; + if (cli.debug_overlay) show_debug = true; var screen_w: u16 = 80; var screen_h: u16 = 24; @@ -2830,7 +2837,7 @@ pub fn main(init: std.process.Init) !void { var frame_arena: std.heap.ArenaAllocator = .init(gpa); defer frame_arena.deinit(); defer freeYank(gpa); - var ov_buf: [128]u8 = undefined; // overlay text; must outlive each vx.render() + var ov_buf: [192]u8 = undefined; // overlay text; must outlive each vx.render() // system_clipboard_allocator lets the loop's reader thread decode OSC 52 paste // replies (delivered as .paste events). gpa is already used cross-thread by the @@ -3383,6 +3390,9 @@ pub fn main(init: std.process.Init) !void { normalPaste(gpa, t); } }, + .pinch => |scale| { + ov_pinch_scale = scale; + }, .quit => break, else => {}, } @@ -3567,12 +3577,12 @@ pub fn main(init: std.process.Init) !void { sb_total = sb.total; } const s = std.fmt.bufPrint( - &ov_buf, - "pardes resizes={d}\nterms {d} cols {d}\nactive #{d} {d}x{d}\nscroll {d}/{d}", - .{ resize_count, nlive, layout.ncol, active, at.cols, at.rows, sb_off, sb_total }, - ) catch ""; - const ow: u16 = 26; - const oh: u16 = 6; + &ov_buf, + "pardes resizes={d}\nterms {d} cols {d}\nactive #{d} {d}x{d}\nscroll {d}/{d}\npinch {d:6.4}", + .{ resize_count, nlive, layout.ncol, active, at.cols, at.rows, sb_off, sb_total, ov_pinch_scale }, + ) catch ""; + const ow: u16 = 30; + const oh: u16 = 7; const ox: u16 = if (screen_w > ow) screen_w - ow else 0; const ov = win.child(.{ .x_off = ox, .y_off = TOPBAR_H, .width = ow, .height = oh, .border = .{ .where = .all } }); ov.fill(.{ .char = .{ .grapheme = " " }, .style = .{ .bg = .{ .rgb = gray.bar } } }); |
