From 1d9d4d6398e989d0628cb4dab0273293b79b4816 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 23 Jan 2025 21:23:19 +0100 Subject: Make hotkeys reconfigurable, faster hotkey startup time, fix some keyboard locale issues --- include/Overlay.hpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'include/Overlay.hpp') diff --git a/include/Overlay.hpp b/include/Overlay.hpp index 2ccfb02..a4e75dc 100644 --- a/include/Overlay.hpp +++ b/include/Overlay.hpp @@ -6,6 +6,8 @@ #include "Config.hpp" #include "window_texture.h" #include "WindowUtils.hpp" +#include "GlobalHotkeysLinux.hpp" +#include "GlobalHotkeysJoystick.hpp" #include #include @@ -42,8 +44,7 @@ namespace gsr { Overlay& operator=(const Overlay&) = delete; ~Overlay(); - void handle_events(gsr::GlobalHotkeys *global_hotkeys); - void on_event(mgl::Event &event); + void handle_events(); // Returns false if not visible bool draw(); @@ -62,9 +63,12 @@ namespace gsr { const Config& get_config() const; - std::function on_keyboard_hotkey_changed; - std::function on_joystick_hotkey_changed; + void unbind_all_keyboard_hotkeys(); + void rebind_all_keyboard_hotkeys(); private: + void handle_keyboard_mapping_event(); + void on_event(mgl::Event &event); + void xi_setup(); void handle_xi_events(); void process_key_bindings(mgl::Event &event); @@ -176,5 +180,10 @@ namespace gsr { mgl::Clock show_overlay_clock; double show_overlay_timeout_seconds = 0.0; + + std::unique_ptr global_hotkeys = nullptr; + std::unique_ptr global_hotkeys_js = nullptr; + Display *x11_mapping_display = nullptr; + XEvent x11_mapping_xev; }; } \ No newline at end of file -- cgit v1.2.3