From 8bbeee11734d3ba8e2cf15d19cb3c302f8bfdbf2 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sat, 7 Dec 2024 18:51:18 +0100 Subject: core: Add clang-tidy (#8664) This adds a .clang-tidy file for us. It's not a strict requirement to be compliant, but I tuned it to be alright. --- src/config/ConfigManager.hpp | 98 ++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 48 deletions(-) (limited to 'src/config/ConfigManager.hpp') diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index a3b86e69..987884b5 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -69,13 +69,13 @@ struct SAnimationPropertyConfig { }; struct SPluginKeyword { - HANDLE handle = 0; + HANDLE handle = nullptr; std::string name = ""; Hyprlang::PCONFIGHANDLERFUNC fn = nullptr; }; struct SPluginVariable { - HANDLE handle = 0; + HANDLE handle = nullptr; std::string name = ""; }; @@ -84,7 +84,7 @@ struct SExecRequestedRule { uint64_t iPid = 0; }; -enum eConfigOptionType : uint16_t { +enum eConfigOptionType : uint8_t { CONFIG_OPTION_BOOL = 0, CONFIG_OPTION_INT = 1, /* e.g. 0/1/2*/ CONFIG_OPTION_FLOAT = 2, @@ -96,7 +96,7 @@ enum eConfigOptionType : uint16_t { CONFIG_OPTION_VECTOR = 8, }; -enum eConfigOptionFlags : uint32_t { +enum eConfigOptionFlags : uint8_t { CONFIG_OPTION_FLAG_PERCENTAGE = (1 << 0), }; @@ -214,52 +214,54 @@ class CConfigManager { std::string getErrors(); // keywords - std::optional handleRawExec(const std::string&, const std::string&); - std::optional handleExecOnce(const std::string&, const std::string&); - std::optional handleExecShutdown(const std::string&, const std::string&); - std::optional handleMonitor(const std::string&, const std::string&); - std::optional handleBind(const std::string&, const std::string&); - std::optional handleUnbind(const std::string&, const std::string&); - std::optional handleWindowRule(const std::string&, const std::string&); - std::optional handleLayerRule(const std::string&, const std::string&); - std::optional handleWindowRuleV2(const std::string&, const std::string&); - std::optional handleWorkspaceRules(const std::string&, const std::string&); - std::optional handleBezier(const std::string&, const std::string&); - std::optional handleAnimation(const std::string&, const std::string&); - std::optional handleSource(const std::string&, const std::string&); - std::optional handleSubmap(const std::string&, const std::string&); - std::optional handleBlurLS(const std::string&, const std::string&); - std::optional handleBindWS(const std::string&, const std::string&); - std::optional handleEnv(const std::string&, const std::string&); - std::optional handlePlugin(const std::string&, const std::string&); - - std::string configCurrentPath; - - std::unordered_map*(PHLWINDOW)>> mbWindowProperties = { - {"allowsinput", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.allowsInput; }}, - {"dimaround", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.dimAround; }}, - {"decorate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.decorate; }}, - {"focusonactivate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.focusOnActivate; }}, - {"keepaspectratio", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.keepAspectRatio; }}, - {"nearestneighbor", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.nearestNeighbor; }}, - {"noanim", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noAnim; }}, - {"noblur", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noBlur; }}, - {"noborder", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noBorder; }}, - {"nodim", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noDim; }}, - {"nofocus", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noFocus; }}, - {"nomaxsize", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noMaxSize; }}, - {"norounding", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noRounding; }}, - {"noshadow", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noShadow; }}, - {"noshortcutsinhibit", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noShortcutsInhibit; }}, - {"opaque", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.opaque; }}, - {"forcergbx", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.RGBX; }}, - {"syncfullscreen", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.syncFullscreen; }}, - {"immediate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.tearing; }}, - {"xray", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.xray; }}, + std::optional handleRawExec(const std::string&, const std::string&); + std::optional handleExecOnce(const std::string&, const std::string&); + std::optional handleExecShutdown(const std::string&, const std::string&); + std::optional handleMonitor(const std::string&, const std::string&); + std::optional handleBind(const std::string&, const std::string&); + std::optional handleUnbind(const std::string&, const std::string&); + std::optional handleWindowRule(const std::string&, const std::string&); + std::optional handleLayerRule(const std::string&, const std::string&); + std::optional handleWindowRuleV2(const std::string&, const std::string&); + std::optional handleWorkspaceRules(const std::string&, const std::string&); + std::optional handleBezier(const std::string&, const std::string&); + std::optional handleAnimation(const std::string&, const std::string&); + std::optional handleSource(const std::string&, const std::string&); + std::optional handleSubmap(const std::string&, const std::string&); + std::optional handleBlurLS(const std::string&, const std::string&); + std::optional handleBindWS(const std::string&, const std::string&); + std::optional handleEnv(const std::string&, const std::string&); + std::optional handlePlugin(const std::string&, const std::string&); + + std::string configCurrentPath; + + std::unordered_map*(const PHLWINDOW&)>> mbWindowProperties = { + {"allowsinput", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.allowsInput; }}, + {"dimaround", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.dimAround; }}, + {"decorate", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.decorate; }}, + {"focusonactivate", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.focusOnActivate; }}, + {"keepaspectratio", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.keepAspectRatio; }}, + {"nearestneighbor", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.nearestNeighbor; }}, + {"noanim", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noAnim; }}, + {"noblur", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noBlur; }}, + {"noborder", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noBorder; }}, + {"nodim", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noDim; }}, + {"nofocus", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noFocus; }}, + {"nomaxsize", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noMaxSize; }}, + {"norounding", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noRounding; }}, + {"noshadow", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noShadow; }}, + {"noshortcutsinhibit", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noShortcutsInhibit; }}, + {"opaque", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.opaque; }}, + {"forcergbx", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.RGBX; }}, + {"syncfullscreen", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.syncFullscreen; }}, + {"immediate", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.tearing; }}, + {"xray", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.xray; }}, }; - std::unordered_map*(PHLWINDOW)>> miWindowProperties = { - {"rounding", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.rounding; }}, {"bordersize", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.borderSize; }}}; + std::unordered_map*(const PHLWINDOW&)>> miWindowProperties = { + {"rounding", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.rounding; }}, + {"bordersize", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.borderSize; }}, + }; bool m_bWantsMonitorReload = false; bool m_bForceReload = false; -- cgit v1.2.3