keybinds: movegroupwindow-improvement (#2740)

* movegroupwindow-improvement

* use std::swap
This commit is contained in:
MightyPlaza 2023-07-18 22:30:10 +00:00 committed by GitHub
parent ce9c5fd722
commit 3b03597784
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1013,11 +1013,9 @@ void CKeybindManager::moveFocusTo(std::string args) {
}
};
const auto PWINDOWTOCHANGETO = PLASTWINDOW->m_bIsFullscreen
? (arg == 'd' || arg == 'b' || arg == 'r'
? g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true)
: g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW, true))
: g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
const auto PWINDOWTOCHANGETO = PLASTWINDOW->m_bIsFullscreen ?
(arg == 'd' || arg == 'b' || arg == 'r' ? g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true) : g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW, true)) :
g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
// Found window in direction, switch to it
if (PWINDOWTOCHANGETO) {
@ -2088,6 +2086,9 @@ void CKeybindManager::moveGroupWindow(std::string args) {
if (!g_pCompositor->m_pLastWindow || !g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow)
return;
if ((!BACK && g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow->m_sGroupData.head) || (BACK && g_pCompositor->m_pLastWindow->m_sGroupData.head))
std::swap(g_pCompositor->m_pLastWindow->m_sGroupData.head, g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow->m_sGroupData.head);
else
g_pCompositor->m_pLastWindow->switchWithWindowInGroup(BACK ? g_pCompositor->m_pLastWindow->getGroupPrevious() : g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow);
g_pCompositor->m_pLastWindow->updateWindowDecos();
}