layout: store and preserve size and pos after fullscreen (#13500)
ref https://github.com/hyprwm/Hyprland/discussions/13401
This commit is contained in:
parent
5f650f8ed9
commit
d98f7ffaf5
11 changed files with 124 additions and 0 deletions
|
|
@ -116,6 +116,8 @@ void CDefaultFloatingAlgorithm::newTarget(SP<ITarget> target) {
|
|||
PWINDOW->m_reportedSize = PWINDOW->m_pendingReportedSize;
|
||||
}
|
||||
}
|
||||
|
||||
updateTarget(target);
|
||||
}
|
||||
|
||||
void CDefaultFloatingAlgorithm::movedTarget(SP<ITarget> target, std::optional<Vector2D> focalPoint) {
|
||||
|
|
@ -152,6 +154,8 @@ void CDefaultFloatingAlgorithm::movedTarget(SP<ITarget> target, std::optional<Ve
|
|||
// put around the current center, fit in workArea
|
||||
target->setPositionGlobal(fitBoxInWorkArea(CBox{NEW_POS, LAST_SIZE}, target));
|
||||
}
|
||||
|
||||
updateTarget(target);
|
||||
}
|
||||
|
||||
CBox CDefaultFloatingAlgorithm::fitBoxInWorkArea(const CBox& box, SP<ITarget> t) {
|
||||
|
|
@ -173,6 +177,7 @@ CBox CDefaultFloatingAlgorithm::fitBoxInWorkArea(const CBox& box, SP<ITarget> t)
|
|||
|
||||
void CDefaultFloatingAlgorithm::removeTarget(SP<ITarget> target) {
|
||||
target->rememberFloatingSize(target->position().size());
|
||||
m_datas.erase(target);
|
||||
}
|
||||
|
||||
void CDefaultFloatingAlgorithm::resizeTarget(const Vector2D& Δ, SP<ITarget> target, eRectCorner corner) {
|
||||
|
|
@ -184,6 +189,8 @@ void CDefaultFloatingAlgorithm::resizeTarget(const Vector2D& Δ, SP<ITarget> tar
|
|||
|
||||
if (g_layoutManager->dragController()->target() == target)
|
||||
target->warpPositionSize();
|
||||
|
||||
updateTarget(target);
|
||||
}
|
||||
|
||||
void CDefaultFloatingAlgorithm::moveTarget(const Vector2D& Δ, SP<ITarget> target) {
|
||||
|
|
@ -193,12 +200,17 @@ void CDefaultFloatingAlgorithm::moveTarget(const Vector2D& Δ, SP<ITarget> targe
|
|||
|
||||
if (g_layoutManager->dragController()->target() == target)
|
||||
target->warpPositionSize();
|
||||
|
||||
updateTarget(target);
|
||||
}
|
||||
|
||||
void CDefaultFloatingAlgorithm::swapTargets(SP<ITarget> a, SP<ITarget> b) {
|
||||
auto posABackup = a->position();
|
||||
a->setPositionGlobal(b->position());
|
||||
b->setPositionGlobal(posABackup);
|
||||
|
||||
updateTarget(a);
|
||||
updateTarget(b);
|
||||
}
|
||||
|
||||
void CDefaultFloatingAlgorithm::moveTargetInDirection(SP<ITarget> t, Math::eDirection dir, bool silent) {
|
||||
|
|
@ -216,4 +228,25 @@ void CDefaultFloatingAlgorithm::moveTargetInDirection(SP<ITarget> t, Math::eDire
|
|||
}
|
||||
|
||||
t->setPositionGlobal(pos);
|
||||
|
||||
updateTarget(t);
|
||||
}
|
||||
|
||||
void CDefaultFloatingAlgorithm::recenter(SP<ITarget> t) {
|
||||
if (!m_datas.contains(t)) {
|
||||
IFloatingAlgorithm::recenter(t);
|
||||
return;
|
||||
}
|
||||
|
||||
t->setPositionGlobal(m_datas.at(t).lastBox);
|
||||
}
|
||||
|
||||
void CDefaultFloatingAlgorithm::setTargetGeom(const CBox& geom, SP<ITarget> target) {
|
||||
target->setPositionGlobal(geom);
|
||||
|
||||
updateTarget(target);
|
||||
}
|
||||
|
||||
void CDefaultFloatingAlgorithm::updateTarget(SP<ITarget> t) {
|
||||
m_datas[t] = {.lastBox = t->position()};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue