From 9264436f35e2c4e94adfdf2a8ea23a346ace3a65 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Fri, 5 Dec 2025 14:16:22 +0000 Subject: desktop: rewrite reserved area handling + improve tests (#12383) --- src/config/ConfigManager.hpp | 56 +++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 32 deletions(-) (limited to 'src/config/ConfigManager.hpp') diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 599ee8e7..a13547b5 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -18,6 +18,7 @@ #include "../SharedDefs.hpp" #include "../helpers/Color.hpp" #include "../desktop/DesktopTypes.hpp" +#include "../desktop/reserved/ReservedArea.hpp" #include "../helpers/memory/Memory.hpp" #include "../managers/XWaylandManager.hpp" #include "../managers/KeybindManager.hpp" @@ -48,13 +49,6 @@ struct SWorkspaceRule { std::map layoutopts; }; -struct SMonitorAdditionalReservedArea { - int top = 0; - int bottom = 0; - int left = 0; - int right = 0; -}; - struct SPluginKeyword { HANDLE handle = nullptr; std::string name = ""; @@ -185,7 +179,7 @@ class CMonitorRuleParser { void setDisabled(); void setMirror(const std::string& value); - bool setReserved(const SMonitorAdditionalReservedArea& value); + bool setReserved(const Desktop::CReservedArea& value); private: SMonitorRule m_rule; @@ -196,36 +190,34 @@ class CConfigManager { public: CConfigManager(); - void init(); - void reload(); - std::string verify(); - - int getDeviceInt(const std::string&, const std::string&, const std::string& fallback = ""); - float getDeviceFloat(const std::string&, const std::string&, const std::string& fallback = ""); - Vector2D getDeviceVec(const std::string&, const std::string&, const std::string& fallback = ""); - std::string getDeviceString(const std::string&, const std::string&, const std::string& fallback = ""); - bool deviceConfigExplicitlySet(const std::string&, const std::string&); - bool deviceConfigExists(const std::string&); - Hyprlang::CConfigValue* getConfigValueSafeDevice(const std::string& dev, const std::string& val, const std::string& fallback); + void init(); + void reload(); + std::string verify(); - void* const* getConfigValuePtr(const std::string&); - Hyprlang::CConfigValue* getHyprlangConfigValuePtr(const std::string& name, const std::string& specialCat = ""); - std::string getMainConfigPath(); - std::string getConfigString(); + int getDeviceInt(const std::string&, const std::string&, const std::string& fallback = ""); + float getDeviceFloat(const std::string&, const std::string&, const std::string& fallback = ""); + Vector2D getDeviceVec(const std::string&, const std::string&, const std::string& fallback = ""); + std::string getDeviceString(const std::string&, const std::string&, const std::string& fallback = ""); + bool deviceConfigExplicitlySet(const std::string&, const std::string&); + bool deviceConfigExists(const std::string&); + Hyprlang::CConfigValue* getConfigValueSafeDevice(const std::string& dev, const std::string& val, const std::string& fallback); - SMonitorRule getMonitorRuleFor(const PHLMONITOR); - SWorkspaceRule getWorkspaceRuleFor(PHLWORKSPACE workspace); - std::string getDefaultWorkspaceFor(const std::string&); + void* const* getConfigValuePtr(const std::string&); + Hyprlang::CConfigValue* getHyprlangConfigValuePtr(const std::string& name, const std::string& specialCat = ""); + std::string getMainConfigPath(); + std::string getConfigString(); - PHLMONITOR getBoundMonitorForWS(const std::string&); - std::string getBoundMonitorStringForWS(const std::string&); - const std::vector& getAllWorkspaceRules(); + SMonitorRule getMonitorRuleFor(const PHLMONITOR); + SWorkspaceRule getWorkspaceRuleFor(PHLWORKSPACE workspace); + std::string getDefaultWorkspaceFor(const std::string&); - void ensurePersistentWorkspacesPresent(); + PHLMONITOR getBoundMonitorForWS(const std::string&); + std::string getBoundMonitorStringForWS(const std::string&); + const std::vector& getAllWorkspaceRules(); - const std::vector& getAllDescriptions(); + void ensurePersistentWorkspacesPresent(); - std::unordered_map m_mAdditionalReservedAreas; + const std::vector& getAllDescriptions(); const std::unordered_map>& getAnimationConfig(); -- cgit v1.2.3