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/tiled/monocle/MonocleAlgorithm.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/tiled/monocle/MonocleAlgorithm.hpp')
| -rw-r--r-- | src/layout/algorithm/tiled/monocle/MonocleAlgorithm.hpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.hpp b/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.hpp new file mode 100644 index 00000000..e409b885 --- /dev/null +++ b/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.hpp @@ -0,0 +1,52 @@ +#pragma once + +#include "../../TiledAlgorithm.hpp" +#include "../../../../managers/HookSystemManager.hpp" + +#include <vector> + +namespace Layout::Tiled { + + struct SMonocleTargetData { + SMonocleTargetData(SP<ITarget> t) : target(t) { + ; + } + + WP<ITarget> target; + CBox layoutBox; + }; + + class CMonocleAlgorithm : public ITiledAlgorithm { + public: + CMonocleAlgorithm(); + virtual ~CMonocleAlgorithm(); + + virtual void newTarget(SP<ITarget> target); + virtual void movedTarget(SP<ITarget> target, std::optional<Vector2D> focalPoint = std::nullopt); + virtual void removeTarget(SP<ITarget> target); + + virtual void resizeTarget(const Vector2D& Δ, SP<ITarget> target, eRectCorner corner = CORNER_NONE); + virtual void recalculate(); + + virtual SP<ITarget> getNextCandidate(SP<ITarget> old); + + virtual std::expected<void, std::string> layoutMsg(const std::string_view& sv); + virtual std::optional<Vector2D> predictSizeForNewTarget(); + + virtual void swapTargets(SP<ITarget> a, SP<ITarget> b); + virtual void moveTargetInDirection(SP<ITarget> t, Math::eDirection dir, bool silent); + + private: + std::vector<SP<SMonocleTargetData>> m_targetDatas; + SP<HOOK_CALLBACK_FN> m_focusCallback; + + int m_currentVisibleIndex = 0; + + SP<SMonocleTargetData> dataFor(SP<ITarget> t); + void cycleNext(); + void cyclePrev(); + void focusTargetUpdate(SP<ITarget> target); + void updateVisible(); + SP<ITarget> getVisibleTarget(); + }; +}; |
