From ffd6cf65e40a7140e82dc6e076c90b5119d41a54 Mon Sep 17 00:00:00 2001 From: MightyPlaza <123664421+MightyPlaza@users.noreply.github.com> Date: Tue, 15 Apr 2025 23:00:40 +0000 Subject: windowrules: allow incrementing window props (#9566) --- src/config/ConfigValue.cpp | 15 +++++++++++++++ src/config/ConfigValue.hpp | 16 ++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 src/config/ConfigValue.cpp (limited to 'src/config') diff --git a/src/config/ConfigValue.cpp b/src/config/ConfigValue.cpp new file mode 100644 index 00000000..9f6cc319 --- /dev/null +++ b/src/config/ConfigValue.cpp @@ -0,0 +1,15 @@ +#include "ConfigValue.hpp" +#include "ConfigManager.hpp" +#include "../macros.hpp" + +void local__configValuePopulate(void* const** p, const std::string& val) { + const auto PVHYPRLANG = g_pConfigManager->getHyprlangConfigValuePtr(val); + + *p = PVHYPRLANG->getDataStaticPtr(); +} + +std::type_index local__configValueTypeIdx(const std::string& val) { + const auto PVHYPRLANG = g_pConfigManager->getHyprlangConfigValuePtr(val); + const auto ANY = PVHYPRLANG->getValue(); + return std::type_index(ANY.type()); +} \ No newline at end of file diff --git a/src/config/ConfigValue.hpp b/src/config/ConfigValue.hpp index 089ae8bf..a159bf8c 100644 --- a/src/config/ConfigValue.hpp +++ b/src/config/ConfigValue.hpp @@ -4,21 +4,19 @@ #include #include #include "../macros.hpp" -#include "ConfigManager.hpp" + +// giga hack to avoid including configManager here +// NOLINTNEXTLINE +void local__configValuePopulate(void* const** p, const std::string& val); +std::type_index local__configValueTypeIdx(const std::string& val); template class CConfigValue { public: CConfigValue(const std::string& val) { - const auto PVHYPRLANG = g_pConfigManager->getHyprlangConfigValuePtr(val); - - // NOLINTNEXTLINE - p_ = PVHYPRLANG->getDataStaticPtr(); - #ifdef HYPRLAND_DEBUG // verify type - const auto ANY = PVHYPRLANG->getValue(); - const auto TYPE = std::type_index(ANY.type()); + const auto TYPE = local__configValueTypeIdx(val); // exceptions const bool STRINGEX = (typeid(T) == typeid(std::string) && TYPE == typeid(Hyprlang::STRING)); @@ -26,6 +24,8 @@ class CConfigValue { RASSERT(typeid(T) == TYPE || STRINGEX || CUSTOMEX, "Mismatched type in CConfigValue, got {} but has {}", typeid(T).name(), TYPE.name()); #endif + + local__configValuePopulate(&p_, val); } T* ptr() const { -- cgit v1.2.3