2022-03-19 15:59:53 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "IHyprLayout.hpp"
|
|
|
|
#include <list>
|
2022-04-12 16:44:18 +02:00
|
|
|
#include <deque>
|
2022-05-28 20:46:20 +02:00
|
|
|
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
|
2022-12-16 18:17:31 +01:00
|
|
|
#include <array>
|
2022-03-19 15:59:53 +01:00
|
|
|
|
2022-03-19 20:30:21 +01:00
|
|
|
class CHyprDwindleLayout;
|
2022-05-29 15:44:30 +02:00
|
|
|
enum eFullscreenMode : uint8_t;
|
2022-03-19 20:30:21 +01:00
|
|
|
|
2022-03-19 15:59:53 +01:00
|
|
|
struct SDwindleNodeData {
|
2022-12-16 18:17:31 +01:00
|
|
|
SDwindleNodeData* pParent = nullptr;
|
|
|
|
bool isNode = false;
|
2022-03-19 15:59:53 +01:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
CWindow* pWindow = nullptr;
|
2022-03-19 15:59:53 +01:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
std::array<SDwindleNodeData*, 2> children = {nullptr, nullptr};
|
2022-03-19 15:59:53 +01:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
bool splitTop = false; // for preserve_split
|
2022-05-16 17:27:55 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
bool groupHead = false;
|
|
|
|
SDwindleNodeData* pNextGroupMember = nullptr;
|
|
|
|
SDwindleNodeData* pPreviousGroupMember = nullptr;
|
2022-04-12 16:44:18 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
Vector2D position;
|
|
|
|
Vector2D size;
|
2022-03-19 15:59:53 +01:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
int workspaceID = -1;
|
2022-03-19 15:59:53 +01:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
float splitRatio = 1.f;
|
2022-04-10 19:31:36 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
bool valid = true;
|
2022-08-01 12:51:52 +02:00
|
|
|
|
2022-03-19 15:59:53 +01:00
|
|
|
// For list lookup
|
|
|
|
bool operator==(const SDwindleNodeData& rhs) {
|
2022-12-16 18:17:31 +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-12-16 18:17:31 +01:00
|
|
|
void recalcSizePosRecursive(bool force = false);
|
|
|
|
void getAllChildrenRecursive(std::deque<SDwindleNodeData*>*);
|
|
|
|
bool isGroupMember();
|
|
|
|
SDwindleNodeData* getGroupHead();
|
|
|
|
SDwindleNodeData* getGroupVisible();
|
|
|
|
int getGroupMemberCount();
|
|
|
|
void setGroupFocusedNode(SDwindleNodeData*);
|
2022-03-19 20:30:21 +01:00
|
|
|
CHyprDwindleLayout* layout = nullptr;
|
2022-03-19 15:59:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class CHyprDwindleLayout : public IHyprLayout {
|
2022-12-16 18:17:31 +01:00
|
|
|
public:
|
|
|
|
virtual void onWindowCreatedTiling(CWindow*);
|
|
|
|
virtual void onWindowRemovedTiling(CWindow*);
|
|
|
|
virtual bool isWindowTiled(CWindow*);
|
|
|
|
virtual void recalculateMonitor(const int&);
|
|
|
|
virtual void recalculateWindow(CWindow*);
|
|
|
|
virtual void resizeActiveWindow(const Vector2D&, CWindow* pWindow = nullptr);
|
|
|
|
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool);
|
|
|
|
virtual std::any layoutMessage(SLayoutMessageHeader, std::string);
|
2022-04-12 16:44:18 +02:00
|
|
|
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
|
2022-12-16 18:17:31 +01:00
|
|
|
virtual void switchWindows(CWindow*, CWindow*);
|
2022-12-17 23:37:44 +01:00
|
|
|
virtual void alterSplitRatio(CWindow*, float, bool);
|
2022-12-16 18:17:31 +01:00
|
|
|
virtual std::string getLayoutName();
|
|
|
|
|
|
|
|
virtual void onEnable();
|
|
|
|
virtual void onDisable();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::list<SDwindleNodeData> m_lDwindleNodesData;
|
|
|
|
|
|
|
|
int getNodesOnWorkspace(const int&);
|
|
|
|
void applyNodeDataToWindow(SDwindleNodeData*, bool force = false);
|
|
|
|
SDwindleNodeData* getNodeFromWindow(CWindow*);
|
|
|
|
SDwindleNodeData* getFirstNodeOnWorkspace(const int&);
|
|
|
|
SDwindleNodeData* getMasterNodeOnWorkspace(const int&);
|
|
|
|
|
|
|
|
void toggleWindowGroup(CWindow*);
|
|
|
|
void switchGroupWindow(CWindow*, bool forward, CWindow* to = nullptr);
|
|
|
|
void toggleSplit(CWindow*);
|
|
|
|
std::deque<CWindow*> getGroupMembers(CWindow*);
|
2022-05-16 17:37:46 +02:00
|
|
|
|
2022-03-19 20:30:21 +01:00
|
|
|
friend struct SDwindleNodeData;
|
2022-12-17 23:37:44 +01:00
|
|
|
};
|