diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 8e50019e7..9d8bb62e1 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1019,7 +1019,7 @@ SP CCompositor::vectorWindowToSurface(const Vector2D& pos, P if (PPOPUP) { const auto OFF = PPOPUP->coordsRelativeToParent(); sl = pos - pWindow->m_vRealPosition->goal() - OFF; - return PPOPUP->m_pWLSurface->resource(); + return PPOPUP->m_wlSurface->resource(); } auto [surf, local] = pWindow->m_pWLSurface->resource()->at(pos - pWindow->m_vRealPosition->goal(), true); @@ -1270,15 +1270,15 @@ void CCompositor::focusSurface(SP pSurface, PHLWINDOW pWindo SP CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, PHLMONITOR monitor, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) { for (auto const& lsl : monitor->m_aLayerSurfaceLayers | std::views::reverse) { for (auto const& ls : lsl | std::views::reverse) { - if (!ls->mapped || ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->mapped) || ls->alpha->value() == 0.f) + if (!ls->m_mapped || ls->m_fadingOut || !ls->m_layerSurface || (ls->m_layerSurface && !ls->m_layerSurface->mapped) || ls->m_alpha->value() == 0.f) continue; - auto SURFACEAT = ls->popupHead->at(pos, true); + auto SURFACEAT = ls->m_popupHead->at(pos, true); if (SURFACEAT) { *ppLayerSurfaceFound = ls.lock(); *sCoords = pos - SURFACEAT->coordsGlobal(); - return SURFACEAT->m_pWLSurface->resource(); + return SURFACEAT->m_wlSurface->resource(); } } } @@ -1288,10 +1288,10 @@ SP CCompositor::vectorToLayerPopupSurface(const Vector2D& po SP CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector* layerSurfaces, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) { for (auto const& ls : *layerSurfaces | std::views::reverse) { - if (!ls->mapped || ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->surface->mapped) || ls->alpha->value() == 0.f) + if (!ls->m_mapped || ls->m_fadingOut || !ls->m_layerSurface || (ls->m_layerSurface && !ls->m_layerSurface->surface->mapped) || ls->m_alpha->value() == 0.f) continue; - auto [surf, local] = ls->layerSurface->surface->at(pos - ls->geometry.pos(), true); + auto [surf, local] = ls->m_layerSurface->surface->at(pos - ls->m_geometry.pos(), true); if (surf) { if (surf->current.input.empty()) @@ -1463,14 +1463,14 @@ void CCompositor::cleanupFadingOut(const MONITORID& monid) { continue; } - if (ls->monitorID() != monid && ls->monitor) + if (ls->monitorID() != monid && ls->m_monitor) continue; // mark blur for recalc - if (ls->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || ls->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) + if (ls->m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || ls->m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) g_pHyprOpenGL->markBlurDirtyForMonitor(getMonitorFromID(monid)); - if (ls->fadingOut && ls->readyToDelete && ls->isFadedOut()) { + if (ls->m_fadingOut && ls->m_readyToDelete && ls->isFadedOut()) { for (auto const& m : m_monitors) { for (auto& lsl : m->m_aLayerSurfaceLayers) { if (!lsl.empty() && std::ranges::find_if(lsl, [&](auto& other) { return other == ls; }) != lsl.end()) { @@ -2273,8 +2273,8 @@ void CCompositor::updateFullscreenFadeOnWorkspace(PHLWORKSPACE pWorkspace) { if (pWorkspace->m_iID == PMONITOR->activeWorkspaceID() || pWorkspace->m_iID == PMONITOR->activeSpecialWorkspaceID()) { for (auto const& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { - if (!ls->fadingOut) - *ls->alpha = FULLSCREEN && pWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f; + if (!ls->m_fadingOut) + *ls->m_alpha = FULLSCREEN && pWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f; } } } @@ -2554,13 +2554,13 @@ PHLLS CCompositor::getLayerSurfaceFromSurface(SP pSurface) { std::pair, bool> result = {pSurface, false}; for (auto const& ls : m_layers) { - if (ls->layerSurface && ls->layerSurface->surface == pSurface) + if (ls->m_layerSurface && ls->m_layerSurface->surface == pSurface) return ls; - if (!ls->layerSurface || !ls->mapped) + if (!ls->m_layerSurface || !ls->m_mapped) continue; - ls->layerSurface->surface->breadthfirst( + ls->m_layerSurface->surface->breadthfirst( [&result](SP surf, const Vector2D& offset, void* data) { if (surf == result.first) { result.second = true; diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index f609eeb41..3ead5c5b6 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1530,22 +1530,22 @@ std::vector> CConfigManager::getMatchingRules(PHLWINDOW pWindow, std::vector> CConfigManager::getMatchingRules(PHLLS pLS) { std::vector> returns; - if (!pLS->layerSurface || pLS->fadingOut) + if (!pLS->m_layerSurface || pLS->m_fadingOut) return returns; for (auto const& lr : m_layerRules) { - if (lr->targetNamespace.starts_with("address:0x")) { - if (std::format("address:0x{:x}", (uintptr_t)pLS.get()) != lr->targetNamespace) + if (lr->m_targetNamespace.starts_with("address:0x")) { + if (std::format("address:0x{:x}", (uintptr_t)pLS.get()) != lr->m_targetNamespace) continue; - } else if (!lr->targetNamespaceRegex.passes(pLS->layerSurface->layerNamespace)) + } else if (!lr->m_targetNamespaceRegex.passes(pLS->m_layerSurface->layerNamespace)) continue; // hit returns.emplace_back(lr); } - if (shouldBlurLS(pLS->layerSurface->layerNamespace)) - returns.emplace_back(makeShared(pLS->layerSurface->layerNamespace, "blur")); + if (shouldBlurLS(pLS->m_layerSurface->layerNamespace)) + returns.emplace_back(makeShared(pLS->m_layerSurface->layerNamespace, "blur")); return returns; } @@ -2626,18 +2626,18 @@ std::optional CConfigManager::handleLayerRule(const std::string& co return "empty rule?"; if (RULE == "unset") { - std::erase_if(m_layerRules, [&](const auto& other) { return other->targetNamespace == VALUE; }); + std::erase_if(m_layerRules, [&](const auto& other) { return other->m_targetNamespace == VALUE; }); return {}; } auto rule = makeShared(RULE, VALUE); - if (rule->ruleType == CLayerRule::RULE_INVALID) { + if (rule->m_ruleType == CLayerRule::RULE_INVALID) { Debug::log(ERR, "Invalid rule found: {}", RULE); return "Invalid rule found: " + RULE; } - rule->targetNamespaceRegex = {VALUE}; + rule->m_targetNamespaceRegex = {VALUE}; m_layerRules.emplace_back(rule); @@ -2661,9 +2661,9 @@ void CConfigManager::updateBlurredLS(const std::string& name, const bool forceBl for (auto const& ls : lsl) { if (BYADDRESS) { if (std::format("0x{:x}", (uintptr_t)ls.get()) == matchName) - ls->forceBlur = forceBlur; - } else if (ls->szNamespace == matchName) - ls->forceBlur = forceBlur; + ls->m_forceBlur = forceBlur; + } else if (ls->m_namespace == matchName) + ls->m_forceBlur = forceBlur; } } } diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 1c485c151..72dde67f7 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -487,7 +487,7 @@ static std::string layersRequest(eHyprCtlOutputFormat format, std::string reques "namespace": "{}", "pid": {} }},)#", - (uintptr_t)layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width, layer->geometry.height, escapeJSONStrings(layer->szNamespace), + (uintptr_t)layer.get(), layer->m_geometry.x, layer->m_geometry.y, layer->m_geometry.width, layer->m_geometry.height, escapeJSONStrings(layer->m_namespace), layer->getPID()); } @@ -519,8 +519,8 @@ static std::string layersRequest(eHyprCtlOutputFormat format, std::string reques result += std::format("\tLayer level {} ({}):\n", layerLevel, levelNames[layerLevel]); for (auto const& layer : level) { - result += std::format("\t\tLayer {:x}: xywh: {} {} {} {}, namespace: {}, pid: {}\n", (uintptr_t)layer.get(), layer->geometry.x, layer->geometry.y, - layer->geometry.width, layer->geometry.height, layer->szNamespace, layer->getPID()); + result += std::format("\t\tLayer {:x}: xywh: {} {} {} {}, namespace: {}, pid: {}\n", (uintptr_t)layer.get(), layer->m_geometry.x, layer->m_geometry.y, + layer->m_geometry.width, layer->m_geometry.height, layer->m_namespace, layer->getPID()); } layerLevel++; diff --git a/src/desktop/LayerRule.cpp b/src/desktop/LayerRule.cpp index 791a557e4..c03d89685 100644 --- a/src/desktop/LayerRule.cpp +++ b/src/desktop/LayerRule.cpp @@ -7,32 +7,32 @@ static const auto RULES = std::unordered_set{"noanim", "blur", "blurpopups", "dimaround"}; static const auto RULES_PREFIX = std::unordered_set{"ignorealpha", "ignorezero", "xray", "animation", "order"}; -CLayerRule::CLayerRule(const std::string& rule_, const std::string& ns_) : targetNamespace(ns_), rule(rule_) { - const bool VALID = RULES.contains(rule) || std::any_of(RULES_PREFIX.begin(), RULES_PREFIX.end(), [&rule_](const auto& prefix) { return rule_.starts_with(prefix); }); +CLayerRule::CLayerRule(const std::string& rule_, const std::string& ns_) : m_targetNamespace(ns_), m_rule(rule_) { + const bool VALID = RULES.contains(m_rule) || std::any_of(RULES_PREFIX.begin(), RULES_PREFIX.end(), [&rule_](const auto& prefix) { return rule_.starts_with(prefix); }); if (!VALID) return; - if (rule == "noanim") - ruleType = RULE_NOANIM; - else if (rule == "blur") - ruleType = RULE_BLUR; - else if (rule == "blurpopups") - ruleType = RULE_BLURPOPUPS; - else if (rule == "dimaround") - ruleType = RULE_DIMAROUND; - else if (rule.starts_with("ignorealpha")) - ruleType = RULE_IGNOREALPHA; - else if (rule.starts_with("ignorezero")) - ruleType = RULE_IGNOREZERO; - else if (rule.starts_with("xray")) - ruleType = RULE_XRAY; - else if (rule.starts_with("animation")) - ruleType = RULE_ANIMATION; - else if (rule.starts_with("order")) - ruleType = RULE_ORDER; + if (m_rule == "noanim") + m_ruleType = RULE_NOANIM; + else if (m_rule == "blur") + m_ruleType = RULE_BLUR; + else if (m_rule == "blurpopups") + m_ruleType = RULE_BLURPOPUPS; + else if (m_rule == "dimaround") + m_ruleType = RULE_DIMAROUND; + else if (m_rule.starts_with("ignorealpha")) + m_ruleType = RULE_IGNOREALPHA; + else if (m_rule.starts_with("ignorezero")) + m_ruleType = RULE_IGNOREZERO; + else if (m_rule.starts_with("xray")) + m_ruleType = RULE_XRAY; + else if (m_rule.starts_with("animation")) + m_ruleType = RULE_ANIMATION; + else if (m_rule.starts_with("order")) + m_ruleType = RULE_ORDER; else { Debug::log(ERR, "CLayerRule: didn't match a rule that was found valid?!"); - ruleType = RULE_INVALID; + m_ruleType = RULE_INVALID; } } \ No newline at end of file diff --git a/src/desktop/LayerRule.hpp b/src/desktop/LayerRule.hpp index 8cdb332e1..46f843a62 100644 --- a/src/desktop/LayerRule.hpp +++ b/src/desktop/LayerRule.hpp @@ -22,10 +22,10 @@ class CLayerRule { RULE_ZUMBA, }; - eRuleType ruleType = RULE_INVALID; + eRuleType m_ruleType = RULE_INVALID; - const std::string targetNamespace; - const std::string rule; + const std::string m_targetNamespace; + const std::string m_rule; - CRuleRegexContainer targetNamespaceRegex; + CRuleRegexContainer m_targetNamespaceRegex; }; \ No newline at end of file diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp index c80811431..d8ba5f21a 100644 --- a/src/desktop/LayerSurface.cpp +++ b/src/desktop/LayerSurface.cpp @@ -17,7 +17,7 @@ PHLLS CLayerSurface::create(SP resource) { auto pMonitor = resource->monitor.empty() ? g_pCompositor->m_lastMonitor.lock() : g_pCompositor->getMonitorFromName(resource->monitor); - pLS->surface->assign(resource->surface.lock(), pLS); + pLS->m_surface->assign(resource->surface.lock(), pLS); if (!pMonitor) { Debug::log(ERR, "New LS has no monitor??"); @@ -27,54 +27,54 @@ PHLLS CLayerSurface::create(SP resource) { if (pMonitor->pMirrorOf) pMonitor = g_pCompositor->m_monitors.front(); - pLS->self = pLS; + pLS->m_self = pLS; - pLS->szNamespace = resource->layerNamespace; + pLS->m_namespace = resource->layerNamespace; - pLS->layer = resource->current.layer; - pLS->popupHead = CPopup::create(pLS); - pLS->monitor = pMonitor; + pLS->m_layer = resource->current.layer; + pLS->m_popupHead = CPopup::create(pLS); + pLS->m_monitor = pMonitor; pMonitor->m_aLayerSurfaceLayers[resource->current.layer].emplace_back(pLS); - pLS->forceBlur = g_pConfigManager->shouldBlurLS(pLS->szNamespace); + pLS->m_forceBlur = g_pConfigManager->shouldBlurLS(pLS->m_namespace); - g_pAnimationManager->createAnimation(0.f, pLS->alpha, g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn"), pLS, AVARDAMAGE_ENTIRE); - g_pAnimationManager->createAnimation(Vector2D(0, 0), pLS->realPosition, g_pConfigManager->getAnimationPropertyConfig("layersIn"), pLS, AVARDAMAGE_ENTIRE); - g_pAnimationManager->createAnimation(Vector2D(0, 0), pLS->realSize, g_pConfigManager->getAnimationPropertyConfig("layersIn"), pLS, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(0.f, pLS->m_alpha, g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn"), pLS, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(Vector2D(0, 0), pLS->m_realPosition, g_pConfigManager->getAnimationPropertyConfig("layersIn"), pLS, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(Vector2D(0, 0), pLS->m_realSize, g_pConfigManager->getAnimationPropertyConfig("layersIn"), pLS, AVARDAMAGE_ENTIRE); pLS->registerCallbacks(); - pLS->alpha->setValueAndWarp(0.f); + pLS->m_alpha->setValueAndWarp(0.f); - Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)resource.get(), resource->layerNamespace, (int)pLS->layer, pMonitor->szName); + Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)resource.get(), resource->layerNamespace, (int)pLS->m_layer, pMonitor->szName); return pLS; } void CLayerSurface::registerCallbacks() { - alpha->setUpdateCallback([this](auto) { - if (dimAround) - g_pHyprRenderer->damageMonitor(monitor.lock()); + m_alpha->setUpdateCallback([this](auto) { + if (m_dimAround) + g_pHyprRenderer->damageMonitor(m_monitor.lock()); }); } -CLayerSurface::CLayerSurface(SP resource_) : layerSurface(resource_) { - listeners.commit = layerSurface->events.commit.registerListener([this](std::any d) { onCommit(); }); - listeners.map = layerSurface->events.map.registerListener([this](std::any d) { onMap(); }); - listeners.unmap = layerSurface->events.unmap.registerListener([this](std::any d) { onUnmap(); }); - listeners.destroy = layerSurface->events.destroy.registerListener([this](std::any d) { onDestroy(); }); +CLayerSurface::CLayerSurface(SP resource_) : m_layerSurface(resource_) { + m_listeners.commit = m_layerSurface->events.commit.registerListener([this](std::any d) { onCommit(); }); + m_listeners.map = m_layerSurface->events.map.registerListener([this](std::any d) { onMap(); }); + m_listeners.unmap = m_layerSurface->events.unmap.registerListener([this](std::any d) { onUnmap(); }); + m_listeners.destroy = m_layerSurface->events.destroy.registerListener([this](std::any d) { onDestroy(); }); - surface = CWLSurface::create(); + m_surface = CWLSurface::create(); } CLayerSurface::~CLayerSurface() { if (!g_pHyprOpenGL) return; - if (surface) - surface->unassign(); + if (m_surface) + m_surface->unassign(); g_pHyprRenderer->makeEGLCurrent(); - std::erase_if(g_pHyprOpenGL->m_mLayerFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.lock() == self.lock(); }); + std::erase_if(g_pHyprOpenGL->m_mLayerFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.lock() == m_self.lock(); }); for (auto const& mon : g_pCompositor->m_realMonitors) { for (auto& lsl : mon->m_aLayerSurfaceLayers) { @@ -84,29 +84,29 @@ CLayerSurface::~CLayerSurface() { } void CLayerSurface::onDestroy() { - Debug::log(LOG, "LayerSurface {:x} destroyed", (uintptr_t)layerSurface.get()); + Debug::log(LOG, "LayerSurface {:x} destroyed", (uintptr_t)m_layerSurface.get()); - const auto PMONITOR = monitor.lock(); + const auto PMONITOR = m_monitor.lock(); if (!PMONITOR) Debug::log(WARN, "Layersurface destroyed on an invalid monitor (removed?)"); - if (!fadingOut) { - if (mapped) { + if (!m_fadingOut) { + if (m_mapped) { Debug::log(LOG, "Forcing an unmap of a LS that did a straight destroy!"); onUnmap(); } else { Debug::log(LOG, "Removing LayerSurface that wasn't mapped."); - if (alpha) - alpha->setValueAndWarp(0.f); - fadingOut = true; - g_pCompositor->addToFadingOutSafe(self.lock()); + if (m_alpha) + m_alpha->setValueAndWarp(0.f); + m_fadingOut = true; + g_pCompositor->addToFadingOutSafe(m_self.lock()); } } - popupHead.reset(); + m_popupHead.reset(); - noProcess = true; + m_noProcess = true; // rearrange to fix the reserved areas if (PMONITOR) { @@ -114,35 +114,35 @@ void CLayerSurface::onDestroy() { PMONITOR->scheduledRecalc = true; // and damage - CBox geomFixed = {geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y, geometry.width, geometry.height}; + CBox geomFixed = {m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y, m_geometry.width, m_geometry.height}; g_pHyprRenderer->damageBox(geomFixed); } - readyToDelete = true; - layerSurface.reset(); - if (surface) - surface->unassign(); + m_readyToDelete = true; + m_layerSurface.reset(); + if (m_surface) + m_surface->unassign(); - listeners.unmap.reset(); - listeners.destroy.reset(); - listeners.map.reset(); - listeners.commit.reset(); + m_listeners.unmap.reset(); + m_listeners.destroy.reset(); + m_listeners.map.reset(); + m_listeners.commit.reset(); } void CLayerSurface::onMap() { - Debug::log(LOG, "LayerSurface {:x} mapped", (uintptr_t)layerSurface.get()); + Debug::log(LOG, "LayerSurface {:x} mapped", (uintptr_t)m_layerSurface.get()); - mapped = true; - interactivity = layerSurface->current.interactivity; + m_mapped = true; + m_interactivity = m_layerSurface->current.interactivity; - layerSurface->surface->map(); + m_layerSurface->surface->map(); // this layer might be re-mapped. - fadingOut = false; - g_pCompositor->removeFromFadingOutSafe(self.lock()); + m_fadingOut = false; + g_pCompositor->removeFromFadingOutSafe(m_self.lock()); // fix if it changed its mon - const auto PMONITOR = monitor.lock(); + const auto PMONITOR = m_monitor.lock(); if (!PMONITOR) return; @@ -153,15 +153,15 @@ void CLayerSurface::onMap() { g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID); - surface->resource()->enter(PMONITOR->self.lock()); + m_surface->resource()->enter(PMONITOR->self.lock()); - const bool ISEXCLUSIVE = layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE; + const bool ISEXCLUSIVE = m_layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE; if (ISEXCLUSIVE) - g_pInputManager->m_dExclusiveLSes.push_back(self); + g_pInputManager->m_dExclusiveLSes.push_back(m_self); const bool GRABSFOCUS = ISEXCLUSIVE || - (layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE && + (m_layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE && // don't focus if constrained (g_pSeatManager->mouse.expired() || !g_pInputManager->isConstrained())); @@ -169,69 +169,69 @@ void CLayerSurface::onMap() { // TODO: use the new superb really very cool grab g_pSeatManager->setGrab(nullptr); g_pInputManager->releaseAllMouseButtons(); - g_pCompositor->focusSurface(surface->resource()); + g_pCompositor->focusSurface(m_surface->resource()); - const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y); - g_pSeatManager->setPointerFocus(surface->resource(), LOCAL); + const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y); + g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL); g_pInputManager->m_bEmptyFocusCursorSet = false; } - position = Vector2D(geometry.x, geometry.y); + m_position = Vector2D(m_geometry.x, m_geometry.y); - CBox geomFixed = {geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y, geometry.width, geometry.height}; + CBox geomFixed = {m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y, m_geometry.width, m_geometry.height}; g_pHyprRenderer->damageBox(geomFixed); const bool FULLSCREEN = PMONITOR->activeWorkspace && PMONITOR->activeWorkspace->m_bHasFullscreenWindow && PMONITOR->activeWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN; - startAnimation(!(layer == ZWLR_LAYER_SHELL_V1_LAYER_TOP && FULLSCREEN && !GRABSFOCUS)); - readyToDelete = false; - fadingOut = false; + startAnimation(!(m_layer == ZWLR_LAYER_SHELL_V1_LAYER_TOP && FULLSCREEN && !GRABSFOCUS)); + m_readyToDelete = false; + m_fadingOut = false; - g_pEventManager->postEvent(SHyprIPCEvent{"openlayer", szNamespace}); - EMIT_HOOK_EVENT("openLayer", self.lock()); + g_pEventManager->postEvent(SHyprIPCEvent{"openlayer", m_namespace}); + EMIT_HOOK_EVENT("openLayer", m_self.lock()); - g_pCompositor->setPreferredScaleForSurface(surface->resource(), PMONITOR->scale); - g_pCompositor->setPreferredTransformForSurface(surface->resource(), PMONITOR->transform); + g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->scale); + g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->transform); } void CLayerSurface::onUnmap() { - Debug::log(LOG, "LayerSurface {:x} unmapped", (uintptr_t)layerSurface.get()); + Debug::log(LOG, "LayerSurface {:x} unmapped", (uintptr_t)m_layerSurface.get()); - g_pEventManager->postEvent(SHyprIPCEvent{"closelayer", layerSurface->layerNamespace}); - EMIT_HOOK_EVENT("closeLayer", self.lock()); + g_pEventManager->postEvent(SHyprIPCEvent{"closelayer", m_layerSurface->layerNamespace}); + EMIT_HOOK_EVENT("closeLayer", m_self.lock()); - std::erase_if(g_pInputManager->m_dExclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == self.lock(); }); + std::erase_if(g_pInputManager->m_dExclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == m_self.lock(); }); - if (!monitor || g_pCompositor->m_unsafeState) { + if (!m_monitor || g_pCompositor->m_unsafeState) { Debug::log(WARN, "Layersurface unmapping on invalid monitor (removed?) ignoring."); - g_pCompositor->addToFadingOutSafe(self.lock()); + g_pCompositor->addToFadingOutSafe(m_self.lock()); - mapped = false; - if (layerSurface && layerSurface->surface) - layerSurface->surface->unmap(); + m_mapped = false; + if (m_layerSurface && m_layerSurface->surface) + m_layerSurface->surface->unmap(); startAnimation(false); return; } // end any pending animations so that snapshot has right dimensions - realPosition->warp(); - realSize->warp(); + m_realPosition->warp(); + m_realSize->warp(); // make a snapshot and start fade - g_pHyprRenderer->makeLayerSnapshot(self.lock()); + g_pHyprRenderer->makeLayerSnapshot(m_self.lock()); startAnimation(false); - mapped = false; - if (layerSurface && layerSurface->surface) - layerSurface->surface->unmap(); + m_mapped = false; + if (m_layerSurface && m_layerSurface->surface) + m_layerSurface->surface->unmap(); - g_pCompositor->addToFadingOutSafe(self.lock()); + g_pCompositor->addToFadingOutSafe(m_self.lock()); - const auto PMONITOR = monitor.lock(); + const auto PMONITOR = m_monitor.lock(); - const bool WASLASTFOCUS = g_pSeatManager->state.keyboardFocus == surface->resource() || g_pSeatManager->state.pointerFocus == surface->resource(); + const bool WASLASTFOCUS = g_pSeatManager->state.keyboardFocus == m_surface->resource() || g_pSeatManager->state.pointerFocus == m_surface->resource(); if (!PMONITOR) return; @@ -241,14 +241,14 @@ void CLayerSurface::onUnmap() { if (WASLASTFOCUS || (g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus->hlSurface && !g_pCompositor->m_lastFocus->hlSurface->keyboardFocusable())) { if (!g_pInputManager->refocusLastWindow(PMONITOR)) g_pInputManager->refocus(); - } else if (g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus != surface->resource()) + } else if (g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus != m_surface->resource()) g_pSeatManager->setKeyboardFocus(g_pCompositor->m_lastFocus.lock()); - CBox geomFixed = {geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y, geometry.width, geometry.height}; + CBox geomFixed = {m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y, m_geometry.width, m_geometry.height}; g_pHyprRenderer->damageBox(geomFixed); - geomFixed = {geometry.x + (int)PMONITOR->vecPosition.x, geometry.y + (int)PMONITOR->vecPosition.y, (int)layerSurface->surface->current.size.x, - (int)layerSurface->surface->current.size.y}; + geomFixed = {m_geometry.x + (int)PMONITOR->vecPosition.x, m_geometry.y + (int)PMONITOR->vecPosition.y, (int)m_layerSurface->surface->current.size.x, + (int)m_layerSurface->surface->current.size.y}; g_pHyprRenderer->damageBox(geomFixed); g_pInputManager->simulateMouseMovement(); @@ -257,47 +257,47 @@ void CLayerSurface::onUnmap() { } void CLayerSurface::onCommit() { - if (!layerSurface) + if (!m_layerSurface) return; - if (!mapped) { + if (!m_mapped) { // we're re-mapping if this is the case - if (layerSurface->surface && !layerSurface->surface->current.texture) { - fadingOut = false; - geometry = {}; + if (m_layerSurface->surface && !m_layerSurface->surface->current.texture) { + m_fadingOut = false; + m_geometry = {}; g_pHyprRenderer->arrangeLayersForMonitor(monitorID()); } return; } - const auto PMONITOR = monitor.lock(); + const auto PMONITOR = m_monitor.lock(); if (!PMONITOR) return; - if (layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) + if (m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd - CBox geomFixed = {geometry.x, geometry.y, geometry.width, geometry.height}; + CBox geomFixed = {m_geometry.x, m_geometry.y, m_geometry.width, m_geometry.height}; g_pHyprRenderer->damageBox(geomFixed); - if (layerSurface->current.committed != 0) { - if (layerSurface->current.committed & CLayerShellResource::eCommittedState::STATE_LAYER) { + if (m_layerSurface->current.committed != 0) { + if (m_layerSurface->current.committed & CLayerShellResource::eCommittedState::STATE_LAYER) { - for (auto it = PMONITOR->m_aLayerSurfaceLayers[layer].begin(); it != PMONITOR->m_aLayerSurfaceLayers[layer].end(); it++) { - if (*it == self) { - if (layerSurface->current.layer == layer) + for (auto it = PMONITOR->m_aLayerSurfaceLayers[m_layer].begin(); it != PMONITOR->m_aLayerSurfaceLayers[m_layer].end(); it++) { + if (*it == m_self) { + if (m_layerSurface->current.layer == m_layer) break; - PMONITOR->m_aLayerSurfaceLayers[layerSurface->current.layer].emplace_back(*it); - PMONITOR->m_aLayerSurfaceLayers[layer].erase(it); + PMONITOR->m_aLayerSurfaceLayers[m_layerSurface->current.layer].emplace_back(*it); + PMONITOR->m_aLayerSurfaceLayers[m_layer].erase(it); break; } } - layer = layerSurface->current.layer; + m_layer = m_layerSurface->current.layer; - if (layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) + if (m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd } @@ -305,136 +305,136 @@ void CLayerSurface::onCommit() { PMONITOR->scheduledRecalc = true; } else { - position = Vector2D(geometry.x, geometry.y); + m_position = Vector2D(m_geometry.x, m_geometry.y); // update geom if it changed - if (layerSurface->surface->current.scale == 1 && PMONITOR->scale != 1.f && layerSurface->surface->current.viewport.hasDestination) { + if (m_layerSurface->surface->current.scale == 1 && PMONITOR->scale != 1.f && m_layerSurface->surface->current.viewport.hasDestination) { // fractional scaling. Dirty hack. - geometry = {geometry.pos(), layerSurface->surface->current.viewport.destination}; + m_geometry = {m_geometry.pos(), m_layerSurface->surface->current.viewport.destination}; } else { // this is because some apps like e.g. rofi-lbonn can't fucking use the protocol correctly. - geometry = {geometry.pos(), layerSurface->surface->current.size}; + m_geometry = {m_geometry.pos(), m_layerSurface->surface->current.size}; } } - if (realPosition->goal() != geometry.pos()) { - if (realPosition->isBeingAnimated()) - *realPosition = geometry.pos(); + if (m_realPosition->goal() != m_geometry.pos()) { + if (m_realPosition->isBeingAnimated()) + *m_realPosition = m_geometry.pos(); else - realPosition->setValueAndWarp(geometry.pos()); + m_realPosition->setValueAndWarp(m_geometry.pos()); } - if (realSize->goal() != geometry.size()) { - if (realSize->isBeingAnimated()) - *realSize = geometry.size(); + if (m_realSize->goal() != m_geometry.size()) { + if (m_realSize->isBeingAnimated()) + *m_realSize = m_geometry.size(); else - realSize->setValueAndWarp(geometry.size()); + m_realSize->setValueAndWarp(m_geometry.size()); } - if (mapped && (layerSurface->current.committed & CLayerShellResource::eCommittedState::STATE_INTERACTIVITY)) { + if (m_mapped && (m_layerSurface->current.committed & CLayerShellResource::eCommittedState::STATE_INTERACTIVITY)) { bool WASLASTFOCUS = false; - layerSurface->surface->breadthfirst( + m_layerSurface->surface->breadthfirst( [&WASLASTFOCUS](SP surf, const Vector2D& offset, void* data) { WASLASTFOCUS = WASLASTFOCUS || g_pSeatManager->state.keyboardFocus == surf; }, nullptr); - if (!WASLASTFOCUS && popupHead) { - popupHead->breadthfirst( + if (!WASLASTFOCUS && m_popupHead) { + m_popupHead->breadthfirst( [&WASLASTFOCUS](WP popup, void* data) { - WASLASTFOCUS = WASLASTFOCUS || (popup->m_pWLSurface && g_pSeatManager->state.keyboardFocus == popup->m_pWLSurface->resource()); + WASLASTFOCUS = WASLASTFOCUS || (popup->m_wlSurface && g_pSeatManager->state.keyboardFocus == popup->m_wlSurface->resource()); }, nullptr); } - const bool WASEXCLUSIVE = interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE; - const bool ISEXCLUSIVE = layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE; + const bool WASEXCLUSIVE = m_interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE; + const bool ISEXCLUSIVE = m_layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE; if (!WASEXCLUSIVE && ISEXCLUSIVE) - g_pInputManager->m_dExclusiveLSes.push_back(self); + g_pInputManager->m_dExclusiveLSes.push_back(m_self); else if (WASEXCLUSIVE && !ISEXCLUSIVE) - std::erase_if(g_pInputManager->m_dExclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == self.lock(); }); + std::erase_if(g_pInputManager->m_dExclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == m_self.lock(); }); // if the surface was focused and interactive but now isn't, refocus - if (WASLASTFOCUS && layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) { + if (WASLASTFOCUS && m_layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) { // moveMouseUnified won't focus non interactive layers but it won't unfocus them either, // so unfocus the surface here. g_pCompositor->focusSurface(nullptr); - g_pInputManager->refocusLastWindow(monitor.lock()); - } else if (WASLASTFOCUS && WASEXCLUSIVE && layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) { + g_pInputManager->refocusLastWindow(m_monitor.lock()); + } else if (WASLASTFOCUS && WASEXCLUSIVE && m_layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) { g_pInputManager->simulateMouseMovement(); } else if (!WASEXCLUSIVE && ISEXCLUSIVE) { // if now exclusive and not previously g_pSeatManager->setGrab(nullptr); g_pInputManager->releaseAllMouseButtons(); - g_pCompositor->focusSurface(surface->resource()); + g_pCompositor->focusSurface(m_surface->resource()); - const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y); - g_pSeatManager->setPointerFocus(surface->resource(), LOCAL); + const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y); + g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL); g_pInputManager->m_bEmptyFocusCursorSet = false; } } - interactivity = layerSurface->current.interactivity; + m_interactivity = m_layerSurface->current.interactivity; - g_pHyprRenderer->damageSurface(surface->resource(), position.x, position.y); + g_pHyprRenderer->damageSurface(m_surface->resource(), m_position.x, m_position.y); - g_pCompositor->setPreferredScaleForSurface(surface->resource(), PMONITOR->scale); - g_pCompositor->setPreferredTransformForSurface(surface->resource(), PMONITOR->transform); + g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->scale); + g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->transform); } void CLayerSurface::applyRules() { - noAnimations = false; - forceBlur = false; - ignoreAlpha = false; - ignoreAlphaValue = 0.f; - dimAround = false; - xray = -1; - animationStyle.reset(); + m_noAnimations = false; + m_forceBlur = false; + m_ignoreAlpha = false; + m_ignoreAlphaValue = 0.f; + m_dimAround = false; + m_xray = -1; + m_animationStyle.reset(); - for (auto const& rule : g_pConfigManager->getMatchingRules(self.lock())) { - switch (rule->ruleType) { + for (auto const& rule : g_pConfigManager->getMatchingRules(m_self.lock())) { + switch (rule->m_ruleType) { case CLayerRule::RULE_NOANIM: { - noAnimations = true; + m_noAnimations = true; break; } case CLayerRule::RULE_BLUR: { - forceBlur = true; + m_forceBlur = true; break; } case CLayerRule::RULE_BLURPOPUPS: { - forceBlurPopups = true; + m_forceBlurPopups = true; break; } case CLayerRule::RULE_IGNOREALPHA: case CLayerRule::RULE_IGNOREZERO: { - const auto FIRST_SPACE_POS = rule->rule.find_first_of(' '); + const auto FIRST_SPACE_POS = rule->m_rule.find_first_of(' '); std::string alphaValue = ""; if (FIRST_SPACE_POS != std::string::npos) - alphaValue = rule->rule.substr(FIRST_SPACE_POS + 1); + alphaValue = rule->m_rule.substr(FIRST_SPACE_POS + 1); try { - ignoreAlpha = true; + m_ignoreAlpha = true; if (!alphaValue.empty()) - ignoreAlphaValue = std::stof(alphaValue); + m_ignoreAlphaValue = std::stof(alphaValue); } catch (...) { Debug::log(ERR, "Invalid value passed to ignoreAlpha"); } break; } case CLayerRule::RULE_DIMAROUND: { - dimAround = true; + m_dimAround = true; break; } case CLayerRule::RULE_XRAY: { - CVarList vars{rule->rule, 0, ' '}; + CVarList vars{rule->m_rule, 0, ' '}; try { - xray = configStringToInt(vars[1]).value_or(false); + m_xray = configStringToInt(vars[1]).value_or(false); } catch (...) {} break; } case CLayerRule::RULE_ANIMATION: { - CVarList vars{rule->rule, 2, 's'}; - animationStyle = vars[1]; + CVarList vars{rule->m_rule, 2, 's'}; + m_animationStyle = vars[1]; break; } case CLayerRule::RULE_ORDER: { - CVarList vars{rule->rule, 2, 's'}; + CVarList vars{rule->m_rule, 2, 's'}; try { - order = std::stoi(vars[1]); + m_order = std::stoi(vars[1]); } catch (...) { Debug::log(ERR, "Invalid value passed to order"); } break; } @@ -445,19 +445,19 @@ void CLayerSurface::applyRules() { void CLayerSurface::startAnimation(bool in, bool instant) { if (in) { - realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersIn")); - realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersIn")); - alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn")); + m_realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersIn")); + m_realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersIn")); + m_alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn")); } else { - realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersOut")); - realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersOut")); - alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeLayersOut")); + m_realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersOut")); + m_realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersOut")); + m_alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeLayersOut")); } - const auto ANIMSTYLE = animationStyle.value_or(realPosition->getStyle()); + const auto ANIMSTYLE = m_animationStyle.value_or(m_realPosition->getStyle()); if (ANIMSTYLE.starts_with("slide")) { // get closest edge - const auto MIDDLE = geometry.middle(); + const auto MIDDLE = m_geometry.middle(); const auto PMONITOR = g_pCompositor->getMonitorFromVector(MIDDLE); @@ -495,38 +495,38 @@ void CLayerSurface::startAnimation(bool in, bool instant) { } } - realSize->setValueAndWarp(geometry.size()); - alpha->setValueAndWarp(in ? 0.f : 1.f); - *alpha = in ? 1.f : 0.f; + m_realSize->setValueAndWarp(m_geometry.size()); + m_alpha->setValueAndWarp(in ? 0.f : 1.f); + *m_alpha = in ? 1.f : 0.f; Vector2D prePos; switch (leader) { case 0: // TOP - prePos = {geometry.x, PMONITOR->vecPosition.y - geometry.h}; + prePos = {m_geometry.x, PMONITOR->vecPosition.y - m_geometry.h}; break; case 1: // BOTTOM - prePos = {geometry.x, PMONITOR->vecPosition.y + PMONITOR->vecSize.y}; + prePos = {m_geometry.x, PMONITOR->vecPosition.y + PMONITOR->vecSize.y}; break; case 2: // LEFT - prePos = {PMONITOR->vecPosition.x - geometry.w, geometry.y}; + prePos = {PMONITOR->vecPosition.x - m_geometry.w, m_geometry.y}; break; case 3: // RIGHT - prePos = {PMONITOR->vecPosition.x + PMONITOR->vecSize.x, geometry.y}; + prePos = {PMONITOR->vecPosition.x + PMONITOR->vecSize.x, m_geometry.y}; break; default: UNREACHABLE(); } if (in) { - realPosition->setValueAndWarp(prePos); - *realPosition = geometry.pos(); + m_realPosition->setValueAndWarp(prePos); + *m_realPosition = m_geometry.pos(); } else { - realPosition->setValueAndWarp(geometry.pos()); - *realPosition = prePos; + m_realPosition->setValueAndWarp(m_geometry.pos()); + *m_realPosition = prePos; } } else if (ANIMSTYLE.starts_with("popin")) { @@ -542,62 +542,62 @@ void CLayerSurface::startAnimation(bool in, bool instant) { minPerc *= 0.01; - const auto GOALSIZE = (geometry.size() * minPerc).clamp({5, 5}); - const auto GOALPOS = geometry.pos() + (geometry.size() - GOALSIZE) / 2.f; + const auto GOALSIZE = (m_geometry.size() * minPerc).clamp({5, 5}); + const auto GOALPOS = m_geometry.pos() + (m_geometry.size() - GOALSIZE) / 2.f; - alpha->setValueAndWarp(in ? 0.f : 1.f); - *alpha = in ? 1.f : 0.f; + m_alpha->setValueAndWarp(in ? 0.f : 1.f); + *m_alpha = in ? 1.f : 0.f; if (in) { - realSize->setValueAndWarp(GOALSIZE); - realPosition->setValueAndWarp(GOALPOS); - *realSize = geometry.size(); - *realPosition = geometry.pos(); + m_realSize->setValueAndWarp(GOALSIZE); + m_realPosition->setValueAndWarp(GOALPOS); + *m_realSize = m_geometry.size(); + *m_realPosition = m_geometry.pos(); } else { - realSize->setValueAndWarp(geometry.size()); - realPosition->setValueAndWarp(geometry.pos()); - *realSize = GOALSIZE; - *realPosition = GOALPOS; + m_realSize->setValueAndWarp(m_geometry.size()); + m_realPosition->setValueAndWarp(m_geometry.pos()); + *m_realSize = GOALSIZE; + *m_realPosition = GOALPOS; } } else { // fade - realPosition->setValueAndWarp(geometry.pos()); - realSize->setValueAndWarp(geometry.size()); - *alpha = in ? 1.f : 0.f; + m_realPosition->setValueAndWarp(m_geometry.pos()); + m_realSize->setValueAndWarp(m_geometry.size()); + *m_alpha = in ? 1.f : 0.f; } if (!in) - fadingOut = true; + m_fadingOut = true; } bool CLayerSurface::isFadedOut() { - if (!fadingOut) + if (!m_fadingOut) return false; - return !realPosition->isBeingAnimated() && !realSize->isBeingAnimated() && !alpha->isBeingAnimated(); + return !m_realPosition->isBeingAnimated() && !m_realSize->isBeingAnimated() && !m_alpha->isBeingAnimated(); } int CLayerSurface::popupsCount() { - if (!layerSurface || !mapped || fadingOut) + if (!m_layerSurface || !m_mapped || m_fadingOut) return 0; int no = -1; // we have one dummy - popupHead->breadthfirst([](WP p, void* data) { *(int*)data += 1; }, &no); + m_popupHead->breadthfirst([](WP p, void* data) { *(int*)data += 1; }, &no); return no; } MONITORID CLayerSurface::monitorID() { - return monitor ? monitor->ID : MONITOR_INVALID; + return m_monitor ? m_monitor->ID : MONITOR_INVALID; } pid_t CLayerSurface::getPID() { pid_t PID = -1; - if (!layerSurface || !layerSurface->surface || !layerSurface->surface->getResource() || !layerSurface->surface->getResource()->resource() || - !layerSurface->surface->getResource()->resource()->client) + if (!m_layerSurface || !m_layerSurface->surface || !m_layerSurface->surface->getResource() || !m_layerSurface->surface->getResource()->resource() || + !m_layerSurface->surface->getResource()->resource()->client) return -1; - wl_client_get_credentials(layerSurface->surface->getResource()->resource()->client, &PID, nullptr, nullptr); + wl_client_get_credentials(m_layerSurface->surface->getResource()->resource()->client, &PID, nullptr, nullptr); return PID; } diff --git a/src/desktop/LayerSurface.hpp b/src/desktop/LayerSurface.hpp index 6aba55913..6282d55f1 100644 --- a/src/desktop/LayerSurface.hpp +++ b/src/desktop/LayerSurface.hpp @@ -22,44 +22,43 @@ class CLayerSurface { bool isFadedOut(); int popupsCount(); - PHLANIMVAR realPosition; - PHLANIMVAR realSize; - PHLANIMVAR alpha; + PHLANIMVAR m_realPosition; + PHLANIMVAR m_realSize; + PHLANIMVAR m_alpha; - WP layerSurface; - wl_list link; + WP m_layerSurface; // the header providing the enum type cannot be imported here - int interactivity = 0; + int m_interactivity = 0; - SP surface; + SP m_surface; - bool mapped = false; - uint32_t layer = 0; + bool m_mapped = false; + uint32_t m_layer = 0; - PHLMONITORREF monitor; + PHLMONITORREF m_monitor; - bool fadingOut = false; - bool readyToDelete = false; - bool noProcess = false; - bool noAnimations = false; + bool m_fadingOut = false; + bool m_readyToDelete = false; + bool m_noProcess = false; + bool m_noAnimations = false; - bool forceBlur = false; - bool forceBlurPopups = false; - int64_t xray = -1; - bool ignoreAlpha = false; - float ignoreAlphaValue = 0.f; - bool dimAround = false; - int64_t order = 0; + bool m_forceBlur = false; + bool m_forceBlurPopups = false; + int64_t m_xray = -1; + bool m_ignoreAlpha = false; + float m_ignoreAlphaValue = 0.f; + bool m_dimAround = false; + int64_t m_order = 0; - std::optional animationStyle; + std::optional m_animationStyle; - PHLLSREF self; + PHLLSREF m_self; - CBox geometry = {0, 0, 0, 0}; - Vector2D position; - std::string szNamespace = ""; - UP popupHead; + CBox m_geometry = {0, 0, 0, 0}; + Vector2D m_position; + std::string m_namespace = ""; + UP m_popupHead; pid_t getPID(); @@ -75,12 +74,12 @@ class CLayerSurface { CHyprSignalListener map; CHyprSignalListener unmap; CHyprSignalListener commit; - } listeners; + } m_listeners; void registerCallbacks(); // For the list lookup bool operator==(const CLayerSurface& rhs) const { - return layerSurface == rhs.layerSurface && monitor == rhs.monitor; + return m_layerSurface == rhs.m_layerSurface && m_monitor == rhs.m_monitor; } }; diff --git a/src/desktop/Popup.cpp b/src/desktop/Popup.cpp index 912069e70..d67eec6cb 100644 --- a/src/desktop/Popup.cpp +++ b/src/desktop/Popup.cpp @@ -13,32 +13,32 @@ #include UP CPopup::create(PHLWINDOW pOwner) { - auto popup = UP(new CPopup()); - popup->m_pWindowOwner = pOwner; - popup->m_pSelf = popup; + auto popup = UP(new CPopup()); + popup->m_windowOwner = pOwner; + popup->m_self = popup; popup->initAllSignals(); return popup; } UP CPopup::create(PHLLS pOwner) { - auto popup = UP(new CPopup()); - popup->m_pLayerOwner = pOwner; - popup->m_pSelf = popup; + auto popup = UP(new CPopup()); + popup->m_layerOwner = pOwner; + popup->m_self = popup; popup->initAllSignals(); return popup; } UP CPopup::create(SP resource, WP pOwner) { - auto popup = UP(new CPopup()); - popup->m_pResource = resource; - popup->m_pWindowOwner = pOwner->m_pWindowOwner; - popup->m_pLayerOwner = pOwner->m_pLayerOwner; - popup->m_pParent = pOwner; - popup->m_pSelf = popup; - popup->m_pWLSurface = CWLSurface::create(); - popup->m_pWLSurface->assign(resource->surface->surface.lock(), popup.get()); + auto popup = UP(new CPopup()); + popup->m_resource = resource; + popup->m_windowOwner = pOwner->m_windowOwner; + popup->m_layerOwner = pOwner->m_layerOwner; + popup->m_parent = pOwner; + popup->m_self = popup; + popup->m_wlSurface = CWLSurface::create(); + popup->m_wlSurface->assign(resource->surface->surface.lock(), popup.get()); - popup->m_vLastSize = resource->surface->current.geometry.size(); + popup->m_lastSize = resource->surface->current.geometry.size(); popup->reposition(); popup->initAllSignals(); @@ -46,104 +46,106 @@ UP CPopup::create(SP resource, WP pOwner) { } CPopup::~CPopup() { - if (m_pWLSurface) - m_pWLSurface->unassign(); + if (m_wlSurface) + m_wlSurface->unassign(); } void CPopup::initAllSignals() { - if (!m_pResource) { - if (!m_pWindowOwner.expired()) - listeners.newPopup = m_pWindowOwner->m_pXDGSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast>(d)); }); - else if (!m_pLayerOwner.expired()) - listeners.newPopup = m_pLayerOwner->layerSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast>(d)); }); + if (!m_resource) { + if (!m_windowOwner.expired()) + m_listeners.newPopup = + m_windowOwner->m_pXDGSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast>(d)); }); + else if (!m_layerOwner.expired()) + m_listeners.newPopup = + m_layerOwner->m_layerSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast>(d)); }); else ASSERT(false); return; } - listeners.reposition = m_pResource->events.reposition.registerListener([this](std::any d) { this->onReposition(); }); - listeners.map = m_pResource->surface->events.map.registerListener([this](std::any d) { this->onMap(); }); - listeners.unmap = m_pResource->surface->events.unmap.registerListener([this](std::any d) { this->onUnmap(); }); - listeners.dismissed = m_pResource->events.dismissed.registerListener([this](std::any d) { this->onUnmap(); }); - listeners.destroy = m_pResource->surface->events.destroy.registerListener([this](std::any d) { this->onDestroy(); }); - listeners.commit = m_pResource->surface->events.commit.registerListener([this](std::any d) { this->onCommit(); }); - listeners.newPopup = m_pResource->surface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast>(d)); }); + m_listeners.reposition = m_resource->events.reposition.registerListener([this](std::any d) { this->onReposition(); }); + m_listeners.map = m_resource->surface->events.map.registerListener([this](std::any d) { this->onMap(); }); + m_listeners.unmap = m_resource->surface->events.unmap.registerListener([this](std::any d) { this->onUnmap(); }); + m_listeners.dismissed = m_resource->events.dismissed.registerListener([this](std::any d) { this->onUnmap(); }); + m_listeners.destroy = m_resource->surface->events.destroy.registerListener([this](std::any d) { this->onDestroy(); }); + m_listeners.commit = m_resource->surface->events.commit.registerListener([this](std::any d) { this->onCommit(); }); + m_listeners.newPopup = m_resource->surface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast>(d)); }); } void CPopup::onNewPopup(SP popup) { - const auto& POPUP = m_vChildren.emplace_back(CPopup::create(popup, m_pSelf)); - POPUP->m_pSelf = POPUP; + const auto& POPUP = m_children.emplace_back(CPopup::create(popup, m_self)); + POPUP->m_self = POPUP; Debug::log(LOG, "New popup at {:x}", (uintptr_t)POPUP); } void CPopup::onDestroy() { - m_bInert = true; + m_inert = true; - if (!m_pParent) + if (!m_parent) return; // head node - std::erase_if(m_pParent->m_vChildren, [this](const auto& other) { return other.get() == this; }); + std::erase_if(m_parent->m_children, [this](const auto& other) { return other.get() == this; }); } void CPopup::onMap() { - if (m_bMapped) + if (m_mapped) return; - m_bMapped = true; - m_vLastSize = m_pResource->surface->surface->current.size; + m_mapped = true; + m_lastSize = m_resource->surface->surface->current.size; const auto COORDS = coordsGlobal(); const auto PMONITOR = g_pCompositor->getMonitorFromVector(COORDS); - CBox box = m_pWLSurface->resource()->extends(); + CBox box = m_wlSurface->resource()->extends(); box.translate(COORDS).expand(4); g_pHyprRenderer->damageBox(box); - m_vLastPos = coordsRelativeToParent(); + m_lastPos = coordsRelativeToParent(); g_pInputManager->simulateMouseMovement(); - m_pSubsurfaceHead = CSubsurface::create(m_pSelf); + m_subsurfaceHead = CSubsurface::create(m_self); //unconstrain(); sendScale(); - m_pResource->surface->surface->enter(PMONITOR->self.lock()); + m_resource->surface->surface->enter(PMONITOR->self.lock()); - if (!m_pLayerOwner.expired() && m_pLayerOwner->layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP) - g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_pLayerOwner->layer)); + if (!m_layerOwner.expired() && m_layerOwner->m_layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP) + g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_layerOwner->m_layer)); } void CPopup::onUnmap() { - if (!m_bMapped) + if (!m_mapped) return; - if (!m_pResource || !m_pResource->surface) { + if (!m_resource || !m_resource->surface) { Debug::log(ERR, "CPopup: orphaned (no surface/resource) and unmaps??"); onDestroy(); return; } - m_bMapped = false; + m_mapped = false; - m_vLastSize = m_pResource->surface->surface->current.size; + m_lastSize = m_resource->surface->surface->current.size; const auto COORDS = coordsGlobal(); - CBox box = m_pWLSurface->resource()->extends(); + CBox box = m_wlSurface->resource()->extends(); box.translate(COORDS).expand(4); g_pHyprRenderer->damageBox(box); - m_pSubsurfaceHead.reset(); + m_subsurfaceHead.reset(); - if (!m_pLayerOwner.expired() && m_pLayerOwner->layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP) - g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_pLayerOwner->layer)); + if (!m_layerOwner.expired() && m_layerOwner->m_layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP) + g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_layerOwner->m_layer)); // damage all children breadthfirst( [](WP p, void* data) { - if (!p->m_pResource) + if (!p->m_resource) return; auto box = CBox{p->coordsGlobal(), p->size()}; @@ -159,59 +161,59 @@ void CPopup::onUnmap() { } void CPopup::onCommit(bool ignoreSiblings) { - if (!m_pResource || !m_pResource->surface) { + if (!m_resource || !m_resource->surface) { Debug::log(ERR, "CPopup: orphaned (no surface/resource) and commits??"); onDestroy(); return; } - if (m_pResource->surface->initialCommit) { - m_pResource->surface->scheduleConfigure(); + if (m_resource->surface->initialCommit) { + m_resource->surface->scheduleConfigure(); return; } - if (!m_pWindowOwner.expired() && (!m_pWindowOwner->m_bIsMapped || !m_pWindowOwner->m_pWorkspace->m_bVisible)) { - m_vLastSize = m_pResource->surface->surface->current.size; + if (!m_windowOwner.expired() && (!m_windowOwner->m_bIsMapped || !m_windowOwner->m_pWorkspace->m_bVisible)) { + m_lastSize = m_resource->surface->surface->current.size; static auto PLOGDAMAGE = CConfigValue("debug:log_damage"); if (*PLOGDAMAGE) - Debug::log(LOG, "Refusing to commit damage from a subsurface of {} because it's invisible.", m_pWindowOwner.lock()); + Debug::log(LOG, "Refusing to commit damage from a subsurface of {} because it's invisible.", m_windowOwner.lock()); return; } - if (!m_pResource->surface->mapped) + if (!m_resource->surface->mapped) return; const auto COORDS = coordsGlobal(); const auto COORDSLOCAL = coordsRelativeToParent(); - if (m_vLastSize != m_pResource->surface->surface->current.size || m_bRequestedReposition || m_vLastPos != COORDSLOCAL) { - CBox box = {localToGlobal(m_vLastPos), m_vLastSize}; + if (m_lastSize != m_resource->surface->surface->current.size || m_requestedReposition || m_lastPos != COORDSLOCAL) { + CBox box = {localToGlobal(m_lastPos), m_lastSize}; g_pHyprRenderer->damageBox(box); - m_vLastSize = m_pResource->surface->surface->current.size; - box = {COORDS, m_vLastSize}; + m_lastSize = m_resource->surface->surface->current.size; + box = {COORDS, m_lastSize}; g_pHyprRenderer->damageBox(box); - m_vLastPos = COORDSLOCAL; + m_lastPos = COORDSLOCAL; } - if (!ignoreSiblings && m_pSubsurfaceHead) - m_pSubsurfaceHead->recheckDamageForSubsurfaces(); + if (!ignoreSiblings && m_subsurfaceHead) + m_subsurfaceHead->recheckDamageForSubsurfaces(); - g_pHyprRenderer->damageSurface(m_pWLSurface->resource(), COORDS.x, COORDS.y); + g_pHyprRenderer->damageSurface(m_wlSurface->resource(), COORDS.x, COORDS.y); - m_bRequestedReposition = false; + m_requestedReposition = false; - if (!m_pLayerOwner.expired() && m_pLayerOwner->layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP) - g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_pLayerOwner->layer)); + if (!m_layerOwner.expired() && m_layerOwner->m_layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP) + g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_layerOwner->m_layer)); } void CPopup::onReposition() { Debug::log(LOG, "Popup {:x} requests reposition", (uintptr_t)this); - m_bRequestedReposition = true; + m_requestedReposition = true; - m_vLastPos = coordsRelativeToParent(); + m_lastPos = coordsRelativeToParent(); reposition(); } @@ -224,31 +226,31 @@ void CPopup::reposition() { return; CBox box = {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; - m_pResource->applyPositioning(box, COORDS); + m_resource->applyPositioning(box, COORDS); } SP CPopup::getT1Owner() { - if (m_pWindowOwner) - return m_pWindowOwner->m_pWLSurface; + if (m_windowOwner) + return m_windowOwner->m_pWLSurface; else - return m_pLayerOwner->surface; + return m_layerOwner->m_surface; } Vector2D CPopup::coordsRelativeToParent() { Vector2D offset; - if (!m_pResource) + if (!m_resource) return {}; - WP current = m_pSelf; - offset -= current->m_pResource->surface->current.geometry.pos(); + WP current = m_self; + offset -= current->m_resource->surface->current.geometry.pos(); - while (current->m_pParent && current->m_pResource) { + while (current->m_parent && current->m_resource) { - offset += current->m_pWLSurface->resource()->current.offset; - offset += current->m_pResource->geometry.pos(); + offset += current->m_wlSurface->resource()->current.offset; + offset += current->m_resource->geometry.pos(); - current = current->m_pParent; + current = current->m_parent; } return offset; @@ -263,30 +265,30 @@ Vector2D CPopup::localToGlobal(const Vector2D& rel) { } Vector2D CPopup::t1ParentCoords() { - if (!m_pWindowOwner.expired()) - return m_pWindowOwner->m_vRealPosition->value(); - if (!m_pLayerOwner.expired()) - return m_pLayerOwner->realPosition->value(); + if (!m_windowOwner.expired()) + return m_windowOwner->m_vRealPosition->value(); + if (!m_layerOwner.expired()) + return m_layerOwner->m_realPosition->value(); ASSERT(false); return {}; } void CPopup::recheckTree() { - WP curr = m_pSelf; - while (curr->m_pParent) { - curr = curr->m_pParent; + WP curr = m_self; + while (curr->m_parent) { + curr = curr->m_parent; } curr->recheckChildrenRecursive(); } void CPopup::recheckChildrenRecursive() { - if (m_bInert || !m_pWLSurface) + if (m_inert || !m_wlSurface) return; std::vector> cpy; - std::ranges::for_each(m_vChildren, [&cpy](const auto& el) { cpy.emplace_back(el); }); + std::ranges::for_each(m_children, [&cpy](const auto& el) { cpy.emplace_back(el); }); for (auto const& c : cpy) { c->onCommit(true); c->recheckChildrenRecursive(); @@ -294,25 +296,25 @@ void CPopup::recheckChildrenRecursive() { } Vector2D CPopup::size() { - return m_vLastSize; + return m_lastSize; } void CPopup::sendScale() { - if (!m_pWindowOwner.expired()) - g_pCompositor->setPreferredScaleForSurface(m_pWLSurface->resource(), m_pWindowOwner->m_pWLSurface->m_fLastScale); - else if (!m_pLayerOwner.expired()) - g_pCompositor->setPreferredScaleForSurface(m_pWLSurface->resource(), m_pLayerOwner->surface->m_fLastScale); + if (!m_windowOwner.expired()) + g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_windowOwner->m_pWLSurface->m_fLastScale); + else if (!m_layerOwner.expired()) + g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_layerOwner->m_surface->m_fLastScale); else UNREACHABLE(); } bool CPopup::visible() { - if (!m_pWindowOwner.expired()) - return g_pHyprRenderer->shouldRenderWindow(m_pWindowOwner.lock()); - if (!m_pLayerOwner.expired()) + if (!m_windowOwner.expired()) + return g_pHyprRenderer->shouldRenderWindow(m_windowOwner.lock()); + if (!m_layerOwner.expired()) return true; - if (m_pParent) - return m_pParent->visible(); + if (m_parent) + return m_parent->visible(); return false; } @@ -326,8 +328,8 @@ void CPopup::bfHelper(std::vector> const& nodes, std::functionm_vChildren) { - nodes2.push_back(c->m_pSelf); + for (auto const& c : n->m_children) { + nodes2.push_back(c->m_self); } } @@ -337,7 +339,7 @@ void CPopup::bfHelper(std::vector> const& nodes, std::function, void*)> fn, void* data) { std::vector> popups; - popups.push_back(m_pSelf); + popups.push_back(m_self); bfHelper(popups, fn, data); } @@ -346,14 +348,14 @@ WP CPopup::at(const Vector2D& globalCoords, bool allowsInput) { breadthfirst([&popups](WP popup, void* data) { popups.push_back(popup); }, &popups); for (auto const& p : popups | std::views::reverse) { - if (!p->m_pResource || !p->m_bMapped) + if (!p->m_resource || !p->m_mapped) continue; if (!allowsInput) { - const bool HASSURFACE = p->m_pResource && p->m_pResource->surface; + const bool HASSURFACE = p->m_resource && p->m_resource->surface; - Vector2D offset = HASSURFACE ? p->m_pResource->surface->current.geometry.pos() : Vector2D{}; - Vector2D size = HASSURFACE ? p->m_pResource->surface->current.geometry.size() : p->size(); + Vector2D offset = HASSURFACE ? p->m_resource->surface->current.geometry.pos() : Vector2D{}; + Vector2D size = HASSURFACE ? p->m_resource->surface->current.geometry.size() : p->size(); if (size == Vector2D{}) size = p->size(); @@ -362,7 +364,7 @@ WP CPopup::at(const Vector2D& globalCoords, bool allowsInput) { if (BOX.containsPoint(globalCoords)) return p; } else { - const auto REGION = CRegion{p->m_pWLSurface->resource()->current.input}.intersect(CBox{{}, p->m_pWLSurface->resource()->current.size}).translate(p->coordsGlobal()); + const auto REGION = CRegion{p->m_wlSurface->resource()->current.input}.intersect(CBox{{}, p->m_wlSurface->resource()->current.size}).translate(p->coordsGlobal()); if (REGION.containsPoint(globalCoords)) return p; } @@ -372,5 +374,5 @@ WP CPopup::at(const Vector2D& globalCoords, bool allowsInput) { } bool CPopup::inert() const { - return m_bInert; + return m_inert; } diff --git a/src/desktop/Popup.hpp b/src/desktop/Popup.hpp index f6ca65dab..fdbce5a5e 100644 --- a/src/desktop/Popup.hpp +++ b/src/desktop/Popup.hpp @@ -41,32 +41,32 @@ class CPopup { WP at(const Vector2D& globalCoords, bool allowsInput = false); // - SP m_pWLSurface; - WP m_pSelf; - bool m_bMapped = false; + SP m_wlSurface; + WP m_self; + bool m_mapped = false; private: CPopup() = default; // T1 owners, each popup has to have one of these - PHLWINDOWREF m_pWindowOwner; - PHLLSREF m_pLayerOwner; + PHLWINDOWREF m_windowOwner; + PHLLSREF m_layerOwner; // T2 owners - WP m_pParent; + WP m_parent; - WP m_pResource; + WP m_resource; - Vector2D m_vLastSize = {}; - Vector2D m_vLastPos = {}; + Vector2D m_lastSize = {}; + Vector2D m_lastPos = {}; - bool m_bRequestedReposition = false; + bool m_requestedReposition = false; - bool m_bInert = false; + bool m_inert = false; // - std::vector> m_vChildren; - UP m_pSubsurfaceHead; + std::vector> m_children; + UP m_subsurfaceHead; struct { CHyprSignalListener newPopup; @@ -76,7 +76,7 @@ class CPopup { CHyprSignalListener commit; CHyprSignalListener dismissed; CHyprSignalListener reposition; - } listeners; + } m_listeners; void initAllSignals(); void reposition(); diff --git a/src/desktop/Subsurface.cpp b/src/desktop/Subsurface.cpp index e4ac070c0..d30692fe8 100644 --- a/src/desktop/Subsurface.cpp +++ b/src/desktop/Subsurface.cpp @@ -22,7 +22,7 @@ UP CSubsurface::create(WP pOwner) { subsurface->m_pPopupParent = pOwner; subsurface->m_pSelf = subsurface; subsurface->initSignals(); - subsurface->initExistingSubsurfaces(pOwner->m_pWLSurface->resource()); + subsurface->initExistingSubsurfaces(pOwner->m_wlSurface->resource()); return subsurface; } @@ -63,7 +63,7 @@ void CSubsurface::initSignals() { listeners.newSubsurface = m_pWindowParent->m_pWLSurface->resource()->events.newSubsurface.registerListener( [this](std::any d) { onNewSubsurface(std::any_cast>(d)); }); else if (m_pPopupParent) - listeners.newSubsurface = m_pPopupParent->m_pWLSurface->resource()->events.newSubsurface.registerListener( + listeners.newSubsurface = m_pPopupParent->m_wlSurface->resource()->events.newSubsurface.registerListener( [this](std::any d) { onNewSubsurface(std::any_cast>(d)); }); else ASSERT(false); @@ -107,7 +107,7 @@ void CSubsurface::onCommit() { g_pHyprRenderer->damageSurface(m_pWLSurface->resource(), COORDS.x, COORDS.y); - if (m_pPopupParent && !m_pPopupParent->inert() && m_pPopupParent->m_pWLSurface) + if (m_pPopupParent && !m_pPopupParent->inert() && m_pPopupParent->m_wlSurface) m_pPopupParent->recheckTree(); if (!m_pWindowParent.expired()) // I hate you firefox why are you doing this m_pWindowParent->m_pPopupHead->recheckTree(); diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp index 11da7b680..ef62bc7a9 100644 --- a/src/desktop/WLSurface.cpp +++ b/src/desktop/WLSurface.cpp @@ -190,7 +190,7 @@ std::optional CWLSurface::getSurfaceBoxGlobal() const { if (!m_pWindowOwner.expired()) return m_pWindowOwner->getWindowMainSurfaceBox(); if (!m_pLayerOwner.expired()) - return m_pLayerOwner->geometry; + return m_pLayerOwner->m_geometry; if (m_pPopupOwner) return CBox{m_pPopupOwner->coordsGlobal(), m_pPopupOwner->size()}; if (m_pSubsurfaceOwner) @@ -228,7 +228,7 @@ SP CWLSurface::fromResource(SP pSurface) { bool CWLSurface::keyboardFocusable() const { if (m_pWindowOwner || m_pPopupOwner || m_pSubsurfaceOwner) return true; - if (m_pLayerOwner && m_pLayerOwner->layerSurface) - return m_pLayerOwner->layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE; + if (m_pLayerOwner && m_pLayerOwner->m_layerSurface) + return m_pLayerOwner->m_layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE; return false; } diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index a37424c8d..b22de4599 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -162,7 +162,7 @@ SBoxExtents CWindow::getFullWindowExtents() { // TODO: this could be better, perhaps make a getFullWindowRegion? m_pPopupHead->breadthfirst( [](WP popup, void* data) { - if (!popup->m_pWLSurface || !popup->m_pWLSurface->resource()) + if (!popup->m_wlSurface || !popup->m_wlSurface->resource()) return; CBox* pSurfaceExtents = (CBox*)data; @@ -870,7 +870,7 @@ bool CWindow::hasPopupAt(const Vector2D& pos) { auto popup = m_pPopupHead->at(pos); - return popup && popup->m_pWLSurface->resource(); + return popup && popup->m_wlSurface->resource(); } void CWindow::applyGroupRules() { diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 91f38d11d..7d5cfd3fd 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -581,7 +581,7 @@ void Events::listener_mapWindow(void* owner, void* data) { // check LS focus grab const auto PFORCEFOCUS = g_pCompositor->getForceFocus(); const auto PLSFROMFOCUS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock()); - if (PLSFROMFOCUS && PLSFROMFOCUS->layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) + if (PLSFROMFOCUS && PLSFROMFOCUS->m_layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) PWINDOW->m_bNoInitialFocus = true; if (PWINDOW->m_pWorkspace->m_bHasFullscreenWindow && !requestedInternalFSMode.has_value() && !requestedClientFSMode.has_value() && !PWINDOW->m_bIsFloating) { diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index fc5a97c84..6397e8c38 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -339,8 +339,8 @@ void CMonitor::onDisconnect(bool destroy) { for (size_t i = 0; i < 4; ++i) { for (auto const& ls : m_aLayerSurfaceLayers[i]) { - if (ls->layerSurface && !ls->fadingOut) - ls->layerSurface->sendClosed(); + if (ls->m_layerSurface && !ls->m_fadingOut) + ls->m_layerSurface->sendClosed(); } m_aLayerSurfaceLayers[i].clear(); } diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index c30527967..2c8cf1f98 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -135,14 +135,14 @@ static void handleUpdate(CAnimatedVariable& av, bool warp) { } } else if (PLAYER) { // "some fucking layers miss 1 pixel???" -- vaxry - CBox expandBox = CBox{PLAYER->realPosition->value(), PLAYER->realSize->value()}; + CBox expandBox = CBox{PLAYER->m_realPosition->value(), PLAYER->m_realSize->value()}; expandBox.expand(5); g_pHyprRenderer->damageBox(expandBox); - PMONITOR = g_pCompositor->getMonitorFromVector(PLAYER->realPosition->goal() + PLAYER->realSize->goal() / 2.F); + PMONITOR = g_pCompositor->getMonitorFromVector(PLAYER->m_realPosition->goal() + PLAYER->m_realSize->goal() / 2.F); if (!PMONITOR) return; - animationsDisabled = animationsDisabled || PLAYER->noAnimations; + animationsDisabled = animationsDisabled || PLAYER->m_noAnimations; } const auto SPENT = av.getPercent(); @@ -174,11 +174,11 @@ static void handleUpdate(CAnimatedVariable& av, bool warp) { g_pHyprRenderer->damageWindow(w); } } else if (PLAYER) { - if (PLAYER->layer <= 1) + if (PLAYER->m_layer <= 1) g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // some fucking layers miss 1 pixel??? - CBox expandBox = CBox{PLAYER->realPosition->value(), PLAYER->realSize->value()}; + CBox expandBox = CBox{PLAYER->m_realPosition->value(), PLAYER->m_realSize->value()}; expandBox.expand(5); g_pHyprRenderer->damageBox(expandBox); } diff --git a/src/managers/SeatManager.cpp b/src/managers/SeatManager.cpp index 5fef7b5f9..6ea441e82 100644 --- a/src/managers/SeatManager.cpp +++ b/src/managers/SeatManager.cpp @@ -618,7 +618,7 @@ void CSeatManager::setGrab(SP grab) { } if (!refocus && layer) - refocus = layer->interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE; + refocus = layer->m_interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE; if (refocus) { auto candidate = g_pCompositor->m_lastWindow.lock(); diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index a1158f42b..4aadff96c 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -156,7 +156,7 @@ void CInputManager::sendMotionEventsToFocused() { const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock()); const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock()); - const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_vRealPosition->goal() : (PLS ? Vector2D{PLS->geometry.x, PLS->geometry.y} : Vector2D{})); + const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_vRealPosition->goal() : (PLS ? Vector2D{PLS->m_geometry.x, PLS->m_geometry.y} : Vector2D{})); m_bEmptyFocusCursorSet = false; @@ -310,8 +310,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &g_pInputManager->m_dExclusiveLSes, &surfaceCoords, &pFoundLayerSurface); if (!foundSurface) { - foundSurface = (*g_pInputManager->m_dExclusiveLSes.begin())->surface->resource(); - surfacePos = (*g_pInputManager->m_dExclusiveLSes.begin())->realPosition->goal(); + foundSurface = (*g_pInputManager->m_dExclusiveLSes.begin())->m_surface->resource(); + surfacePos = (*g_pInputManager->m_dExclusiveLSes.begin())->m_realPosition->goal(); } } @@ -483,7 +483,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { if (!refocus && g_pCompositor->m_lastFocus) { const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock()); - if (PLS && PLS->layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE) + if (PLS && PLS->m_layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE) allowKeyboardRefocus = false; } @@ -568,8 +568,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { unsetCursorImage(); } - if (pFoundLayerSurface && (pFoundLayerSurface->layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) && FOLLOWMOUSE != 3 && - (allowKeyboardRefocus || pFoundLayerSurface->layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)) { + if (pFoundLayerSurface && (pFoundLayerSurface->m_layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) && FOLLOWMOUSE != 3 && + (allowKeyboardRefocus || pFoundLayerSurface->m_layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)) { g_pCompositor->focusSurface(foundSurface); } @@ -1456,14 +1456,14 @@ bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) { if (!foundSurface) { foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface); - if (pFoundLayerSurface && pFoundLayerSurface->interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) + if (pFoundLayerSurface && pFoundLayerSurface->m_interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) foundSurface = nullptr; } if (!foundSurface) { foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface); - if (pFoundLayerSurface && pFoundLayerSurface->interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) + if (pFoundLayerSurface && pFoundLayerSurface->m_interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) foundSurface = nullptr; } diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp index 24971c7c0..76119aabf 100644 --- a/src/managers/input/Swipe.cpp +++ b/src/managers/input/Swipe.cpp @@ -41,7 +41,7 @@ void CInputManager::beginWorkspaceSwipe() { if (PWORKSPACE->m_bHasFullscreenWindow) { for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) { - *ls->alpha = 1.f; + *ls->m_alpha = 1.f; } } } @@ -187,7 +187,7 @@ void CInputManager::endWorkspaceSwipe() { // apply alpha for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) { - *ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f; + *ls->m_alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f; } } diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index 6ce1033bb..5a0303352 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -42,7 +42,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { if (m_sActiveSwipe.pWorkspaceBegin) { return; // TODO: Don't swipe if you touched a floating window. - } else if (*PSWIPETOUCH && (m_pFoundLSToFocus.expired() || m_pFoundLSToFocus->layer <= 1) && !g_pSessionLockManager->isSessionLocked()) { + } else if (*PSWIPETOUCH && (m_pFoundLSToFocus.expired() || m_pFoundLSToFocus->m_layer <= 1) && !g_pSessionLockManager->isSessionLocked()) { const auto PWORKSPACE = PMONITOR->activeWorkspace; const auto STYLE = PWORKSPACE->m_vRenderOffset->getStyle(); const bool VERTANIMS = STYLE == "slidevert" || STYLE.starts_with("slidefadevert"); @@ -88,7 +88,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; } } else if (!m_sTouchData.touchFocusLS.expired()) { - local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusLS->geometry.pos(); + local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusLS->m_geometry.pos(); m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; } else @@ -158,7 +158,7 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) { g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local); } else if (!m_sTouchData.touchFocusLS.expired()) { - const auto PMONITOR = m_sTouchData.touchFocusLS->monitor.lock(); + const auto PMONITOR = m_sTouchData.touchFocusLS->m_monitor.lock(); g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true); diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 3e9348d6f..0349cac10 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -2098,7 +2098,7 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) { for (auto const& m : g_pCompositor->m_monitors) { for (auto const& lsl : m->m_aLayerSurfaceLayers) { for (auto const& ls : lsl) { - if (!ls->layerSurface || ls->xray != 1) + if (!ls->m_layerSurface || ls->m_xray != 1) continue; // if (ls->layerSurface->surface->opaque && ls->alpha->value() >= 1.f) @@ -2173,13 +2173,13 @@ bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(PHLLS pLayer, PHLWINDOW pWin if (pWindow && pWindow->m_sWindowData.xray.hasValue() && !pWindow->m_sWindowData.xray.valueOrDefault()) return false; - if (pLayer && pLayer->xray == 0) + if (pLayer && pLayer->m_xray == 0) return false; if ((*PBLURNEWOPTIMIZE && pWindow && !pWindow->m_bIsFloating && !pWindow->onSpecialWorkspace()) || *PBLURXRAY) return true; - if ((pLayer && pLayer->xray == 1) || (pWindow && pWindow->m_sWindowData.xray.valueOrDefault())) + if ((pLayer && pLayer->m_xray == 1) || (pWindow && pWindow->m_sWindowData.xray.valueOrDefault())) return true; return false; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index ffc4002ea..bf93d0728 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -650,13 +650,13 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T pWindow->m_pPopupHead->breadthfirst( [this, &renderdata](WP popup, void* data) { - if (!popup->m_pWLSurface || !popup->m_pWLSurface->resource() || !popup->m_bMapped) + if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped) return; const auto pos = popup->coordsRelativeToParent(); const Vector2D oldPos = renderdata.pos; renderdata.pos += pos; - popup->m_pWLSurface->resource()->breadthfirst( + popup->m_wlSurface->resource()->breadthfirst( [this, &renderdata](SP s, const Vector2D& offset, void* data) { renderdata.localPos = offset; renderdata.texture = s->current.texture; @@ -696,14 +696,14 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s static auto PDIMAROUND = CConfigValue("decoration:dim_around"); - if (*PDIMAROUND && pLayer->dimAround && !m_bRenderingSnapshot && !popups) { + if (*PDIMAROUND && pLayer->m_dimAround && !m_bRenderingSnapshot && !popups) { CRectPassElement::SRectData data; data.box = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.y}; - data.color = CHyprColor(0, 0, 0, *PDIMAROUND * pLayer->alpha->value()); + data.color = CHyprColor(0, 0, 0, *PDIMAROUND * pLayer->m_alpha->value()); m_sRenderPass.add(makeShared(data)); } - if (pLayer->fadingOut) { + if (pLayer->m_fadingOut) { if (!popups) renderSnapshot(pLayer); return; @@ -713,33 +713,33 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s TRACY_GPU_ZONE("RenderLayer"); - const auto REALPOS = pLayer->realPosition->value(); - const auto REALSIZ = pLayer->realSize->value(); + const auto REALPOS = pLayer->m_realPosition->value(); + const auto REALSIZ = pLayer->m_realSize->value(); CSurfacePassElement::SRenderData renderdata = {pMonitor, time, REALPOS}; - renderdata.fadeAlpha = pLayer->alpha->value(); - renderdata.blur = pLayer->forceBlur && *PBLUR; - renderdata.surface = pLayer->surface->resource(); + renderdata.fadeAlpha = pLayer->m_alpha->value(); + renderdata.blur = pLayer->m_forceBlur && *PBLUR; + renderdata.surface = pLayer->m_surface->resource(); renderdata.decorate = false; renderdata.w = REALSIZ.x; renderdata.h = REALSIZ.y; renderdata.pLS = pLayer; - renderdata.blockBlurOptimization = pLayer->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM || pLayer->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; + renderdata.blockBlurOptimization = pLayer->m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM || pLayer->m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; renderdata.clipBox = CBox{0, 0, pMonitor->vecSize.x, pMonitor->vecSize.y}.scale(pMonitor->scale); - if (renderdata.blur && pLayer->ignoreAlpha) { + if (renderdata.blur && pLayer->m_ignoreAlpha) { renderdata.discardMode |= DISCARD_ALPHA; - renderdata.discardOpacity = pLayer->ignoreAlphaValue; + renderdata.discardOpacity = pLayer->m_ignoreAlphaValue; } if (!popups) - pLayer->surface->resource()->breadthfirst( + pLayer->m_surface->resource()->breadthfirst( [this, &renderdata, &pLayer](SP s, const Vector2D& offset, void* data) { renderdata.localPos = offset; renderdata.texture = s->current.texture; renderdata.surface = s; - renderdata.mainSurface = s == pLayer->surface->resource(); + renderdata.mainSurface = s == pLayer->m_surface->resource(); m_sRenderPass.add(makeShared(renderdata)); renderdata.surfaceCounter++; }, @@ -748,18 +748,18 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s renderdata.squishOversized = false; // don't squish popups renderdata.dontRound = true; renderdata.popup = true; - renderdata.blur = pLayer->forceBlurPopups; + renderdata.blur = pLayer->m_forceBlurPopups; renderdata.surfaceCounter = 0; if (popups) { - pLayer->popupHead->breadthfirst( + pLayer->m_popupHead->breadthfirst( [this, &renderdata](WP popup, void* data) { - if (!popup->m_pWLSurface || !popup->m_pWLSurface->resource() || !popup->m_bMapped) + if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped) return; Vector2D pos = popup->coordsRelativeToParent(); renderdata.localPos = pos; - renderdata.texture = popup->m_pWLSurface->resource()->current.texture; - renderdata.surface = popup->m_pWLSurface->resource(); + renderdata.texture = popup->m_wlSurface->resource()->current.texture; + renderdata.surface = popup->m_wlSurface->resource(); renderdata.mainSurface = false; m_sRenderPass.add(makeShared(renderdata)); renderdata.surfaceCounter++; @@ -1603,10 +1603,10 @@ void CHyprRenderer::sendFrameEventsToWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE for (auto const& lsl : pMonitor->m_aLayerSurfaceLayers) { for (auto const& ls : lsl) { - if (ls->fadingOut || !ls->surface->resource()) + if (ls->m_fadingOut || !ls->m_surface->resource()) continue; - ls->surface->resource()->breadthfirst([now](SP r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr); + ls->m_surface->resource()->breadthfirst([now](SP r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr); } } } @@ -1682,10 +1682,10 @@ void CHyprRenderer::arrangeLayerArray(PHLMONITOR pMonitor, const std::vectorvecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y}; for (auto const& ls : layerSurfaces) { - if (!ls || ls->fadingOut || ls->readyToDelete || !ls->layerSurface || ls->noProcess) + if (!ls || ls->m_fadingOut || ls->m_readyToDelete || !ls->m_layerSurface || ls->m_noProcess) continue; - const auto PLAYER = ls->layerSurface; + const auto PLAYER = ls->m_layerSurface; const auto PSTATE = &PLAYER->current; if (exclusiveZone != (PSTATE->exclusive > 0)) continue; @@ -1696,7 +1696,7 @@ void CHyprRenderer::arrangeLayerArray(PHLMONITOR pMonitor, const std::vectorgeometry.width, ls->geometry.height}; + const Vector2D OLDSIZE = {ls->m_geometry.width, ls->m_geometry.height}; CBox box = {{}, PSTATE->desiredSize}; // Horizontal axis @@ -1753,15 +1753,15 @@ void CHyprRenderer::arrangeLayerArray(PHLMONITOR pMonitor, const std::vectorgeometry = box; + ls->m_geometry = box; applyExclusive(*usableArea, PSTATE->anchor, PSTATE->exclusive, PSTATE->exclusiveEdge, PSTATE->margin.top, PSTATE->margin.right, PSTATE->margin.bottom, PSTATE->margin.left); if (Vector2D{box.width, box.height} != OLDSIZE) - ls->layerSurface->configure(box.size()); + ls->m_layerSurface->configure(box.size()); - *ls->realPosition = box.pos(); - *ls->realSize = box.size(); + *ls->m_realPosition = box.pos(); + *ls->m_realSize = box.size(); } } @@ -1792,7 +1792,7 @@ void CHyprRenderer::arrangeLayersForMonitor(const MONITORID& monitor) { } for (auto& la : PMONITOR->m_aLayerSurfaceLayers) { - std::stable_sort(la.begin(), la.end(), [](const PHLLSREF& a, const PHLLSREF& b) { return a->order > b->order; }); + std::stable_sort(la.begin(), la.end(), [](const PHLLSREF& a, const PHLLSREF& b) { return a->m_order > b->m_order; }); } for (auto const& la : PMONITOR->m_aLayerSurfaceLayers) @@ -2139,7 +2139,7 @@ void CHyprRenderer::recheckSolitaryForMonitor(PHLMONITOR pMonitor) { return; for (auto const& topls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { - if (topls->alpha->value() != 0.f) + if (topls->m_alpha->value() != 0.f) return; } @@ -2463,7 +2463,7 @@ void CHyprRenderer::makeWindowSnapshot(PHLWINDOW pWindow) { void CHyprRenderer::makeLayerSnapshot(PHLLS pLayer) { // we trust the window is valid. - const auto PMONITOR = pLayer->monitor.lock(); + const auto PMONITOR = pLayer->m_monitor.lock(); if (!PMONITOR || !PMONITOR->output || PMONITOR->vecPixelSize.x <= 0 || PMONITOR->vecPixelSize.y <= 0) return; @@ -2485,13 +2485,13 @@ void CHyprRenderer::makeLayerSnapshot(PHLLS pLayer) { g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 0)); // JIC - const auto BLURLSSTATUS = pLayer->forceBlur; - pLayer->forceBlur = false; + const auto BLURLSSTATUS = pLayer->m_forceBlur; + pLayer->m_forceBlur = false; // draw the layer renderLayer(pLayer, PMONITOR, Time::steadyNow()); - pLayer->forceBlur = BLURLSSTATUS; + pLayer->m_forceBlur = BLURLSSTATUS; endRender(); @@ -2556,18 +2556,20 @@ void CHyprRenderer::renderSnapshot(PHLLS pLayer) { if (!FBDATA->getTexture()) return; - const auto PMONITOR = pLayer->monitor.lock(); + const auto PMONITOR = pLayer->m_monitor.lock(); CBox layerBox; // some mafs to figure out the correct box // the originalClosedPos is relative to the monitor's pos - Vector2D scaleXY = Vector2D((PMONITOR->scale * pLayer->realSize->value().x / (pLayer->geometry.w * PMONITOR->scale)), - (PMONITOR->scale * pLayer->realSize->value().y / (pLayer->geometry.h * PMONITOR->scale))); + Vector2D scaleXY = Vector2D((PMONITOR->scale * pLayer->m_realSize->value().x / (pLayer->m_geometry.w * PMONITOR->scale)), + (PMONITOR->scale * pLayer->m_realSize->value().y / (pLayer->m_geometry.h * PMONITOR->scale))); layerBox.width = PMONITOR->vecTransformedSize.x * scaleXY.x; layerBox.height = PMONITOR->vecTransformedSize.y * scaleXY.y; - layerBox.x = ((pLayer->realPosition->value().x - PMONITOR->vecPosition.x) * PMONITOR->scale) - (((pLayer->geometry.x - PMONITOR->vecPosition.x) * PMONITOR->scale) * scaleXY.x); - layerBox.y = ((pLayer->realPosition->value().y - PMONITOR->vecPosition.y) * PMONITOR->scale) - (((pLayer->geometry.y - PMONITOR->vecPosition.y) * PMONITOR->scale) * scaleXY.y); + layerBox.x = + ((pLayer->m_realPosition->value().x - PMONITOR->vecPosition.x) * PMONITOR->scale) - (((pLayer->m_geometry.x - PMONITOR->vecPosition.x) * PMONITOR->scale) * scaleXY.x); + layerBox.y = + ((pLayer->m_realPosition->value().y - PMONITOR->vecPosition.y) * PMONITOR->scale) - (((pLayer->m_geometry.y - PMONITOR->vecPosition.y) * PMONITOR->scale) * scaleXY.y); CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y}; @@ -2575,7 +2577,7 @@ void CHyprRenderer::renderSnapshot(PHLLS pLayer) { data.flipEndFrame = true; data.tex = FBDATA->getTexture(); data.box = layerBox; - data.a = pLayer->alpha->value(); + data.a = pLayer->m_alpha->value(); data.damage = fakeDamage; m_sRenderPass.add(makeShared(data));