This commit is contained in:
dec05eba
2024-09-08 17:07:22 +02:00
parent 3d5e8baa5f
commit b145d957e3
29 changed files with 1141 additions and 687 deletions

27
include/GlobalHotkeys.hpp Normal file
View File

@@ -0,0 +1,27 @@
#pragma once
#include <stdint.h>
#include <functional>
#include <string>
namespace gsr {
struct Hotkey {
uint64_t key = 0;
uint32_t modifiers = 0;
};
using GlobalHotkeyCallback = std::function<void(const std::string &id)>;
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;
};
}