configurable click interval with click-repeat-interval

This commit is contained in:
Mitchell Hashimoto
2022-11-22 10:57:57 -08:00
parent cc4ba96970
commit 29b651ee46
2 changed files with 12 additions and 1 deletions

View File

@ -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,

View File

@ -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;
}
}
};