mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 04:29:48 +01:00
remember floating size between tiles
This commit is contained in:
parent
ad42392856
commit
4ea37fe64d
2 changed files with 21 additions and 10 deletions
|
@ -58,6 +58,9 @@ public:
|
||||||
Vector2D m_vReportedPosition;
|
Vector2D m_vReportedPosition;
|
||||||
Vector2D m_vReportedSize;
|
Vector2D m_vReportedSize;
|
||||||
|
|
||||||
|
// for restoring floating statuses
|
||||||
|
Vector2D m_vLastFloatingSize;
|
||||||
|
|
||||||
// this is used for pseudotiling
|
// this is used for pseudotiling
|
||||||
bool m_bIsPseudotiled = false;
|
bool m_bIsPseudotiled = false;
|
||||||
Vector2D m_vPseudoSize = Vector2D(0,0);
|
Vector2D m_vPseudoSize = Vector2D(0,0);
|
||||||
|
|
|
@ -6,6 +6,16 @@ void IHyprLayout::onWindowCreated(CWindow* pWindow) {
|
||||||
if (pWindow->m_bIsFloating) {
|
if (pWindow->m_bIsFloating) {
|
||||||
onWindowCreatedFloating(pWindow);
|
onWindowCreatedFloating(pWindow);
|
||||||
} else {
|
} else {
|
||||||
|
wlr_box desiredGeometry = {0};
|
||||||
|
g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry);
|
||||||
|
|
||||||
|
if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
|
||||||
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
||||||
|
pWindow->m_vLastFloatingSize = PMONITOR->vecSize / 2.f;
|
||||||
|
} else {
|
||||||
|
pWindow->m_vLastFloatingSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
|
||||||
|
}
|
||||||
|
|
||||||
onWindowCreatedTiling(pWindow);
|
onWindowCreatedTiling(pWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,12 +126,14 @@ void IHyprLayout::onBeginDragWindow() {
|
||||||
changeWindowFloatingMode(DRAGGINGWINDOW);
|
changeWindowFloatingMode(DRAGGINGWINDOW);
|
||||||
DRAGGINGWINDOW->m_bIsFloating = true;
|
DRAGGINGWINDOW->m_bIsFloating = true;
|
||||||
DRAGGINGWINDOW->m_bDraggingTiled = true;
|
DRAGGINGWINDOW->m_bDraggingTiled = true;
|
||||||
|
|
||||||
|
DRAGGINGWINDOW->m_vRealPosition = g_pInputManager->getMouseCoordsInternal() - DRAGGINGWINDOW->m_vRealSize.goalv() / 2.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_vBeginDragXY = g_pInputManager->getMouseCoordsInternal();
|
m_vBeginDragXY = g_pInputManager->getMouseCoordsInternal();
|
||||||
m_vBeginDragPositionXY = DRAGGINGWINDOW->m_vRealPosition.vec();
|
m_vBeginDragPositionXY = DRAGGINGWINDOW->m_vRealPosition.goalv();
|
||||||
m_vBeginDragSizeXY = DRAGGINGWINDOW->m_vRealSize.vec();
|
m_vBeginDragSizeXY = DRAGGINGWINDOW->m_vRealSize.goalv();
|
||||||
m_vLastDragXY = m_vBeginDragXY;
|
m_vLastDragXY = m_vBeginDragXY;
|
||||||
|
|
||||||
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
||||||
|
@ -220,6 +232,8 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
|
||||||
// if the window is pseudo, update its size
|
// if the window is pseudo, update its size
|
||||||
pWindow->m_vPseudoSize = pWindow->m_vRealSize.vec();
|
pWindow->m_vPseudoSize = pWindow->m_vRealSize.vec();
|
||||||
|
|
||||||
|
pWindow->m_vLastFloatingSize = PSAVEDSIZE;
|
||||||
|
|
||||||
onWindowCreatedTiling(pWindow);
|
onWindowCreatedTiling(pWindow);
|
||||||
|
|
||||||
pWindow->m_vRealPosition.setValue(PSAVEDPOS);
|
pWindow->m_vRealPosition.setValue(PSAVEDPOS);
|
||||||
|
@ -235,14 +249,8 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
|
||||||
|
|
||||||
g_pCompositor->moveWindowToTop(pWindow);
|
g_pCompositor->moveWindowToTop(pWindow);
|
||||||
|
|
||||||
const auto POS = pWindow->m_vRealPosition.goalv();
|
pWindow->m_vRealPosition = pWindow->m_vRealPosition.vec() + (pWindow->m_vRealSize.vec() - pWindow->m_vLastFloatingSize) / 2.f;
|
||||||
const auto SIZ = pWindow->m_vRealSize.goalv();
|
pWindow->m_vRealSize = pWindow->m_vLastFloatingSize;
|
||||||
|
|
||||||
pWindow->m_vRealPosition.setValueAndWarp(POS + Vector2D(5, 5));
|
|
||||||
pWindow->m_vRealSize.setValueAndWarp(SIZ - Vector2D(10, 10));
|
|
||||||
|
|
||||||
pWindow->m_vRealPosition = POS;
|
|
||||||
pWindow->m_vRealSize = SIZ;
|
|
||||||
|
|
||||||
g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID));
|
g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue