From 723870337f299d4c80aa0048144f3a1ca1c885bd Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sat, 21 Feb 2026 21:30:39 +0000 Subject: 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. --- .../algorithm/tiled/monocle/MonocleAlgorithm.hpp | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/layout/algorithm/tiled/monocle/MonocleAlgorithm.hpp (limited to 'src/layout/algorithm/tiled/monocle/MonocleAlgorithm.hpp') 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 + +namespace Layout::Tiled { + + struct SMonocleTargetData { + SMonocleTargetData(SP t) : target(t) { + ; + } + + WP target; + CBox layoutBox; + }; + + class CMonocleAlgorithm : public ITiledAlgorithm { + public: + CMonocleAlgorithm(); + virtual ~CMonocleAlgorithm(); + + virtual void newTarget(SP target); + virtual void movedTarget(SP target, std::optional focalPoint = std::nullopt); + virtual void removeTarget(SP target); + + virtual void resizeTarget(const Vector2D& Δ, SP target, eRectCorner corner = CORNER_NONE); + virtual void recalculate(); + + virtual SP getNextCandidate(SP old); + + virtual std::expected layoutMsg(const std::string_view& sv); + virtual std::optional predictSizeForNewTarget(); + + virtual void swapTargets(SP a, SP b); + virtual void moveTargetInDirection(SP t, Math::eDirection dir, bool silent); + + private: + std::vector> m_targetDatas; + SP m_focusCallback; + + int m_currentVisibleIndex = 0; + + SP dataFor(SP t); + void cycleNext(); + void cyclePrev(); + void focusTargetUpdate(SP target); + void updateVisible(); + SP getVisibleTarget(); + }; +}; -- cgit v1.2.3