Skip to content

Commit a5a6f93

Browse files
committed
scrolling: implement swapWindow
fixes #511
1 parent bff3b23 commit a5a6f93

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

hyprscrolling/Scrolling.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,8 +1351,8 @@ std::any CScrollingLayout::layoutMessage(SLayoutMessageHeader header, std::strin
13511351

13521352
fitMethod = toggled;
13531353

1354-
const auto focusedData = dataFor(g_pCompositor->m_lastWindow.lock());
1355-
static const auto PFSONONE = CConfigValue<Hyprlang::INT>("plugin:hyprscrolling:fullscreen_on_one_column");
1354+
const auto focusedData = dataFor(g_pCompositor->m_lastWindow.lock());
1355+
static const auto PFSONONE = CConfigValue<Hyprlang::INT>("plugin:hyprscrolling:fullscreen_on_one_column");
13561356

13571357
for (const auto& ws : m_workspaceDatas) {
13581358
if (!ws || ws->columns.empty())
@@ -1413,7 +1413,20 @@ SWindowRenderLayoutHints CScrollingLayout::requestRenderHints(PHLWINDOW a) {
14131413
}
14141414

14151415
void CScrollingLayout::switchWindows(PHLWINDOW a, PHLWINDOW b) {
1416-
;
1416+
const auto DATA1 = dataFor(a);
1417+
const auto DATA2 = dataFor(b);
1418+
1419+
std::swap(DATA1->window, DATA2->window);
1420+
1421+
const auto WS1 = DATA1->column->workspace.lock();
1422+
const auto WS2 = DATA2->column->workspace.lock();
1423+
1424+
WS1->recalculate();
1425+
1426+
if (WS1 == WS2)
1427+
return;
1428+
1429+
WS2->recalculate();
14171430
}
14181431

14191432
void CScrollingLayout::moveWindowTo(PHLWINDOW w, const std::string& dir, bool silent) {

0 commit comments

Comments
 (0)