From f885ae67f13ab26dcc47d3fa9cc31ee2fea58c50 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 30 Nov 2024 21:52:07 +0100 Subject: Re-add escape button to go back to the previous page/close --- include/Overlay.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/Overlay.hpp b/include/Overlay.hpp index 4376893..e6b65e3 100644 --- a/include/Overlay.hpp +++ b/include/Overlay.hpp @@ -14,6 +14,8 @@ #include #include +#include + namespace gsr { class DropdownButton; @@ -56,6 +58,7 @@ namespace gsr { private: void xi_setup(); void handle_xi_events(); + void process_key_bindings(mgl::Event &event); void xi_setup_fake_cursor(); void xi_grab_all_devices(); void xi_warp_pointer(mgl::vec2i position); @@ -93,6 +96,12 @@ namespace gsr { void force_window_on_top(); private: + using KeyBindingCallback = std::function; + struct KeyBinding { + mgl::Event::KeyEvent key_event; + KeyBindingCallback callback; + }; + std::unique_ptr window; mgl::Event event; std::string resources_path; @@ -147,5 +156,7 @@ namespace gsr { int xi_opcode = 0; XEvent *xi_input_xev = nullptr; XEvent *xi_output_xev = nullptr; + + std::array key_bindings; }; } \ No newline at end of file -- cgit v1.2.3