From 29b651ee462082c35559818e655c5fc337a58383 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 22 Nov 2022 10:57:57 -0800 Subject: [PATCH] configurable click interval with `click-repeat-interval` --- src/Window.zig | 2 +- src/config.zig | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Window.zig b/src/Window.zig index fe46cba66..70527741f 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -395,7 +395,7 @@ pub fn create(alloc: Allocator, app: *App, config: *const Config) !*Window { }, .renderer_thr = undefined, .mouse = .{}, - .mouse_interval = 500 * 1_000_000, // 500ms + .mouse_interval = config.@"click-repeat-interval" * 1_000_000, // 500ms .io = io, .io_thread = io_thread, .io_thr = undefined, diff --git a/src/config.zig b/src/config.zig index 6b40a0d85..633d328e4 100644 --- a/src/config.zig +++ b/src/config.zig @@ -147,6 +147,12 @@ pub const Config = struct { @"clipboard-read": bool = false, @"clipboard-write": bool = true, + /// The time in milliseconds between clicks to consider a click a repeat + /// (double, triple, etc.) or an entirely new single click. A value of + /// zero will use a platform-specific default. The default on macOS + /// is determined by the OS settings. On every other platform it is 500ms. + @"click-repeat-interval": u32 = 0, + /// Additional configuration files to read. @"config-file": RepeatableString = .{}, @@ -318,6 +324,11 @@ pub const Config = struct { // If we have the special value "inherit" then set it to null which // does the same. In the future we should change to a tagged union. if (std.mem.eql(u8, wd, "inherit")) self.@"working-directory" = null; + + // Default our click interval + if (self.@"click-repeat-interval" == 0) { + self.@"click-repeat-interval" = 500; + } } };