aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/libghostty-vt/src/os/mouse.zig
diff options
context:
space:
mode:
authorsl0p <sl0p@sl0p.foo>2026-08-13 22:00:03 +0200
committersl0p <sl0p@sl0p.foo>2026-08-13 22:00:03 +0200
commit2c1b855c3cf8cf8841bf25cd939e478a7f0bfac8 (patch)
tree7cd6274303ba1da1f8bd57371aec336dd687fb58 /vendor/libghostty-vt/src/os/mouse.zig
downloadslosh-2c1b855c3cf8cf8841bf25cd939e478a7f0bfac8.tar.gz
slosh-2c1b855c3cf8cf8841bf25cd939e478a7f0bfac8.tar.xz
slosh-2c1b855c3cf8cf8841bf25cd939e478a7f0bfac8.zip
sl0ptty: M0 — libghostty-vt vendored, one pane, compositor, diff renderer
Design contract in DESIGN.md. libghostty-vt vendored fresh from ghostty main@bedb6f2 (zig 0.16), built to a 14MB static lib. M0: pty spawn (no libutil), a lib-vt terminal per pane, a screen cell buffer, a diff emitter that repaints only what changed, raw mode, SIGWINCH, and a ~120Hz frame cap that coalesces pty reads. Also the seed of the headless harness: --headless dumps the composited screen without a tty, so composition is testable in milliseconds. tests/live_m0.py covers what headless cannot: raw mode, the diff emitter, resize propagation, and the quit path. 6/6 green.
Diffstat (limited to 'vendor/libghostty-vt/src/os/mouse.zig')
-rw-r--r--vendor/libghostty-vt/src/os/mouse.zig25
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/os/mouse.zig b/vendor/libghostty-vt/src/os/mouse.zig
new file mode 100644
index 0000000..d68bb22
--- /dev/null
+++ b/vendor/libghostty-vt/src/os/mouse.zig
@@ -0,0 +1,25 @@
+const std = @import("std");
+const builtin = @import("builtin");
+const objc = @import("objc");
+
+const log = std.log.scoped(.os);
+
+/// The system-configured double-click interval if its available.
+pub fn clickInterval() ?u32 {
+ return switch (builtin.os.tag) {
+ // On macOS, we can ask the system.
+ .macos => macos: {
+ const NSEvent = objc.getClass("NSEvent") orelse {
+ log.err("NSEvent class not found. Can't get click interval.", .{});
+ return null;
+ };
+
+ // Get the interval and convert to ms
+ const interval = NSEvent.msgSend(f64, objc.sel("doubleClickInterval"), .{});
+ const ms = @as(u32, @intFromFloat(@ceil(interval * 1000)));
+ break :macos ms;
+ },
+
+ else => null,
+ };
+}