Skip to content

Commit 8bf1a68

Browse files
committed
undoing idxForHeight change
1 parent 335ca77 commit 8bf1a68

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

hyprscrolling/Scrolling.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ size_t SColumnData::idxForHeight(float y) {
6868
for (size_t i = 0; i < windowDatas.size(); ++i) {
6969
if (windowDatas[i]->window->m_position.y < y)
7070
continue;
71-
return i;
71+
return i - 1;
7272
}
7373
return windowDatas.size() - 1;
7474
}
@@ -1446,7 +1446,7 @@ void CScrollingLayout::moveWindowTo(PHLWINDOW w, const std::string& dir, bool si
14461446
WS->centerOrFitCol(NEWCOL);
14471447
} else {
14481448
if (COL->windowDatas.size() > 0)
1449-
COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y) - 1);
1449+
COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y));
14501450
else
14511451
COL->add(DATA);
14521452
WS->centerOrFitCol(COL);
@@ -1463,7 +1463,7 @@ void CScrollingLayout::moveWindowTo(PHLWINDOW w, const std::string& dir, bool si
14631463
WS->centerOrFitCol(NEWCOL);
14641464
} else {
14651465
if (COL->windowDatas.size() > 0)
1466-
COL->add(DATA, COL->idxForHeight(g_pInputManager->getMouseCoordsInternal().y) - 1);
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)