From 2645bbdc0598b9aaa8c6233aaf482376e7a193a2 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Wed, 24 Nov 2021 19:01:29 +0100 Subject: [PATCH] Added a hypothetical sanity check #2 --- src/windowManager.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/windowManager.cpp b/src/windowManager.cpp index cd1f1b7..1058cd5 100644 --- a/src/windowManager.cpp +++ b/src/windowManager.cpp @@ -453,6 +453,29 @@ void CWindowManager::sanityCheckOnWorkspace(int workspaceID) { Debug::log(LOG, "Sanity check A finished successfully."); } } + + // Hypothetical check #2: Check if children are present and tiled. (for nodes) + // I have not found this occurring but I have had some issues with... stuff. + if (w.getDrawable() < 0) { + const auto CHILDA = getWindowFromDrawable(w.getChildNodeAID()); + const auto CHILDB = getWindowFromDrawable(w.getChildNodeBID()); + + if (CHILDA && CHILDB) { + + if (CHILDA->getIsFloating()) { + g_pWindowManager->fixWindowOnClose(CHILDA); + g_pWindowManager->calculateNewWindowParams(CHILDA); + } + + if (CHILDB->getIsFloating()) { + g_pWindowManager->fixWindowOnClose(CHILDB); + g_pWindowManager->calculateNewWindowParams(CHILDB); + } + + } else { + Debug::log(ERR, "Malformed node ID " + std::to_string(w.getDrawable()) + " with 2 children but one or both are nullptr."); + } + } } } }