diff options
author | vaxerski <[email protected]> | 2022-11-20 11:54:51 +0000 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-11-20 11:55:50 +0000 |
commit | f8b91383835bd2cfc03ad5e2337f3a25332f7cb4 (patch) | |
tree | b80d45aa3fc7937486854f41751e9a9ee62a58ef | |
parent | c03e4c36b0796e5ab49768e28183a4aecb257bb5 (diff) | |
download | Hyprland-f8b91383835bd2cfc03ad5e2337f3a25332f7cb4.tar.gz Hyprland-f8b91383835bd2cfc03ad5e2337f3a25332f7cb4.zip |
make focus/swap master layoutmsgs two-way
-rw-r--r-- | src/layout/MasterLayout.cpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index e4f29cfc..6132c656 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -590,8 +590,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri return; g_pCompositor->focusWindow(PWINDOWTOCHANGETO); - Vector2D middle = PWINDOWTOCHANGETO->m_vRealPosition.goalv() + PWINDOWTOCHANGETO->m_vRealSize.goalv() / 2.f; - wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, middle.x, middle.y); + g_pCompositor->warpCursorTo(PWINDOWTOCHANGETO->m_vRealPosition.goalv() + PWINDOWTOCHANGETO->m_vRealSize.goalv() / 2.f); }; if (message == "swapwithmaster") { @@ -605,12 +604,21 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri const auto PMASTER = getMasterNodeOnWorkspace(PWINDOW->m_iWorkspaceID); - if (!PMASTER || PMASTER->pWindow == PWINDOW) + if (!PMASTER) return 0; - switchWindows(PWINDOW, PMASTER->pWindow); - - switchToWindow(PWINDOW); + if (PMASTER->pWindow != PWINDOW) { + switchWindows(PWINDOW, PMASTER->pWindow); + switchToWindow(PWINDOW); + } else { + for (auto& n : m_lMasterNodesData) { + if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) { + switchWindows(n.pWindow, PMASTER->pWindow); + switchToWindow(n.pWindow); + break; + } + } + } return 0; } else if (message == "focusmaster") { @@ -621,10 +629,19 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri const auto PMASTER = getMasterNodeOnWorkspace(PWINDOW->m_iWorkspaceID); - if (!PMASTER || PMASTER->pWindow == PWINDOW) + if (!PMASTER) return 0; - switchToWindow(PMASTER->pWindow); + if (PMASTER->pWindow != PWINDOW) + switchToWindow(PMASTER->pWindow); + else { + for (auto& n : m_lMasterNodesData) { + if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) { + switchToWindow(n.pWindow); + break; + } + } + } return 0; } else if (message == "cyclenext") { |