From 627be8149bece18caa9f22f84e6c1c75de8f9003 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 21 Jan 2025 19:45:50 +0100 Subject: Add mapping notify event --- depends/mgl | 2 +- include/mglpp/window/Event.hpp | 12 ++++++++++++ include/mglpp/window/Keyboard.hpp | 1 + src/window/Keyboard.cpp | 5 +++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/depends/mgl b/depends/mgl index 66e7cea..2580087 160000 --- a/depends/mgl +++ b/depends/mgl @@ -1 +1 @@ -Subproject commit 66e7ceaa96de5c2acdea89b33773219ec0bb2c27 +Subproject commit 2580087ef23fe21ae4dbed45fb8cfa14fbfd7b9f diff --git a/include/mglpp/window/Event.hpp b/include/mglpp/window/Event.hpp index bcd1e91..a013289 100644 --- a/include/mglpp/window/Event.hpp +++ b/include/mglpp/window/Event.hpp @@ -63,6 +63,16 @@ namespace mgl { int id; }; + enum class MappingNotifyType { + MODIFIER, + KEYBOARD, + POINTER + }; + + struct MappingNotifyEvent { + int notify_type; // MappingNotifyType + }; + enum Type : int { Unknown, Closed, /* Window closed */ @@ -79,6 +89,7 @@ namespace mgl { MonitorConnected, MonitorDisconnected, MonitorPropertyChanged, + MappingNotify }; Type type; @@ -93,6 +104,7 @@ namespace mgl { MonitorConnectedEvent monitor_connected; MonitorDisconnectedEvent monitor_disconnected; MonitorPropertyChangedEvent monitor_property_changed; + MappingNotifyEvent mapping_notify; }; }; } diff --git a/include/mglpp/window/Keyboard.hpp b/include/mglpp/window/Keyboard.hpp index df2db20..a7eb36e 100644 --- a/include/mglpp/window/Keyboard.hpp +++ b/include/mglpp/window/Keyboard.hpp @@ -115,6 +115,7 @@ namespace mgl { /* Returns nullptr if unknown key */ static const char* key_to_string(Key key); + static bool key_is_modifier(Key key); }; } diff --git a/src/window/Keyboard.cpp b/src/window/Keyboard.cpp index bd031db..f60e5cd 100644 --- a/src/window/Keyboard.cpp +++ b/src/window/Keyboard.cpp @@ -9,4 +9,9 @@ namespace mgl { const char* Keyboard::key_to_string(Key key) { return mgl_key_to_string((mgl_key)key); } + + // static + bool Keyboard::key_is_modifier(Key key) { + return mgl_key_is_modifier((mgl_key)key); + } } \ No newline at end of file -- cgit v1.2.3