dispatchers: fix extra monitor offset when snapping floating (#3520)

modified:   src/managers/KeybindManager.cpp
This commit is contained in:
MightyPlaza 2023-10-08 12:49:15 +00:00 committed by GitHub
parent 728a8bb48e
commit 499df49f7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1109,20 +1109,20 @@ void CKeybindManager::moveActiveTo(std::string args) {
return;
if (PLASTWINDOW->m_bIsFloating) {
auto vPos = PLASTWINDOW->m_vRealPosition.goalv();
Vector2D vPos;
const auto PMONITOR = g_pCompositor->getMonitorFromID(PLASTWINDOW->m_iMonitorID);
const auto BORDERSIZE = PLASTWINDOW->getRealBorderSize();
switch (arg) {
case 'l': vPos.x = PMONITOR->vecReservedTopLeft.x + BORDERSIZE; break;
case 'r': vPos.x = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_vRealSize.goalv().x - BORDERSIZE; break;
case 'l': vPos.x = PMONITOR->vecReservedTopLeft.x + BORDERSIZE + PMONITOR->vecPosition.x; break;
case 'r': vPos.x = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_vRealSize.goalv().x - BORDERSIZE + PMONITOR->vecPosition.x; break;
case 't':
case 'u': vPos.y = PMONITOR->vecReservedTopLeft.y + BORDERSIZE; break;
case 'u': vPos.y = PMONITOR->vecReservedTopLeft.y + BORDERSIZE + PMONITOR->vecPosition.y; break;
case 'b':
case 'd': vPos.y = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_vRealSize.goalv().y - BORDERSIZE; break;
case 'd': vPos.y = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_vRealSize.goalv().y - BORDERSIZE + PMONITOR->vecPosition.y; break;
}
PLASTWINDOW->m_vRealPosition = vPos + PMONITOR->vecPosition;
PLASTWINDOW->m_vRealPosition = Vector2D(vPos.x != 0 ? vPos.x : PLASTWINDOW->m_vRealPosition.goalv().x, vPos.y != 0 ? vPos.y : PLASTWINDOW->m_vRealPosition.goalv().y);
return;
}