summaryrefslogtreecommitdiff
path: root/src/layout/MasterLayout.hpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-04-27 12:43:12 +0100
committerGitHub <noreply@github.com>2024-04-27 12:43:12 +0100
commitbca7804bb6e1bf5ce5a99b9ae4806be25e36993c (patch)
treeebd3a578de1dfe11b54f9440cfc3a408ffa6a620 /src/layout/MasterLayout.hpp
parent25aec3ac8ce65ed224f025f8f6dfef73780577a4 (diff)
internal: Window storage rework - part 1 (#5762)
* Window storage rework - part 1 * format * remove useless include * fix pch * format * fix crash in dwindle * fix vram leak * prefer .expired() for bool checks
Diffstat (limited to 'src/layout/MasterLayout.hpp')
-rw-r--r--src/layout/MasterLayout.hpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/layout/MasterLayout.hpp b/src/layout/MasterLayout.hpp
index de4ac41d..30d5b3cf 100644
--- a/src/layout/MasterLayout.hpp
+++ b/src/layout/MasterLayout.hpp
@@ -20,23 +20,23 @@ enum eOrientation : uint8_t {
};
struct SMasterNodeData {
- bool isMaster = false;
- float percMaster = 0.5f;
+ bool isMaster = false;
+ float percMaster = 0.5f;
- CWindow* pWindow = nullptr;
+ PHLWINDOWREF pWindow;
- Vector2D position;
- Vector2D size;
+ Vector2D position;
+ Vector2D size;
- float percSize = 1.f; // size multiplier for resizing children
+ float percSize = 1.f; // size multiplier for resizing children
- int workspaceID = -1;
+ int workspaceID = -1;
- bool ignoreFullscreenChecks = false;
+ bool ignoreFullscreenChecks = false;
//
bool operator==(const SMasterNodeData& rhs) const {
- return pWindow == rhs.pWindow;
+ return pWindow.lock() == rhs.pWindow.lock();
}
};
@@ -52,20 +52,20 @@ struct SMasterWorkspaceData {
class CHyprMasterLayout : public IHyprLayout {
public:
- virtual void onWindowCreatedTiling(CWindow*, eDirection direction = DIRECTION_DEFAULT);
- virtual void onWindowRemovedTiling(CWindow*);
- virtual bool isWindowTiled(CWindow*);
+ virtual void onWindowCreatedTiling(PHLWINDOW, eDirection direction = DIRECTION_DEFAULT);
+ virtual void onWindowRemovedTiling(PHLWINDOW);
+ virtual bool isWindowTiled(PHLWINDOW);
virtual void recalculateMonitor(const int&);
- virtual void recalculateWindow(CWindow*);
- virtual void resizeActiveWindow(const Vector2D&, eRectCorner corner = CORNER_NONE, CWindow* pWindow = nullptr);
- virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool);
+ virtual void recalculateWindow(PHLWINDOW);
+ virtual void resizeActiveWindow(const Vector2D&, eRectCorner corner = CORNER_NONE, PHLWINDOW pWindow = nullptr);
+ virtual void fullscreenRequestForWindow(PHLWINDOW, eFullscreenMode, bool);
virtual std::any layoutMessage(SLayoutMessageHeader, std::string);
- virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
- virtual void switchWindows(CWindow*, CWindow*);
- virtual void moveWindowTo(CWindow*, const std::string& dir, bool silent);
- virtual void alterSplitRatio(CWindow*, float, bool);
+ virtual SWindowRenderLayoutHints requestRenderHints(PHLWINDOW);
+ virtual void switchWindows(PHLWINDOW, PHLWINDOW);
+ virtual void moveWindowTo(PHLWINDOW, const std::string& dir, bool silent);
+ virtual void alterSplitRatio(PHLWINDOW, float, bool);
virtual std::string getLayoutName();
- virtual void replaceWindowDataWith(CWindow* from, CWindow* to);
+ virtual void replaceWindowDataWith(PHLWINDOW from, PHLWINDOW to);
virtual Vector2D predictSizeForNewWindowTiled();
virtual void onEnable();
@@ -83,11 +83,11 @@ class CHyprMasterLayout : public IHyprLayout {
eOrientation getDynamicOrientation(PHLWORKSPACE);
int getNodesOnWorkspace(const int&);
void applyNodeDataToWindow(SMasterNodeData*);
- SMasterNodeData* getNodeFromWindow(CWindow*);
+ SMasterNodeData* getNodeFromWindow(PHLWINDOW);
SMasterNodeData* getMasterNodeOnWorkspace(const int&);
SMasterWorkspaceData* getMasterWorkspaceData(const int&);
void calculateWorkspace(PHLWORKSPACE);
- CWindow* getNextWindow(CWindow*, bool);
+ PHLWINDOW getNextWindow(PHLWINDOW, bool);
int getMastersOnWorkspace(const int&);
friend struct SMasterNodeData;
@@ -104,8 +104,8 @@ struct std::formatter<SMasterNodeData*, CharT> : std::formatter<CharT> {
std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", (uintptr_t)node, node->workspaceID, node->position, node->size);
if (node->isMaster)
std::format_to(out, ", master");
- if (node->pWindow)
- std::format_to(out, ", window: {:x}", node->pWindow);
+ if (!node->pWindow.expired())
+ std::format_to(out, ", window: {:x}", node->pWindow.lock());
return std::format_to(out, "]");
}
};