keyboard: set repeat_info to config values on creation
This commit is contained in:
		@ -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),
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
@ -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) {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user