Added pseudotiling
This commit is contained in:
parent
7add082217
commit
3f99dad7f5
9 changed files with 82 additions and 4 deletions
|
|
@ -109,6 +109,30 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode) {
|
|||
PWINDOW->m_vEffectivePosition = PWINDOW->m_vEffectivePosition + OFFSETTOPLEFT;
|
||||
PWINDOW->m_vEffectiveSize = PWINDOW->m_vEffectiveSize - OFFSETTOPLEFT - OFFSETBOTTOMRIGHT;
|
||||
|
||||
if (PWINDOW->m_bIsPseudotiled) {
|
||||
// Calculate pseudo
|
||||
float scale = 1;
|
||||
|
||||
// adjust if doesnt fit
|
||||
if (PWINDOW->m_vPseudoSize.x > PWINDOW->m_vEffectiveSize.x || PWINDOW->m_vPseudoSize.y > PWINDOW->m_vEffectiveSize.y) {
|
||||
if (PWINDOW->m_vPseudoSize.x > PWINDOW->m_vEffectiveSize.x) {
|
||||
scale = PWINDOW->m_vEffectiveSize.x / PWINDOW->m_vPseudoSize.x;
|
||||
}
|
||||
|
||||
if (PWINDOW->m_vPseudoSize.y * scale > PWINDOW->m_vEffectiveSize.y) {
|
||||
scale = PWINDOW->m_vEffectiveSize.y / PWINDOW->m_vPseudoSize.y;
|
||||
}
|
||||
|
||||
auto DELTA = PWINDOW->m_vEffectiveSize - PWINDOW->m_vPseudoSize * scale;
|
||||
PWINDOW->m_vEffectiveSize = PWINDOW->m_vPseudoSize * scale;
|
||||
PWINDOW->m_vEffectivePosition = PWINDOW->m_vEffectivePosition + DELTA / 2.f; // center
|
||||
} else {
|
||||
auto DELTA = PWINDOW->m_vEffectiveSize - PWINDOW->m_vPseudoSize;
|
||||
PWINDOW->m_vEffectivePosition = PWINDOW->m_vEffectivePosition + DELTA / 2.f; // center
|
||||
PWINDOW->m_vEffectiveSize = PWINDOW->m_vPseudoSize;
|
||||
}
|
||||
}
|
||||
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vEffectiveSize);
|
||||
}
|
||||
|
||||
|
|
@ -271,6 +295,9 @@ void CHyprDwindleLayout::changeWindowFloatingMode(CWindow* pWindow) {
|
|||
const auto PSAVEDPOS = pWindow->m_vRealPosition;
|
||||
const auto PSAVEDSIZE = pWindow->m_vRealSize;
|
||||
|
||||
// if the window is pseudo, update its size
|
||||
pWindow->m_vPseudoSize = pWindow->m_vRealSize;
|
||||
|
||||
onWindowCreated(pWindow);
|
||||
|
||||
pWindow->m_vRealPosition = PSAVEDPOS;
|
||||
|
|
@ -430,3 +457,12 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow) {
|
|||
// because otherwise they'd still be recieving mouse events
|
||||
g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace);
|
||||
}
|
||||
|
||||
void CHyprDwindleLayout::recalculateWindow(CWindow* pWindow) {
|
||||
const auto PNODE = getNodeFromWindow(pWindow);
|
||||
|
||||
if (!PNODE)
|
||||
return;
|
||||
|
||||
PNODE->recalcSizePosRecursive();
|
||||
}
|
||||
|
|
@ -32,6 +32,7 @@ public:
|
|||
virtual void onWindowCreated(CWindow*);
|
||||
virtual void onWindowRemoved(CWindow*);
|
||||
virtual void recalculateMonitor(const int&);
|
||||
virtual void recalculateWindow(CWindow*);
|
||||
virtual void changeWindowFloatingMode(CWindow*);
|
||||
virtual void onBeginDragWindow();
|
||||
virtual void onMouseMove(const Vector2D&);
|
||||
|
|
|
|||
|
|
@ -15,11 +15,17 @@ public:
|
|||
*/
|
||||
virtual void onWindowRemoved(CWindow*) = 0;
|
||||
/*
|
||||
Called when a the monitor requires a layout recalculation
|
||||
Called when the monitor requires a layout recalculation
|
||||
this usually means reserved area changes
|
||||
*/
|
||||
virtual void recalculateMonitor(const int&) = 0;
|
||||
|
||||
/*
|
||||
Called when the compositor requests a window
|
||||
to be recalculated, e.g. when pseudo is toggled.
|
||||
*/
|
||||
virtual void recalculateWindow(CWindow*) = 0;
|
||||
|
||||
/*
|
||||
Called when a window is requested to be floated
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue