diff options
| author | vaxerski <vaxry@vaxry.net> | 2023-01-24 19:05:34 +0000 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2023-01-24 19:05:43 +0000 |
| commit | a2ae37396fd92482534579a5344c0a0594026a33 (patch) | |
| tree | 5068c72ed5849f86f462c2b86b75781b40791b90 /src/Window.hpp | |
| parent | eb9fa8460fb613bc701816e7087cc3667e43bb51 (diff) | |
add hyprctl setprop
Diffstat (limited to 'src/Window.hpp')
| -rw-r--r-- | src/Window.hpp | 107 |
1 files changed, 89 insertions, 18 deletions
diff --git a/src/Window.hpp b/src/Window.hpp index d729df2a..64cde495 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -15,14 +15,85 @@ enum eIdleInhibitMode { IDLEINHIBIT_FOCUS }; +template <typename T> +class CWindowOverridableVar { + public: + CWindowOverridableVar(T val) { + value = val; + } + + cCWindowOverridableVar<T> operator=(CWindowOverridableVar<T> other) { + if (locked) + return *this; + + locked = other.locked; + value = other.value; + + return *this; + } + + T operator=(T& other) { + if (locked) + return value; + value = other; + return other; + } + + void forceSetIgnoreLocked(T val, bool lock = false) { + value = val; + locked = lock; + } + + T operator*(T& other) { + return value * other; + } + + T operator+(T& other) { + return value + other; + } + + bool operator==(T& other) { + return other == value; + } + + bool operator>=(T& other) { + return value >= other; + } + + bool operator<=(T& other) { + return value <= other; + } + + bool operator>(T& other) { + return value > other; + } + + bool operator<(T& other) { + return value < other; + } + + explicit operator bool() { + return static_cast<bool>(value); + } + + T toUnderlying() { + return value; + } + + bool locked = false; + + private: + T value; +}; + struct SWindowSpecialRenderData { - bool alphaOverride = false; - float alpha = 1.f; - bool alphaInactiveOverride = false; - float alphaInactive = -1.f; // -1 means unset + CWindowOverridableVar<bool> alphaOverride = false; + CWindowOverridableVar<float> alpha = 1.f; + CWindowOverridableVar<bool> alphaInactiveOverride = false; + CWindowOverridableVar<float> alphaInactive = -1.f; // -1 means unset - int64_t activeBorderColor = -1; // -1 means unset - int64_t inactiveBorderColor = -1; // -1 means unset + CWindowOverridableVar<int64_t> activeBorderColor = -1; // -1 means unset + CWindowOverridableVar<int64_t> inactiveBorderColor = -1; // -1 means unset // set by the layout bool rounding = true; @@ -31,18 +102,18 @@ struct SWindowSpecialRenderData { }; struct SWindowAdditionalConfigData { - std::string animationStyle = ""; - int rounding = -1; // -1 means no - bool forceNoBlur = false; - bool forceOpaque = false; - bool forceOpaqueOverriden = false; // if true, a rule will not change the forceOpaque state. This is for the force opaque dispatcher. - bool forceAllowsInput = false; - bool forceNoAnims = false; - bool forceNoBorder = false; - bool forceNoShadow = false; - bool windowDanceCompat = false; - bool noMaxSize = false; - bool dimAround = false; + std::string animationStyle = std::string(""); + CWindowOverridableVar<int> rounding = -1; // -1 means no + CWindowOverridableVar<bool> forceNoBlur = false; + CWindowOverridableVar<bool> forceOpaque = false; + CWindowOverridableVar<bool> forceOpaqueOverriden = false; // if true, a rule will not change the forceOpaque state. This is for the force opaque dispatcher. + CWindowOverridableVar<bool> forceAllowsInput = false; + CWindowOverridableVar<bool> forceNoAnims = false; + CWindowOverridableVar<bool> forceNoBorder = false; + CWindowOverridableVar<bool> forceNoShadow = false; + CWindowOverridableVar<bool> windowDanceCompat = false; + CWindowOverridableVar<bool> noMaxSize = false; + CWindowOverridableVar<bool> dimAround = false; }; struct SWindowRule { |
