2022-07-16 15:57:31 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "IHyprLayout.hpp"
|
2022-12-10 22:59:16 +01:00
|
|
|
#include <vector>
|
2022-07-16 15:57:31 +02:00
|
|
|
#include <list>
|
|
|
|
#include <deque>
|
2022-12-16 18:17:31 +01:00
|
|
|
#include <any>
|
2022-07-16 15:57:31 +02:00
|
|
|
|
|
|
|
enum eFullscreenMode : uint8_t;
|
|
|
|
|
2022-12-10 22:59:16 +01:00
|
|
|
//orientation determines which side of the screen the master area resides
|
2022-12-16 18:17:31 +01:00
|
|
|
enum eOrientation : uint8_t
|
|
|
|
{
|
2022-12-10 22:59:16 +01:00
|
|
|
ORIENTATION_LEFT = 0,
|
|
|
|
ORIENTATION_TOP,
|
|
|
|
ORIENTATION_RIGHT,
|
|
|
|
ORIENTATION_BOTTOM
|
|
|
|
};
|
|
|
|
|
2022-07-16 15:57:31 +02:00
|
|
|
struct SMasterNodeData {
|
2022-12-16 18:17:31 +01:00
|
|
|
bool isMaster = false;
|
|
|
|
float percMaster = 0.5f;
|
2022-07-16 15:57:31 +02:00
|
|
|
|
|
|
|
CWindow* pWindow = nullptr;
|
|
|
|
|
|
|
|
Vector2D position;
|
|
|
|
Vector2D size;
|
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
float percSize = 1.f; // size multiplier for resizing children
|
2022-11-10 13:05:22 +01:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
int workspaceID = -1;
|
2022-07-16 15:57:31 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
bool operator==(const SMasterNodeData& rhs) {
|
2022-07-16 15:57:31 +02:00
|
|
|
return pWindow == rhs.pWindow;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-12-10 22:59:16 +01:00
|
|
|
struct SMasterWorkspaceData {
|
2022-12-16 18:17:31 +01:00
|
|
|
int workspaceID = -1;
|
2022-12-10 22:59:16 +01:00
|
|
|
eOrientation orientation = ORIENTATION_LEFT;
|
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
bool operator==(const SMasterWorkspaceData& rhs) {
|
2022-12-10 22:59:16 +01:00
|
|
|
return workspaceID == rhs.workspaceID;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-07-16 15:57:31 +02:00
|
|
|
class CHyprMasterLayout : 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-07-16 15:57:31 +02:00
|
|
|
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
|
2022-12-16 18:17:31 +01:00
|
|
|
virtual void switchWindows(CWindow*, CWindow*);
|
|
|
|
virtual void alterSplitRatioBy(CWindow*, float);
|
|
|
|
virtual std::string getLayoutName();
|
2022-07-16 15:57:31 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
virtual void onEnable();
|
|
|
|
virtual void onDisable();
|
2022-07-16 15:57:31 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
private:
|
|
|
|
std::list<SMasterNodeData> m_lMasterNodesData;
|
2022-12-10 22:59:16 +01:00
|
|
|
std::vector<SMasterWorkspaceData> m_lMasterWorkspacesData;
|
2022-07-16 15:57:31 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
bool m_bForceWarps = false;
|
|
|
|
|
|
|
|
int getNodesOnWorkspace(const int&);
|
|
|
|
void applyNodeDataToWindow(SMasterNodeData*);
|
|
|
|
SMasterNodeData* getNodeFromWindow(CWindow*);
|
|
|
|
SMasterNodeData* getMasterNodeOnWorkspace(const int&);
|
|
|
|
SMasterWorkspaceData* getMasterWorkspaceData(const int&);
|
|
|
|
void calculateWorkspace(const int&);
|
|
|
|
CWindow* getNextWindow(CWindow*, bool);
|
|
|
|
int getMastersOnWorkspace(const int&);
|
|
|
|
bool prepareLoseFocus(CWindow*);
|
|
|
|
void prepareNewFocus(CWindow*, bool inherit_fullscreen);
|
2022-07-16 15:57:31 +02:00
|
|
|
|
|
|
|
friend struct SMasterNodeData;
|
2022-12-10 22:59:16 +01:00
|
|
|
friend struct SMasterWorkspaceData;
|
|
|
|
};
|