mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 20:05:58 +01:00
make focus/swap master layoutmsgs two-way
This commit is contained in:
parent
c03e4c36b0
commit
f8b9138383
1 changed files with 25 additions and 8 deletions
|
@ -590,8 +590,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pCompositor->focusWindow(PWINDOWTOCHANGETO);
|
g_pCompositor->focusWindow(PWINDOWTOCHANGETO);
|
||||||
Vector2D middle = PWINDOWTOCHANGETO->m_vRealPosition.goalv() + PWINDOWTOCHANGETO->m_vRealSize.goalv() / 2.f;
|
g_pCompositor->warpCursorTo(PWINDOWTOCHANGETO->m_vRealPosition.goalv() + PWINDOWTOCHANGETO->m_vRealSize.goalv() / 2.f);
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, middle.x, middle.y);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (message == "swapwithmaster") {
|
if (message == "swapwithmaster") {
|
||||||
|
@ -605,12 +604,21 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
|
|
||||||
const auto PMASTER = getMasterNodeOnWorkspace(PWINDOW->m_iWorkspaceID);
|
const auto PMASTER = getMasterNodeOnWorkspace(PWINDOW->m_iWorkspaceID);
|
||||||
|
|
||||||
if (!PMASTER || PMASTER->pWindow == PWINDOW)
|
if (!PMASTER)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switchWindows(PWINDOW, PMASTER->pWindow);
|
if (PMASTER->pWindow != PWINDOW) {
|
||||||
|
switchWindows(PWINDOW, PMASTER->pWindow);
|
||||||
switchToWindow(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;
|
return 0;
|
||||||
} else if (message == "focusmaster") {
|
} else if (message == "focusmaster") {
|
||||||
|
@ -621,10 +629,19 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
|
|
||||||
const auto PMASTER = getMasterNodeOnWorkspace(PWINDOW->m_iWorkspaceID);
|
const auto PMASTER = getMasterNodeOnWorkspace(PWINDOW->m_iWorkspaceID);
|
||||||
|
|
||||||
if (!PMASTER || PMASTER->pWindow == PWINDOW)
|
if (!PMASTER)
|
||||||
return 0;
|
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;
|
return 0;
|
||||||
} else if (message == "cyclenext") {
|
} else if (message == "cyclenext") {
|
||||||
|
|
Loading…
Reference in a new issue