diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-02-21 21:30:39 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-21 21:30:39 +0000 |
| commit | 723870337f299d4c80aa0048144f3a1ca1c885bd (patch) | |
| tree | ca3279ae5dbc841f676c64d2f58f895de13cd3bf /src/layout/algorithm/ModeAlgorithm.hpp | |
| parent | 51f8849e541f0a8150ac3a43fa928c1e299daf18 (diff) | |
layout: rethonk layouts from the ground up (#12890)
Rewrites layouts to be much smaller, and deal with much less annoying
BS. Improves the overall architecture, unifies handling of pseudotiling,
and various other improvements.
Diffstat (limited to 'src/layout/algorithm/ModeAlgorithm.hpp')
| -rw-r--r-- | src/layout/algorithm/ModeAlgorithm.hpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/layout/algorithm/ModeAlgorithm.hpp b/src/layout/algorithm/ModeAlgorithm.hpp new file mode 100644 index 00000000..90d7ce58 --- /dev/null +++ b/src/layout/algorithm/ModeAlgorithm.hpp @@ -0,0 +1,54 @@ +#pragma once + +#include "../../helpers/math/Math.hpp" +#include "../../helpers/math/Direction.hpp" +#include "../../helpers/memory/Memory.hpp" + +#include "../LayoutManager.hpp" + +#include <expected> + +namespace Layout { + + class ITarget; + class CAlgorithm; + + class IModeAlgorithm { + public: + virtual ~IModeAlgorithm() = default; + + // a completely new target + virtual void newTarget(SP<ITarget> target) = 0; + + // a target moved into the algorithm (from another) + virtual void movedTarget(SP<ITarget> target, std::optional<Vector2D> focalPoint = std::nullopt) = 0; + + // a target removed + virtual void removeTarget(SP<ITarget> target) = 0; + + // a target is being resized by a delta. Corner none likely means not interactive + virtual void resizeTarget(const Vector2D& Δ, SP<ITarget> target, eRectCorner corner = CORNER_NONE) = 0; + + // recalculate layout + virtual void recalculate() = 0; + + // swap targets + virtual void swapTargets(SP<ITarget> a, SP<ITarget> b) = 0; + + // move a target in a given direction + virtual void moveTargetInDirection(SP<ITarget> t, Math::eDirection dir, bool silent) = 0; + + // optional: handle layout messages + virtual std::expected<void, std::string> layoutMsg(const std::string_view& sv); + + // optional: predict new window's size + virtual std::optional<Vector2D> predictSizeForNewTarget(); + + protected: + IModeAlgorithm() = default; + + WP<CAlgorithm> m_parent; + + friend class Layout::CAlgorithm; + }; +}
\ No newline at end of file |
