keyboard: set repeat_info to config values on creation

This commit is contained in:
Isaac Freund 2020-12-26 19:17:24 +01:00
parent 760c88b094
commit 1732c69442
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
3 changed files with 15 additions and 3 deletions

View File

@ -81,6 +81,12 @@ view_opacity_delta: f32 = 1.0,
/// Time between view opacity transition steps in msec
view_opacity_delta_t: u31 = 20,
/// Keyboard repeat rate in characters per second
repeat_rate: u31 = 25,
/// Keyboard repeat delay in milliseconds
repeat_delay: u31 = 600,
pub fn init() !Self {
var self = Self{
.mode_to_id = std.StringHashMap(usize).init(util.gpa),

View File

@ -58,7 +58,9 @@ pub fn init(self: *Self, seat: *Seat, input_device: *wlr.InputDevice) !void {
const wlr_keyboard = self.input_device.device.keyboard;
if (!wlr_keyboard.setKeymap(keymap)) return error.SetKeymapFailed;
wlr_keyboard.setRepeatInfo(25, 600);
const config = &seat.input_manager.server.config;
wlr_keyboard.setRepeatInfo(config.repeat_rate, config.repeat_delay);
self.key.setNotify(handleKey);
wlr_keyboard.events.key.add(&self.key);

View File

@ -30,8 +30,12 @@ pub fn setRepeat(
if (args.len < 3) return Error.NotEnoughArguments;
if (args.len > 3) return Error.TooManyArguments;
const rate = try std.fmt.parseInt(i32, args[1], 10);
const delay = try std.fmt.parseInt(i32, args[2], 10);
const rate = try std.fmt.parseInt(u31, args[1], 10);
const delay = try std.fmt.parseInt(u31, args[2], 10);
const config = &seat.input_manager.server.config;
config.repeat_rate = rate;
config.repeat_delay = delay;
var it = seat.keyboards.first;
while (it) |node| : (it = node.next) {