core: workspace-related function cleanup / refactor

CCompositor is massive, and has a lot of functions that could be better optimized if in CWorkspace
This commit is contained in:
Vaxry
2024-11-22 16:01:02 +00:00
parent a847bc67b1
commit 745a82ce8a
19 changed files with 267 additions and 260 deletions

View File

@@ -514,7 +514,7 @@ void CHyprDwindleLayout::calculateWorkspace(const PHLWORKSPACE& pWorkspace) {
if (pWorkspace->m_bHasFullscreenWindow) {
// massive hack from the fullscreen func
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(pWorkspace->m_iID);
const auto PFULLWINDOW = pWorkspace->getFullscreenWindow();
if (pWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN) {
PFULLWINDOW->m_vRealPosition = PMONITOR->vecPosition;
@@ -1054,7 +1054,7 @@ void CHyprDwindleLayout::moveToRoot(PHLWINDOW pWindow, bool stable) {
std::swap(pRoot->children[0], pRoot->children[1]);
// if the workspace is visible, recalculate layout
if (g_pCompositor->isWorkspaceVisible(pWindow->m_pWorkspace))
if (pWindow->m_pWorkspace && pWindow->m_pWorkspace->isVisible())
pRoot->recalcSizePosRecursive();
}
@@ -1094,7 +1094,7 @@ Vector2D CHyprDwindleLayout::predictSizeForNewWindowTiled() {
PHLWINDOW candidate = g_pCompositor->m_pLastWindow.lock();
if (!candidate)
candidate = g_pCompositor->getFirstWindowOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspace->m_iID);
candidate = g_pCompositor->m_pLastMonitor->activeWorkspace->getFirstWindow();
// create a fake node
SDwindleNodeData node;