From b145d957e3809fd6c2d814c34c58234ade983bb0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 8 Sep 2024 17:07:22 +0200 Subject: More --- include/GlobalHotkeys.hpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 include/GlobalHotkeys.hpp (limited to 'include/GlobalHotkeys.hpp') diff --git a/include/GlobalHotkeys.hpp b/include/GlobalHotkeys.hpp new file mode 100644 index 0000000..020f5a5 --- /dev/null +++ b/include/GlobalHotkeys.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include +#include +#include + +namespace gsr { + struct Hotkey { + uint64_t key = 0; + uint32_t modifiers = 0; + }; + + using GlobalHotkeyCallback = std::function; + + class GlobalHotkeys { + public: + GlobalHotkeys() = default; + GlobalHotkeys(const GlobalHotkeys&) = delete; + GlobalHotkeys& operator=(const GlobalHotkeys&) = delete; + virtual ~GlobalHotkeys() = default; + + virtual bool bind_key_press(Hotkey hotkey, const std::string &id, GlobalHotkeyCallback callback) = 0; + virtual void unbind_key_press(const std::string &id) = 0; + virtual void unbind_all_keys() = 0; + virtual void poll_events() = 0; + }; +} \ No newline at end of file -- cgit v1.2.3