mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
add two new lua api functions to interact with repeat info
This commit is contained in:
parent
dafe3a72fe
commit
e4fa0c4521
1 changed files with 29 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ const wlr = @import("wlroots");
|
|||
|
||||
const Keymap = @import("../types/Keymap.zig");
|
||||
const Utils = @import("../Utils.zig");
|
||||
const LuaUtils = @import("LuaUtils.zig");
|
||||
|
||||
const server = &@import("../main.zig").server;
|
||||
|
||||
|
|
@ -81,3 +82,31 @@ pub fn del_keymap(L: *zlua.Lua) i32 {
|
|||
L.pushNil();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// ---Get the repeat information
|
||||
/// ---@return integer[2]
|
||||
pub fn get_repeat_info(L: *zlua.Lua) i32 {
|
||||
L.newTable();
|
||||
|
||||
L.pushInteger(server.seat.keyboard_group.keyboard.repeat_info.rate);
|
||||
L.setField(-2, "rate");
|
||||
L.pushInteger(server.seat.keyboard_group.keyboard.repeat_info.delay);
|
||||
L.setField(-2, "delay");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// ---Set the repeat information
|
||||
/// ---@param integer rate
|
||||
/// ---@param integer delay
|
||||
pub fn set_repeat_info(L: *zlua.Lua) i32 {
|
||||
const rate = LuaUtils.coerceInteger(i32, L.checkInteger(1)) catch {
|
||||
L.raiseErrorStr("The rate must be a valid number", .{});
|
||||
};
|
||||
const delay = LuaUtils.coerceInteger(i32, L.checkInteger(2)) catch {
|
||||
L.raiseErrorStr("The delay must be a valid number", .{});
|
||||
};
|
||||
|
||||
server.seat.keyboard_group.keyboard.setRepeatInfo(rate, delay);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue