diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-04-29 12:42:16 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-04-29 12:42:16 +1000 |
| commit | b255ea799eead9668e7fd69a286349ac4a74a73c (patch) | |
| tree | 747e8038de0ff048ab253ac1d6f481df601e8449 /src/input/input_hook.cpp | |
| parent | 920345b940bb3993c389d9e9be1a75a8041d431d (diff) | |
| download | tangara-fw-b255ea799eead9668e7fd69a286349ac4a74a73c.tar.gz | |
Add lua bindings for override input hooks
Diffstat (limited to 'src/input/input_hook.cpp')
| -rw-r--r-- | src/input/input_hook.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
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<std::reference_wrapper<Hook>> { + return {click_, long_press_, repeat_}; } } // namespace input |
