From 1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 2 May 2024 19:12:26 +1000 Subject: WIP merge cyclically dependent components into one big component --- src/input/include/input_hook.hpp | 75 ---------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/input/include/input_hook.hpp (limited to 'src/input/include/input_hook.hpp') diff --git a/src/input/include/input_hook.hpp b/src/input/include/input_hook.hpp deleted file mode 100644 index a8705210..00000000 --- a/src/input/include/input_hook.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2024 jacqueline - * - * SPDX-License-Identifier: GPL-3.0-only - */ - -#pragma once - -#include -#include -#include - -#include "hal/lv_hal_indev.h" -#include "lua.hpp" - -#include "input_trigger.hpp" - -namespace input { - -struct HookCallback { - std::string name; - std::function fn; -}; - -class Hook { - public: - Hook(std::string name, std::optional cb); - - auto invoke(lv_indev_data_t*) -> void; - auto override(std::optional) -> void; - - auto name() const -> const std::string& { return name_; } - auto callback() -> std::optional; - - // Not copyable or movable. - Hook(const Hook&) = delete; - Hook& operator=(const Hook&) = delete; - - private: - std::string name_; - std::optional default_; - std::optional override_; -}; - -class TriggerHooks { - public: - TriggerHooks(std::string name, std::optional cb) - : TriggerHooks(name, cb, cb, cb, cb) {} - TriggerHooks(std::string name, - std::optional click, - std::optional double_click, - std::optional long_press, - std::optional repeat); - - auto update(bool, lv_indev_data_t*) -> void; - auto override(Trigger::State, std::optional) -> void; - - auto name() const -> const std::string&; - auto hooks() -> std::vector>; - - // Not copyable or movable. - TriggerHooks(const TriggerHooks&) = delete; - TriggerHooks& operator=(const TriggerHooks&) = delete; - - private: - std::string name_; - Trigger trigger_; - - Hook click_; - Hook double_click_; - Hook long_press_; - Hook repeat_; -}; - -} // namespace input -- cgit v1.2.3