mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 05:49:48 +01:00
refactor: replace manual iteration of CWindow with existing methods (#3147)
This commit is contained in:
parent
6a0e2bbff3
commit
69439871e6
3 changed files with 12 additions and 25 deletions
|
@ -31,24 +31,19 @@ void IHyprLayout::onWindowRemoved(CWindow* pWindow) {
|
||||||
pWindow->m_sGroupData.pNextWindow = nullptr;
|
pWindow->m_sGroupData.pNextWindow = nullptr;
|
||||||
else {
|
else {
|
||||||
// find last window and update
|
// find last window and update
|
||||||
CWindow* curr = pWindow;
|
CWindow* PWINDOWPREV = pWindow->getGroupPrevious();
|
||||||
const auto CURRWASVISIBLE = curr->getGroupCurrent() == curr;
|
const auto WINDOWISVISIBLE = pWindow->getGroupCurrent() == pWindow;
|
||||||
|
|
||||||
while (curr->m_sGroupData.pNextWindow != pWindow)
|
if (WINDOWISVISIBLE)
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
PWINDOWPREV->setGroupCurrent(PWINDOWPREV);
|
||||||
|
|
||||||
if (CURRWASVISIBLE)
|
PWINDOWPREV->m_sGroupData.pNextWindow = pWindow->m_sGroupData.pNextWindow;
|
||||||
curr->setGroupCurrent(curr);
|
|
||||||
|
|
||||||
curr->m_sGroupData.pNextWindow = pWindow->m_sGroupData.pNextWindow;
|
|
||||||
|
|
||||||
pWindow->m_sGroupData.pNextWindow = nullptr;
|
pWindow->m_sGroupData.pNextWindow = nullptr;
|
||||||
|
|
||||||
if (pWindow->m_sGroupData.head) {
|
if (pWindow->m_sGroupData.head) {
|
||||||
pWindow->m_sGroupData.head = false;
|
std::swap(PWINDOWPREV->m_sGroupData.head, pWindow->m_sGroupData.head);
|
||||||
curr->m_sGroupData.head = true;
|
std::swap(PWINDOWPREV->m_sGroupData.locked, pWindow->m_sGroupData.locked);
|
||||||
curr->m_sGroupData.locked = pWindow->m_sGroupData.locked;
|
|
||||||
pWindow->m_sGroupData.locked = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWindow == m_pLastTiledWindow)
|
if (pWindow == m_pLastTiledWindow)
|
||||||
|
@ -57,7 +52,7 @@ void IHyprLayout::onWindowRemoved(CWindow* pWindow) {
|
||||||
pWindow->setHidden(false);
|
pWindow->setHidden(false);
|
||||||
|
|
||||||
pWindow->updateWindowDecos();
|
pWindow->updateWindowDecos();
|
||||||
curr->getGroupCurrent()->updateWindowDecos();
|
PWINDOWPREV->getGroupCurrent()->updateWindowDecos();
|
||||||
g_pCompositor->updateWindowAnimatedDecorationValues(pWindow);
|
g_pCompositor->updateWindowAnimatedDecorationValues(pWindow);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1243,10 +1243,7 @@ void CKeybindManager::changeGroupActive(std::string args) {
|
||||||
if (args != "b" && args != "prev") {
|
if (args != "b" && args != "prev") {
|
||||||
PWINDOW->setGroupCurrent(PWINDOW->m_sGroupData.pNextWindow);
|
PWINDOW->setGroupCurrent(PWINDOW->m_sGroupData.pNextWindow);
|
||||||
} else {
|
} else {
|
||||||
CWindow* curr = PWINDOW->m_sGroupData.pNextWindow;
|
PWINDOW->setGroupCurrent(PWINDOW->getGroupPrevious());
|
||||||
while (curr->m_sGroupData.pNextWindow != PWINDOW)
|
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
|
||||||
PWINDOW->setGroupCurrent(curr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,15 +57,10 @@ void CHyprGroupBarDecoration::updateWindow(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dwGroupMembers.clear();
|
m_dwGroupMembers.clear();
|
||||||
CWindow* curr = pWindow;
|
CWindow* head = pWindow->getGroupHead();
|
||||||
CWindow* head = nullptr;
|
m_dwGroupMembers.push_back(head);
|
||||||
while (!curr->m_sGroupData.head) {
|
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
head = curr;
|
CWindow* curr = head->m_sGroupData.pNextWindow;
|
||||||
m_dwGroupMembers.push_back(curr);
|
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
|
||||||
while (curr != head) {
|
while (curr != head) {
|
||||||
m_dwGroupMembers.push_back(curr);
|
m_dwGroupMembers.push_back(curr);
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow;
|
||||||
|
|
Loading…
Reference in a new issue