diff --git a/include/openspace/util/keys.h b/include/openspace/util/keys.h index 9490b37732..10317f4180 100644 --- a/include/openspace/util/keys.h +++ b/include/openspace/util/keys.h @@ -68,6 +68,8 @@ enum class KeyAction : int { Repeat = 2 }; +bool hasKeyAction(KeyAction lhs, KeyAction rhs); + KeyAction operator|(KeyAction lhs, KeyAction rhs); KeyAction operator|=(KeyAction& lhs, KeyAction rhs); @@ -79,6 +81,8 @@ enum class KeyModifier : int { Super = 0x0008 }; +bool hasKeyModifier(KeyModifier lhs, KeyModifier rhs); + KeyModifier operator|(KeyModifier lhs, KeyModifier rhs); KeyModifier operator|=(KeyModifier& lhs, KeyModifier rhs); diff --git a/src/util/keys.cpp b/src/util/keys.cpp index 2384f503cb..71637f0a10 100644 --- a/src/util/keys.cpp +++ b/src/util/keys.cpp @@ -36,6 +36,12 @@ namespace { namespace openspace { +bool hasKeyModifier(KeyAction lhs, KeyAction rhs) { + return + static_cast>(lhs) & + static_cast>(rhs); +} + KeyAction operator|(KeyAction lhs, KeyAction rhs) { return static_cast( static_cast>(lhs) | @@ -48,6 +54,13 @@ KeyAction operator|=(KeyAction& lhs, KeyAction rhs) { return lhs; } +bool hasKeyModifier(KeyModifier lhs, KeyModifier rhs) { + return + static_cast>(lhs) & + static_cast>(rhs); +} + + KeyModifier operator|(KeyModifier lhs, KeyModifier rhs) { return static_cast( static_cast>(lhs) |