From b255ea799eead9668e7fd69a286349ac4a74a73c Mon Sep 17 00:00:00 2001 From: jacqueline Date: Mon, 29 Apr 2024 12:42:16 +1000 Subject: Add lua bindings for override input hooks --- src/input/input_hook.cpp | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'src/input/input_hook.cpp') diff --git a/src/input/input_hook.cpp b/src/input/input_hook.cpp index 1bb92196..48d6c2a4 100644 --- a/src/input/input_hook.cpp +++ b/src/input/input_hook.cpp @@ -85,23 +85,8 @@ auto TriggerHooks::name() const -> const std::string& { return name_; } -auto TriggerHooks::pushHooks(lua_State* L) -> void { - lua_newtable(L); - - auto add_trigger = [&](Hook& h) { - lua_pushlstring(L, h.name().data(), h.name().size()); - auto cb = h.callback(); - if (cb) { - lua_pushlstring(L, cb->name.data(), cb->name.size()); - } else { - lua_pushnil(L); - } - lua_rawset(L, -3); - }; - - add_trigger(click_); - add_trigger(long_press_); - add_trigger(repeat_); +auto TriggerHooks::hooks() -> std::vector> { + return {click_, long_press_, repeat_}; } } // namespace input -- cgit v1.2.3