From 21184404885cf61f7c10d2eb749478ef6b035dd2 Mon Sep 17 00:00:00 2001 From: davc0n Date: Mon, 28 Apr 2025 22:25:22 +0200 Subject: windows: refactor class member vars (#10168) --- src/layout/MasterLayout.cpp | 126 ++++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 63 deletions(-) (limited to 'src/layout/MasterLayout.cpp') diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index 052a6ed9..6c7f6d1a 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -78,14 +78,14 @@ SMasterNodeData* CHyprMasterLayout::getMasterNodeOnWorkspace(const WORKSPACEID& } void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection direction) { - if (pWindow->m_bIsFloating) + if (pWindow->m_isFloating) return; static auto PNEWONACTIVE = CConfigValue("master:new_on_active"); static auto PNEWONTOP = CConfigValue("master:new_on_top"); static auto PNEWSTATUS = CConfigValue("master:new_status"); - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); const bool BNEWBEFOREACTIVE = *PNEWONACTIVE == "before"; const bool BNEWISMASTER = *PNEWSTATUS == "master"; @@ -110,13 +110,13 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire static auto PMFACT = CConfigValue("master:mfact"); float lastSplitPercent = *PMFACT; - auto OPENINGON = isWindowTiled(g_pCompositor->m_lastWindow.lock()) && g_pCompositor->m_lastWindow->m_pWorkspace == pWindow->m_pWorkspace ? + auto OPENINGON = isWindowTiled(g_pCompositor->m_lastWindow.lock()) && g_pCompositor->m_lastWindow->m_workspace == pWindow->m_workspace ? getNodeFromWindow(g_pCompositor->m_lastWindow.lock()) : getMasterNodeOnWorkspace(pWindow->workspaceID()); const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal(); static auto PDROPATCURSOR = CConfigValue("master:drop_at_cursor"); - eOrientation orientation = getDynamicOrientation(pWindow->m_pWorkspace); + eOrientation orientation = getDynamicOrientation(pWindow->m_workspace); const auto NODEIT = std::find(m_lMasterNodesData.begin(), m_lMasterNodesData.end(), *PNODE); bool forceDropAsMaster = false; @@ -177,10 +177,10 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire } } - if ((BNEWISMASTER && g_pInputManager->dragMode != MBIND_MOVE) // - || WINDOWSONWORKSPACE == 1 // - || (WINDOWSONWORKSPACE > 2 && !pWindow->m_bFirstMap && OPENINGON->isMaster) // - || forceDropAsMaster // + if ((BNEWISMASTER && g_pInputManager->dragMode != MBIND_MOVE) // + || WINDOWSONWORKSPACE == 1 // + || (WINDOWSONWORKSPACE > 2 && !pWindow->m_firstMap && OPENINGON->isMaster) // + || forceDropAsMaster // || (*PNEWSTATUS == "inherit" && OPENINGON && OPENINGON->isMaster && g_pInputManager->dragMode != MBIND_MOVE)) { if (BNEWBEFOREACTIVE) { @@ -207,7 +207,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire // first, check if it isn't too big. if (const auto MAXSIZE = pWindow->requestedMaxSize(); MAXSIZE.x < PMONITOR->vecSize.x * lastSplitPercent || MAXSIZE.y < PMONITOR->vecSize.y) { // we can't continue. make it floating. - pWindow->m_bIsFloating = true; + pWindow->m_isFloating = true; m_lMasterNodesData.remove(*PNODE); g_pLayoutManager->getCurrentLayout()->onWindowCreatedFloating(pWindow); return; @@ -220,7 +220,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire if (const auto MAXSIZE = pWindow->requestedMaxSize(); MAXSIZE.x < PMONITOR->vecSize.x * (1 - lastSplitPercent) || MAXSIZE.y < PMONITOR->vecSize.y * (1.f / (WINDOWSONWORKSPACE - 1))) { // we can't continue. make it floating. - pWindow->m_bIsFloating = true; + pWindow->m_isFloating = true; m_lMasterNodesData.remove(*PNODE); g_pLayoutManager->getCurrentLayout()->onWindowCreatedFloating(pWindow); return; @@ -306,16 +306,16 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) { const auto PFULLWINDOW = pWorkspace->getFullscreenWindow(); if (pWorkspace->m_fullscreenMode == FSMODE_FULLSCREEN) { - *PFULLWINDOW->m_vRealPosition = PMONITOR->vecPosition; - *PFULLWINDOW->m_vRealSize = PMONITOR->vecSize; + *PFULLWINDOW->m_realPosition = PMONITOR->vecPosition; + *PFULLWINDOW->m_realSize = PMONITOR->vecSize; } else if (pWorkspace->m_fullscreenMode == FSMODE_MAXIMIZED) { SMasterNodeData fakeNode; fakeNode.pWindow = PFULLWINDOW; fakeNode.position = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft; fakeNode.size = PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight; fakeNode.workspaceID = pWorkspace->m_id; - PFULLWINDOW->m_vPosition = fakeNode.position; - PFULLWINDOW->m_vSize = fakeNode.size; + PFULLWINDOW->m_position = fakeNode.position; + PFULLWINDOW->m_size = fakeNode.size; fakeNode.ignoreFullscreenChecks = true; applyNodeDataToWindow(&fakeNode); @@ -644,7 +644,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { const auto PWINDOW = pNode->pWindow.lock(); // get specific gaps and rules for this workspace, // if user specified them in config - const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(PWINDOW->m_pWorkspace); + const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(PWINDOW->m_workspace); if (PWINDOW->isFullscreen() && !pNode->ignoreFullscreenChecks) return; @@ -666,13 +666,13 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { return; } - PWINDOW->m_vSize = pNode->size; - PWINDOW->m_vPosition = pNode->position; + PWINDOW->m_size = pNode->size; + PWINDOW->m_position = pNode->position; PWINDOW->updateWindowDecos(); - auto calcPos = PWINDOW->m_vPosition; - auto calcSize = PWINDOW->m_vSize; + auto calcPos = PWINDOW->m_position; + auto calcSize = PWINDOW->m_size; const auto OFFSETTOPLEFT = Vector2D((double)(DISPLAYLEFT ? gapsOut.m_left : gapsIn.m_left), (double)(DISPLAYTOP ? gapsOut.m_top : gapsIn.m_top)); @@ -691,21 +691,21 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { CBox wb = {calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f, calcSize * *PSCALEFACTOR}; wb.round(); // avoid rounding mess - *PWINDOW->m_vRealPosition = wb.pos(); - *PWINDOW->m_vRealSize = wb.size(); + *PWINDOW->m_realPosition = wb.pos(); + *PWINDOW->m_realSize = wb.size(); } else { CBox wb = {calcPos, calcSize}; wb.round(); // avoid rounding mess - *PWINDOW->m_vRealPosition = wb.pos(); - *PWINDOW->m_vRealSize = wb.size(); + *PWINDOW->m_realPosition = wb.pos(); + *PWINDOW->m_realSize = wb.size(); } if (m_bForceWarps && !*PANIMATE) { g_pHyprRenderer->damageWindow(PWINDOW); - PWINDOW->m_vRealPosition->warp(); - PWINDOW->m_vRealSize->warp(); + PWINDOW->m_realPosition->warp(); + PWINDOW->m_realSize->warp(); g_pHyprRenderer->damageWindow(PWINDOW); } @@ -726,21 +726,21 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorne const auto PNODE = getNodeFromWindow(PWINDOW); if (!PNODE) { - *PWINDOW->m_vRealSize = - (PWINDOW->m_vRealSize->goal() + pixResize) - .clamp(PWINDOW->m_sWindowData.minSize.valueOr(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), PWINDOW->m_sWindowData.maxSize.valueOr(Vector2D{INFINITY, INFINITY})); + *PWINDOW->m_realSize = + (PWINDOW->m_realSize->goal() + pixResize) + .clamp(PWINDOW->m_windowData.minSize.valueOr(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), PWINDOW->m_windowData.maxSize.valueOr(Vector2D{INFINITY, INFINITY})); PWINDOW->updateWindowDecos(); return; } - const auto PMONITOR = PWINDOW->m_pMonitor.lock(); + const auto PMONITOR = PWINDOW->m_monitor.lock(); static auto SLAVECOUNTFORCENTER = CConfigValue("master:slave_count_for_center_master"); static auto PSMARTRESIZING = CConfigValue("master:smart_resizing"); - const bool DISPLAYBOTTOM = STICKS(PWINDOW->m_vPosition.y + PWINDOW->m_vSize.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y); - const bool DISPLAYRIGHT = STICKS(PWINDOW->m_vPosition.x + PWINDOW->m_vSize.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x); - const bool DISPLAYTOP = STICKS(PWINDOW->m_vPosition.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y); - const bool DISPLAYLEFT = STICKS(PWINDOW->m_vPosition.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x); + const bool DISPLAYBOTTOM = STICKS(PWINDOW->m_position.y + PWINDOW->m_size.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y); + const bool DISPLAYRIGHT = STICKS(PWINDOW->m_position.x + PWINDOW->m_size.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x); + const bool DISPLAYTOP = STICKS(PWINDOW->m_position.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y); + const bool DISPLAYLEFT = STICKS(PWINDOW->m_position.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x); const bool LEFT = corner == CORNER_TOPLEFT || corner == CORNER_BOTTOMLEFT; const bool TOP = corner == CORNER_TOPLEFT || corner == CORNER_TOPRIGHT; @@ -750,7 +750,7 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorne const auto WINDOWS = getNodesOnWorkspace(PNODE->workspaceID); const auto STACKWINDOWS = WINDOWS - MASTERS; - eOrientation orientation = getDynamicOrientation(PWINDOW->m_pWorkspace); + eOrientation orientation = getDynamicOrientation(PWINDOW->m_workspace); bool centered = orientation == ORIENTATION_CENTER && (STACKWINDOWS >= *SLAVECOUNTFORCENTER); double delta = 0; @@ -862,15 +862,15 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorne } void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFullscreenMode CURRENT_EFFECTIVE_MODE, const eFullscreenMode EFFECTIVE_MODE) { - const auto PMONITOR = pWindow->m_pMonitor.lock(); - const auto PWORKSPACE = pWindow->m_pWorkspace; + const auto PMONITOR = pWindow->m_monitor.lock(); + const auto PWORKSPACE = pWindow->m_workspace; // save position and size if floating - if (pWindow->m_bIsFloating && CURRENT_EFFECTIVE_MODE == FSMODE_NONE) { - pWindow->m_vLastFloatingSize = pWindow->m_vRealSize->goal(); - pWindow->m_vLastFloatingPosition = pWindow->m_vRealPosition->goal(); - pWindow->m_vPosition = pWindow->m_vRealPosition->goal(); - pWindow->m_vSize = pWindow->m_vRealSize->goal(); + if (pWindow->m_isFloating && CURRENT_EFFECTIVE_MODE == FSMODE_NONE) { + pWindow->m_lastFloatingSize = pWindow->m_realSize->goal(); + pWindow->m_lastFloatingPosition = pWindow->m_realPosition->goal(); + pWindow->m_position = pWindow->m_realPosition->goal(); + pWindow->m_size = pWindow->m_realSize->goal(); } if (EFFECTIVE_MODE == FSMODE_NONE) { @@ -880,8 +880,8 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFul applyNodeDataToWindow(PNODE); else { // get back its' dimensions from position and size - *pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition; - *pWindow->m_vRealSize = pWindow->m_vLastFloatingSize; + *pWindow->m_realPosition = pWindow->m_lastFloatingPosition; + *pWindow->m_realSize = pWindow->m_lastFloatingSize; pWindow->unsetWindowData(PRIORITY_LAYOUT); pWindow->updateWindowData(); @@ -889,8 +889,8 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFul } else { // apply new pos and size being monitors' box if (EFFECTIVE_MODE == FSMODE_FULLSCREEN) { - *pWindow->m_vRealPosition = PMONITOR->vecPosition; - *pWindow->m_vRealSize = PMONITOR->vecSize; + *pWindow->m_realPosition = PMONITOR->vecPosition; + *pWindow->m_realSize = PMONITOR->vecSize; } else { // This is a massive hack. // We make a fake "only" node and apply @@ -901,8 +901,8 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFul fakeNode.position = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft; fakeNode.size = PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight; fakeNode.workspaceID = pWindow->workspaceID(); - pWindow->m_vPosition = fakeNode.position; - pWindow->m_vSize = fakeNode.size; + pWindow->m_position = fakeNode.position; + pWindow->m_size = fakeNode.size; fakeNode.ignoreFullscreenChecks = true; applyNodeDataToWindow(&fakeNode); @@ -940,13 +940,13 @@ void CHyprMasterLayout::moveWindowTo(PHLWINDOW pWindow, const std::string& dir, pWindow->setAnimationsToMove(); - if (pWindow->m_pWorkspace != PWINDOW2->m_pWorkspace) { + if (pWindow->m_workspace != PWINDOW2->m_workspace) { // if different monitors, send to monitor onWindowRemovedTiling(pWindow); - pWindow->moveToWorkspace(PWINDOW2->m_pWorkspace); - pWindow->m_pMonitor = PWINDOW2->m_pMonitor; + pWindow->moveToWorkspace(PWINDOW2->m_workspace); + pWindow->m_monitor = PWINDOW2->m_monitor; if (!silent) { - const auto pMonitor = pWindow->m_pMonitor.lock(); + const auto pMonitor = pWindow->m_monitor.lock(); g_pCompositor->setActiveMonitor(pMonitor); } onWindowCreatedTiling(pWindow); @@ -958,11 +958,11 @@ void CHyprMasterLayout::moveWindowTo(PHLWINDOW pWindow, const std::string& dir, } pWindow->updateGroupOutputs(); - if (!pWindow->m_sGroupData.pNextWindow.expired()) { - PHLWINDOW next = pWindow->m_sGroupData.pNextWindow.lock(); + if (!pWindow->m_groupData.pNextWindow.expired()) { + PHLWINDOW next = pWindow->m_groupData.pNextWindow.lock(); while (next != pWindow) { next->updateToplevel(); - next = next->m_sGroupData.pNextWindow.lock(); + next = next->m_groupData.pNextWindow.lock(); } } } @@ -977,8 +977,8 @@ void CHyprMasterLayout::switchWindows(PHLWINDOW pWindow, PHLWINDOW pWindow2) { return; if (PNODE->workspaceID != PNODE2->workspaceID) { - std::swap(pWindow2->m_pMonitor, pWindow->m_pMonitor); - std::swap(pWindow2->m_pWorkspace, pWindow->m_pWorkspace); + std::swap(pWindow2->m_monitor, pWindow->m_monitor); + std::swap(pWindow2->m_workspace, pWindow->m_workspace); } // massive hack: just swap window pointers, lol @@ -1047,8 +1047,8 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri return; if (header.pWindow->isFullscreen()) { - const auto PWORKSPACE = header.pWindow->m_pWorkspace; - const auto FSMODE = header.pWindow->m_sFullscreenState.internal; + const auto PWORKSPACE = header.pWindow->m_workspace; + const auto FSMODE = header.pWindow->m_fullscreenState.internal; static auto INHERITFULLSCREEN = CConfigValue("master:inherit_fullscreen"); g_pCompositor->setWindowFullscreenInternal(header.pWindow, FSMODE_NONE); g_pCompositor->focusWindow(PWINDOWTOCHANGETO); @@ -1167,7 +1167,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri if (!validMapped(header.pWindow)) return 0; - if (header.pWindow->m_bIsFloating) { + if (header.pWindow->m_isFloating) { g_pKeybindManager->m_mDispatchers["swapnext"](""); return 0; } @@ -1184,7 +1184,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri if (!validMapped(header.pWindow)) return 0; - if (header.pWindow->m_bIsFloating) { + if (header.pWindow->m_isFloating) { g_pKeybindManager->m_mDispatchers["swapnext"]("prev"); return 0; } @@ -1201,7 +1201,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri if (!validMapped(header.pWindow)) return 0; - if (header.pWindow->m_bIsFloating) + if (header.pWindow->m_isFloating) return 0; const auto PNODE = getNodeFromWindow(header.pWindow); @@ -1234,7 +1234,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri if (!validMapped(header.pWindow)) return 0; - if (header.pWindow->m_bIsFloating) + if (header.pWindow->m_isFloating) return 0; const auto PNODE = getNodeFromWindow(header.pWindow); @@ -1469,7 +1469,7 @@ Vector2D CHyprMasterLayout::predictSizeForNewWindowTiled() { void CHyprMasterLayout::onEnable() { for (auto const& w : g_pCompositor->m_windows) { - if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden()) + if (w->m_isFloating || !w->m_isMapped || w->isHidden()) continue; onWindowCreatedTiling(w); -- cgit v1.2.3