Hyprscrolling: fix layoutmsg fit visible incorrectly include window at the border (#487)

This commit is contained in:
Ralph Zhou 2025-09-24 02:00:29 +08:00 committed by GitHub
parent 1cfcc6fe6a
commit 1e3fa62428
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -329,9 +329,13 @@ bool SWorkspaceData::visible(SP<SColumnData> c) {
const auto USABLE = layout->usableAreaFor(workspace->m_monitor.lock());
float totalLeft = 0;
for (const auto& col : columns) {
if (col == c)
return (totalLeft >= leftOffset && totalLeft < leftOffset + USABLE.w) ||
(totalLeft + col->columnWidth * USABLE.w >= leftOffset && totalLeft + col->columnWidth * USABLE.w < leftOffset + USABLE.w);
if (col == c) {
const float colLeft = totalLeft;
const float colRight = totalLeft + col->columnWidth * USABLE.w;
const float viewLeft = leftOffset;
const float viewRight = leftOffset + USABLE.w;
return colLeft < viewRight && viewLeft < colRight;
}
totalLeft += col->columnWidth * USABLE.w;
}

View File

@ -58,7 +58,7 @@ struct SWorkspaceData {
PHLWORKSPACEREF workspace;
std::vector<SP<SColumnData>> columns;
int leftOffset = 0;
float leftOffset = 0;
SP<SColumnData> add();
SP<SColumnData> add(int after);