From 57921d7dbd1b87a9474f609cb9cd30e6174027cd Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 21 Dec 2024 19:21:45 +0000 Subject: windowrules: precompute regexes for window/layer rules --- src/desktop/LayerRule.cpp | 1 + src/desktop/LayerRule.hpp | 14 +++++++++++--- src/desktop/WindowRule.cpp | 1 + src/desktop/WindowRule.hpp | 13 +++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) (limited to 'src/desktop') diff --git a/src/desktop/LayerRule.cpp b/src/desktop/LayerRule.cpp index d82e4d30..23371947 100644 --- a/src/desktop/LayerRule.cpp +++ b/src/desktop/LayerRule.cpp @@ -1,6 +1,7 @@ #include "LayerRule.hpp" #include #include +#include #include "../debug/Log.hpp" static const auto RULES = std::unordered_set{"noanim", "blur", "blurpopups", "dimaround"}; diff --git a/src/desktop/LayerRule.hpp b/src/desktop/LayerRule.hpp index 7dca4621..117fa6fb 100644 --- a/src/desktop/LayerRule.hpp +++ b/src/desktop/LayerRule.hpp @@ -2,6 +2,12 @@ #include #include +#include + +//NOLINTNEXTLINE +namespace re2 { + class RE2; +}; class CLayerRule { public: @@ -21,8 +27,10 @@ class CLayerRule { RULE_ZUMBA, }; - eRuleType ruleType = RULE_INVALID; + eRuleType ruleType = RULE_INVALID; + + const std::string targetNamespace; + const std::string rule; - const std::string targetNamespace; - const std::string rule; + std::unique_ptr rTargetNamespaceRegex; }; \ No newline at end of file diff --git a/src/desktop/WindowRule.cpp b/src/desktop/WindowRule.cpp index 4f2d949e..7db6c3db 100644 --- a/src/desktop/WindowRule.cpp +++ b/src/desktop/WindowRule.cpp @@ -1,6 +1,7 @@ #include "WindowRule.hpp" #include #include +#include #include "../config/ConfigManager.hpp" static const auto RULES = std::unordered_set{ diff --git a/src/desktop/WindowRule.hpp b/src/desktop/WindowRule.hpp index 6faf8b5a..3ce31179 100644 --- a/src/desktop/WindowRule.hpp +++ b/src/desktop/WindowRule.hpp @@ -2,6 +2,12 @@ #include #include +#include + +//NOLINTNEXTLINE +namespace re2 { + class RE2; +}; class CWindowRule { public: @@ -57,4 +63,11 @@ class CWindowRule { std::string szFullscreenState = ""; // empty means any std::string szOnWorkspace = ""; // empty means any std::string szWorkspace = ""; // empty means any + + // precompiled regexes + std::unique_ptr rTitle; + std::unique_ptr rClass; + std::unique_ptr rInitialTitle; + std::unique_ptr rInitialClass; + std::unique_ptr rV1Regex; }; \ No newline at end of file -- cgit v1.2.3