Skip to content

Commit 7ffc0b3

Browse files
authored
hyprscrolling: fixed moveWindowTo behavior (#546)
* fixed incorrect index * fixed broken conditional * undoing idxForHeight change
1 parent 57961d6 commit 7ffc0b3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

hyprscrolling/Scrolling.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,8 +1445,8 @@ void CScrollingLayout::moveWindowTo(PHLWINDOW w, const std::string& dir, bool si
14451445
NEWCOL->add(DATA);
14461446
WS->centerOrFitCol(NEWCOL);
14471447
} else {
1448-
if (COL->windowDatas.size() > 1 || DATA->column)
1449-
COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y) - 1);
1448+
if (COL->windowDatas.size() > 0)
1449+
COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y));
14501450
else
14511451
COL->add(DATA);
14521452
WS->centerOrFitCol(COL);
@@ -1462,8 +1462,8 @@ void CScrollingLayout::moveWindowTo(PHLWINDOW w, const std::string& dir, bool si
14621462
NEWCOL->add(DATA);
14631463
WS->centerOrFitCol(NEWCOL);
14641464
} else {
1465-
if (COL->windowDatas.size() > 1 || DATA->column)
1466-
COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y) - 1);
1465+
if (COL->windowDatas.size() > 0)
1466+
COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y));
14671467
else
14681468
COL->add(DATA);
14691469
WS->centerOrFitCol(COL);

hyprscrolling/Scrolling.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ struct SColumnData {
3535
void remove(PHLWINDOW w);
3636
bool has(PHLWINDOW w);
3737
size_t idx(PHLWINDOW w);
38+
39+
// index of lowest window that is above y.
3840
size_t idxForHeight(float y);
3941

4042
void up(SP<SScrollingWindowData> w);

0 commit comments

Comments
 (0)