2022-03-19 15:59:53 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "IHyprLayout.hpp"
|
|
|
|
#include <list>
|
|
|
|
|
2022-03-19 20:30:21 +01:00
|
|
|
class CHyprDwindleLayout;
|
|
|
|
|
2022-03-19 15:59:53 +01:00
|
|
|
struct SDwindleNodeData {
|
|
|
|
SDwindleNodeData* pParent = nullptr;
|
|
|
|
bool isNode = false;
|
|
|
|
|
|
|
|
CWindow* pWindow = nullptr;
|
|
|
|
|
|
|
|
std::array<SDwindleNodeData*, 2> children = { nullptr, nullptr };
|
|
|
|
|
|
|
|
Vector2D position;
|
|
|
|
Vector2D size;
|
|
|
|
|
2022-03-20 16:06:17 +01:00
|
|
|
int workspaceID = -1;
|
2022-03-19 15:59:53 +01:00
|
|
|
|
2022-04-10 19:31:36 +02:00
|
|
|
float splitRatio = 1.f;
|
|
|
|
|
2022-03-19 15:59:53 +01:00
|
|
|
// For list lookup
|
|
|
|
bool operator==(const SDwindleNodeData& rhs) {
|
2022-03-20 16:06:17 +01:00
|
|
|
return pWindow == rhs.pWindow && workspaceID == rhs.workspaceID && position == rhs.position && size == rhs.size && pParent == rhs.pParent && children[0] == rhs.children[0] && children[1] == rhs.children[1];
|
2022-03-19 15:59:53 +01:00
|
|
|
}
|
|
|
|
|
2022-03-19 20:30:21 +01:00
|
|
|
void recalcSizePosRecursive();
|
|
|
|
CHyprDwindleLayout* layout = nullptr;
|
2022-03-19 15:59:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class CHyprDwindleLayout : public IHyprLayout {
|
|
|
|
public:
|
|
|
|
virtual void onWindowCreated(CWindow*);
|
|
|
|
virtual void onWindowRemoved(CWindow*);
|
2022-03-19 20:56:19 +01:00
|
|
|
virtual void recalculateMonitor(const int&);
|
2022-04-02 20:04:32 +02:00
|
|
|
virtual void recalculateWindow(CWindow*);
|
2022-03-20 11:14:24 +01:00
|
|
|
virtual void changeWindowFloatingMode(CWindow*);
|
|
|
|
virtual void onBeginDragWindow();
|
2022-04-03 13:49:21 +02:00
|
|
|
virtual void onEndDragWindow();
|
2022-03-20 11:14:24 +01:00
|
|
|
virtual void onMouseMove(const Vector2D&);
|
2022-03-20 13:37:07 +01:00
|
|
|
virtual void onWindowCreatedFloating(CWindow*);
|
2022-03-21 19:18:33 +01:00
|
|
|
virtual void fullscreenRequestForWindow(CWindow*);
|
2022-03-19 15:59:53 +01:00
|
|
|
|
2022-03-20 11:14:24 +01:00
|
|
|
private:
|
2022-03-19 15:59:53 +01:00
|
|
|
|
|
|
|
std::list<SDwindleNodeData> m_lDwindleNodesData;
|
|
|
|
|
2022-03-20 11:14:24 +01:00
|
|
|
Vector2D m_vBeginDragXY;
|
2022-04-10 19:31:36 +02:00
|
|
|
Vector2D m_vLastDragXY;
|
2022-03-20 11:14:24 +01:00
|
|
|
Vector2D m_vBeginDragPositionXY;
|
|
|
|
Vector2D m_vBeginDragSizeXY;
|
|
|
|
|
2022-03-20 16:06:17 +01:00
|
|
|
int getNodesOnWorkspace(const int&);
|
2022-03-19 15:59:53 +01:00
|
|
|
void applyNodeDataToWindow(SDwindleNodeData*);
|
|
|
|
SDwindleNodeData* getNodeFromWindow(CWindow*);
|
2022-03-20 16:06:17 +01:00
|
|
|
SDwindleNodeData* getFirstNodeOnWorkspace(const int&);
|
|
|
|
SDwindleNodeData* getMasterNodeOnWorkspace(const int&);
|
2022-03-19 20:30:21 +01:00
|
|
|
|
|
|
|
friend struct SDwindleNodeData;
|
2022-03-19 15:59:53 +01:00
|
|
|
};
|