From fe0a20213783a3dcedb4ad30e79e5a6cc9dc3d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Mon, 2 Mar 2026 21:12:27 +0000 Subject: desktop/group: respect direction when moving window out of group (#13490) --- src/desktop/view/Group.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/desktop/view/Group.cpp') diff --git a/src/desktop/view/Group.cpp b/src/desktop/view/Group.cpp index a14ea0be..06884cff 100644 --- a/src/desktop/view/Group.cpp +++ b/src/desktop/view/Group.cpp @@ -120,7 +120,7 @@ void CGroup::add(PHLWINDOW w) { m_target->recalc(); } -void CGroup::remove(PHLWINDOW w) { +void CGroup::remove(PHLWINDOW w, Math::eDirection dir) { std::optional idx; for (size_t i = 0; i < m_windows.size(); ++i) { if (m_windows.at(i) == w) { @@ -156,8 +156,20 @@ void CGroup::remove(PHLWINDOW w) { updateWindowVisibility(); // do this here: otherwise the new current is hidden and workspace rules get wrong data - if (!REMOVING_GROUP) - w->m_target->assignToSpace(m_target->space()); + if (!REMOVING_GROUP) { + std::optional focalPoint; + if (dir != Math::DIRECTION_DEFAULT) { + const auto box = m_target->position(); + switch (dir) { + case Math::DIRECTION_RIGHT: focalPoint = Vector2D(box.x + box.w, box.y + box.h / 2.0); break; + case Math::DIRECTION_LEFT: focalPoint = Vector2D(box.x, box.y + box.h / 2.0); break; + case Math::DIRECTION_DOWN: focalPoint = Vector2D(box.x + box.w / 2.0, box.y + box.h); break; + case Math::DIRECTION_UP: focalPoint = Vector2D(box.x + box.w / 2.0, box.y); break; + default: break; + } + } + w->m_target->assignToSpace(m_target->space(), focalPoint); + } } void CGroup::moveCurrent(bool next) { -- cgit v1.2.3