guard header windows in layout messages

This commit is contained in:
vaxerski 2022-11-03 22:55:44 +00:00
parent 748a6965ca
commit 349afa0e7a

View file

@ -544,6 +544,9 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
if (message == "swapwithmaster") { if (message == "swapwithmaster") {
const auto PWINDOW = header.pWindow; const auto PWINDOW = header.pWindow;
if (!PWINDOW)
return 0;
if (!isWindowTiled(PWINDOW)) if (!isWindowTiled(PWINDOW))
return 0; return 0;
@ -559,6 +562,10 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
return 0; return 0;
} else if (message == "focusmaster") { } else if (message == "focusmaster") {
const auto PWINDOW = header.pWindow; const auto PWINDOW = header.pWindow;
if (!PWINDOW)
return 0;
const auto PMASTER = getMasterNodeOnWorkspace(PWINDOW->m_iWorkspaceID); const auto PMASTER = getMasterNodeOnWorkspace(PWINDOW->m_iWorkspaceID);
if (!PMASTER || PMASTER->pWindow == PWINDOW) if (!PMASTER || PMASTER->pWindow == PWINDOW)
@ -570,10 +577,16 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
} else if (message == "cyclenext") { } else if (message == "cyclenext") {
const auto PWINDOW = header.pWindow; const auto PWINDOW = header.pWindow;
if (!PWINDOW)
return 0;
switchToWindow(getNextWindow(PWINDOW, true)); switchToWindow(getNextWindow(PWINDOW, true));
} else if (message == "cycleprev") { } else if (message == "cycleprev") {
const auto PWINDOW = header.pWindow; const auto PWINDOW = header.pWindow;
if (!PWINDOW)
return 0;
switchToWindow(getNextWindow(PWINDOW, false)); switchToWindow(getNextWindow(PWINDOW, false));
} else if (message == "swapnext") { } else if (message == "swapnext") {
if (!g_pCompositor->windowValidMapped(header.pWindow)) if (!g_pCompositor->windowValidMapped(header.pWindow))