hyprscrolling: fixed moveWindowTo behavior (#546)

* fixed incorrect index

* fixed broken conditional

* undoing idxForHeight change
This commit is contained in:
mwahstache 2025-11-22 18:07:34 -06:00 committed by GitHub
parent 57961d69ad
commit 7ffc0b314e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View file

@ -1445,8 +1445,8 @@ void CScrollingLayout::moveWindowTo(PHLWINDOW w, const std::string& dir, bool si
NEWCOL->add(DATA);
WS->centerOrFitCol(NEWCOL);
} else {
if (COL->windowDatas.size() > 1 || DATA->column)
COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y) - 1);
if (COL->windowDatas.size() > 0)
COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y));
else
COL->add(DATA);
WS->centerOrFitCol(COL);
@ -1462,8 +1462,8 @@ void CScrollingLayout::moveWindowTo(PHLWINDOW w, const std::string& dir, bool si
NEWCOL->add(DATA);
WS->centerOrFitCol(NEWCOL);
} else {
if (COL->windowDatas.size() > 1 || DATA->column)
COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y) - 1);
if (COL->windowDatas.size() > 0)
COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y));
else
COL->add(DATA);
WS->centerOrFitCol(COL);

View file

@ -35,6 +35,8 @@ struct SColumnData {
void remove(PHLWINDOW w);
bool has(PHLWINDOW w);
size_t idx(PHLWINDOW w);
// index of lowest window that is above y.
size_t idxForHeight(float y);
void up(SP<SScrollingWindowData> w);