diff options
| author | Maximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com> | 2025-01-07 17:55:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-07 17:55:14 +0000 |
| commit | 5642ed331df56375c55cd8d56a14054af8bdf8f2 (patch) | |
| tree | 74a85b022b3319cdfad01343358eaf09a94841d1 /src/config/ConfigManager.hpp | |
| parent | c7086f936a06abebcc863c35f634760ca1ee90c0 (diff) | |
core: move parts of the animation system to hyprutils (#8868)
* core: change animation manager to use Hyprutils::Animation
* config: move animation config to hyprutils animation tree
* use g_pAnimationManager->createAnimation and the new PHLANIMVAR template
* core: use CGenericAnimatedVariabled::{enabled,setConfig,getStyle} and adapt callbacks
* core: adapt animated variable usage (dereference the shared pointer)
* misc: bump CMakeLists to hyprutils 0.3.3
Diffstat (limited to 'src/config/ConfigManager.hpp')
| -rw-r--r-- | src/config/ConfigManager.hpp | 87 |
1 files changed, 36 insertions, 51 deletions
diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 436362ae..53772401 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -1,5 +1,6 @@ #pragma once +#include <hyprutils/animation/AnimationConfig.hpp> #define CONFIG_MANAGER_H #include <map> @@ -23,9 +24,6 @@ #include <hyprlang.hpp> -#define INITANIMCFG(name) animationConfig[name] = {} -#define CREATEANIMCFG(name, parent) animationConfig[name] = {false, "", "", 0.f, -1, &animationConfig["global"], &animationConfig[parent]} - #define HANDLE void* struct SWorkspaceRule { @@ -54,18 +52,6 @@ struct SMonitorAdditionalReservedArea { int right = 0; }; -struct SAnimationPropertyConfig { - bool overridden = true; - - std::string internalBezier = ""; - std::string internalStyle = ""; - float internalSpeed = 0.f; - int internalEnabled = -1; - - SAnimationPropertyConfig* pValues = nullptr; - SAnimationPropertyConfig* pParentAnimation = nullptr; -}; - struct SPluginKeyword { HANDLE handle = nullptr; std::string name = ""; @@ -181,32 +167,32 @@ class CConfigManager { std::unordered_map<std::string, SMonitorAdditionalReservedArea> m_mAdditionalReservedAreas; - std::unordered_map<std::string, SAnimationPropertyConfig> getAnimationConfig(); + const std::unordered_map<std::string, SP<Hyprutils::Animation::SAnimationPropertyConfig>>& getAnimationConfig(); - void addPluginConfigVar(HANDLE handle, const std::string& name, const Hyprlang::CConfigValue& value); + void addPluginConfigVar(HANDLE handle, const std::string& name, const Hyprlang::CConfigValue& value); void addPluginKeyword(HANDLE handle, const std::string& name, Hyprlang::PCONFIGHANDLERFUNC fun, Hyprlang::SHandlerOptions opts = {}); void removePluginConfig(HANDLE handle); // no-op when done. - void dispatchExecOnce(); - void dispatchExecShutdown(); + void dispatchExecOnce(); + void dispatchExecShutdown(); - void performMonitorReload(); - void ensureMonitorStatus(); - void ensureVRR(PHLMONITOR pMonitor = nullptr); + void performMonitorReload(); + void ensureMonitorStatus(); + void ensureVRR(PHLMONITOR pMonitor = nullptr); - bool shouldUseSoftwareCursors(); + bool shouldUseSoftwareCursors(); - std::string parseKeyword(const std::string&, const std::string&); + std::string parseKeyword(const std::string&, const std::string&); - void addParseError(const std::string&); + void addParseError(const std::string&); - SAnimationPropertyConfig* getAnimationPropertyConfig(const std::string&); + SP<Hyprutils::Animation::SAnimationPropertyConfig> getAnimationPropertyConfig(const std::string&); - void addExecRule(const SExecRequestedRule&); + void addExecRule(const SExecRequestedRule&); - void handlePluginLoads(); - std::string getErrors(); + void handlePluginLoads(); + std::string getErrors(); // keywords std::optional<std::string> handleRawExec(const std::string&, const std::string&); @@ -269,39 +255,38 @@ class CConfigManager { bool isLaunchingExecOnce = false; // For exec-once to skip initial ws tracking private: - std::unique_ptr<Hyprlang::CConfig> m_pConfig; + std::unique_ptr<Hyprlang::CConfig> m_pConfig; - std::vector<std::string> configPaths; // stores all the config paths - std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times + std::vector<std::string> configPaths; // stores all the config paths + std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times - std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // stores all the animations with their set values + Hyprutils::Animation::CAnimationConfigTree m_AnimationTree; - std::string m_szCurrentSubmap = ""; // For storing the current keybind submap + std::string m_szCurrentSubmap = ""; // For storing the current keybind submap - std::vector<SExecRequestedRule> execRequestedRules; // rules requested with exec, e.g. [workspace 2] kitty + std::vector<SExecRequestedRule> execRequestedRules; // rules requested with exec, e.g. [workspace 2] kitty - std::vector<std::string> m_vDeclaredPlugins; - std::vector<SPluginKeyword> pluginKeywords; - std::vector<SPluginVariable> pluginVariables; + std::vector<std::string> m_vDeclaredPlugins; + std::vector<SPluginKeyword> pluginKeywords; + std::vector<SPluginVariable> pluginVariables; - bool isFirstLaunch = true; // For exec-once + bool isFirstLaunch = true; // For exec-once - std::vector<SMonitorRule> m_vMonitorRules; - std::vector<SWorkspaceRule> m_vWorkspaceRules; - std::vector<SP<CWindowRule>> m_vWindowRules; - std::vector<SP<CLayerRule>> m_vLayerRules; - std::vector<std::string> m_dBlurLSNamespaces; + std::vector<SMonitorRule> m_vMonitorRules; + std::vector<SWorkspaceRule> m_vWorkspaceRules; + std::vector<SP<CWindowRule>> m_vWindowRules; + std::vector<SP<CLayerRule>> m_vLayerRules; + std::vector<std::string> m_dBlurLSNamespaces; - bool firstExecDispatched = false; - bool m_bManualCrashInitiated = false; - std::vector<std::string> firstExecRequests; - std::vector<std::string> finalExecRequests; + bool firstExecDispatched = false; + bool m_bManualCrashInitiated = false; + std::vector<std::string> firstExecRequests; + std::vector<std::string> finalExecRequests; - std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins - std::string m_szConfigErrors = ""; + std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins + std::string m_szConfigErrors = ""; // internal methods - void setAnimForChildren(SAnimationPropertyConfig* const); void updateBlurredLS(const std::string&, const bool); void setDefaultAnimationVars(); std::optional<std::string> resetHLConfig(); |
