layers: refactor class member vars (#10149)

* layers: refactor class member vars

* popups: rename m_WLSurface to m_wlSurface
This commit is contained in:
davc0n
2025-04-24 20:49:49 +02:00
committed by GitHub
parent be6268a7ec
commit 0e80ecc534
21 changed files with 487 additions and 484 deletions

View File

@@ -1019,7 +1019,7 @@ SP<CWLSurfaceResource> CCompositor::vectorWindowToSurface(const Vector2D& pos, P
if (PPOPUP) { if (PPOPUP) {
const auto OFF = PPOPUP->coordsRelativeToParent(); const auto OFF = PPOPUP->coordsRelativeToParent();
sl = pos - pWindow->m_vRealPosition->goal() - OFF; 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); auto [surf, local] = pWindow->m_pWLSurface->resource()->at(pos - pWindow->m_vRealPosition->goal(), true);
@@ -1270,15 +1270,15 @@ void CCompositor::focusSurface(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWindo
SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, PHLMONITOR monitor, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) { SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, PHLMONITOR monitor, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
for (auto const& lsl : monitor->m_aLayerSurfaceLayers | std::views::reverse) { for (auto const& lsl : monitor->m_aLayerSurfaceLayers | std::views::reverse) {
for (auto const& ls : lsl | 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; continue;
auto SURFACEAT = ls->popupHead->at(pos, true); auto SURFACEAT = ls->m_popupHead->at(pos, true);
if (SURFACEAT) { if (SURFACEAT) {
*ppLayerSurfaceFound = ls.lock(); *ppLayerSurfaceFound = ls.lock();
*sCoords = pos - SURFACEAT->coordsGlobal(); *sCoords = pos - SURFACEAT->coordsGlobal();
return SURFACEAT->m_pWLSurface->resource(); return SURFACEAT->m_wlSurface->resource();
} }
} }
} }
@@ -1288,10 +1288,10 @@ SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& po
SP<CWLSurfaceResource> CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<PHLLSREF>* layerSurfaces, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) { SP<CWLSurfaceResource> CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<PHLLSREF>* layerSurfaces, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
for (auto const& ls : *layerSurfaces | std::views::reverse) { 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; 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) {
if (surf->current.input.empty()) if (surf->current.input.empty())
@@ -1463,14 +1463,14 @@ void CCompositor::cleanupFadingOut(const MONITORID& monid) {
continue; continue;
} }
if (ls->monitorID() != monid && ls->monitor) if (ls->monitorID() != monid && ls->m_monitor)
continue; continue;
// mark blur for recalc // 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)); 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 const& m : m_monitors) {
for (auto& lsl : m->m_aLayerSurfaceLayers) { for (auto& lsl : m->m_aLayerSurfaceLayers) {
if (!lsl.empty() && std::ranges::find_if(lsl, [&](auto& other) { return other == ls; }) != lsl.end()) { 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()) { if (pWorkspace->m_iID == PMONITOR->activeWorkspaceID() || pWorkspace->m_iID == PMONITOR->activeSpecialWorkspaceID()) {
for (auto const& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { for (auto const& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
if (!ls->fadingOut) if (!ls->m_fadingOut)
*ls->alpha = FULLSCREEN && pWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f; *ls->m_alpha = FULLSCREEN && pWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
} }
} }
} }
@@ -2554,13 +2554,13 @@ PHLLS CCompositor::getLayerSurfaceFromSurface(SP<CWLSurfaceResource> pSurface) {
std::pair<SP<CWLSurfaceResource>, bool> result = {pSurface, false}; std::pair<SP<CWLSurfaceResource>, bool> result = {pSurface, false};
for (auto const& ls : m_layers) { for (auto const& ls : m_layers) {
if (ls->layerSurface && ls->layerSurface->surface == pSurface) if (ls->m_layerSurface && ls->m_layerSurface->surface == pSurface)
return ls; return ls;
if (!ls->layerSurface || !ls->mapped) if (!ls->m_layerSurface || !ls->m_mapped)
continue; continue;
ls->layerSurface->surface->breadthfirst( ls->m_layerSurface->surface->breadthfirst(
[&result](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) { [&result](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) {
if (surf == result.first) { if (surf == result.first) {
result.second = true; result.second = true;

View File

@@ -1530,22 +1530,22 @@ std::vector<SP<CWindowRule>> CConfigManager::getMatchingRules(PHLWINDOW pWindow,
std::vector<SP<CLayerRule>> CConfigManager::getMatchingRules(PHLLS pLS) { std::vector<SP<CLayerRule>> CConfigManager::getMatchingRules(PHLLS pLS) {
std::vector<SP<CLayerRule>> returns; std::vector<SP<CLayerRule>> returns;
if (!pLS->layerSurface || pLS->fadingOut) if (!pLS->m_layerSurface || pLS->m_fadingOut)
return returns; return returns;
for (auto const& lr : m_layerRules) { for (auto const& lr : m_layerRules) {
if (lr->targetNamespace.starts_with("address:0x")) { if (lr->m_targetNamespace.starts_with("address:0x")) {
if (std::format("address:0x{:x}", (uintptr_t)pLS.get()) != lr->targetNamespace) if (std::format("address:0x{:x}", (uintptr_t)pLS.get()) != lr->m_targetNamespace)
continue; continue;
} else if (!lr->targetNamespaceRegex.passes(pLS->layerSurface->layerNamespace)) } else if (!lr->m_targetNamespaceRegex.passes(pLS->m_layerSurface->layerNamespace))
continue; continue;
// hit // hit
returns.emplace_back(lr); returns.emplace_back(lr);
} }
if (shouldBlurLS(pLS->layerSurface->layerNamespace)) if (shouldBlurLS(pLS->m_layerSurface->layerNamespace))
returns.emplace_back(makeShared<CLayerRule>(pLS->layerSurface->layerNamespace, "blur")); returns.emplace_back(makeShared<CLayerRule>(pLS->m_layerSurface->layerNamespace, "blur"));
return returns; return returns;
} }
@@ -2626,18 +2626,18 @@ std::optional<std::string> CConfigManager::handleLayerRule(const std::string& co
return "empty rule?"; return "empty rule?";
if (RULE == "unset") { 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 {}; return {};
} }
auto rule = makeShared<CLayerRule>(RULE, VALUE); auto rule = makeShared<CLayerRule>(RULE, VALUE);
if (rule->ruleType == CLayerRule::RULE_INVALID) { if (rule->m_ruleType == CLayerRule::RULE_INVALID) {
Debug::log(ERR, "Invalid rule found: {}", RULE); Debug::log(ERR, "Invalid rule found: {}", RULE);
return "Invalid rule found: " + RULE; return "Invalid rule found: " + RULE;
} }
rule->targetNamespaceRegex = {VALUE}; rule->m_targetNamespaceRegex = {VALUE};
m_layerRules.emplace_back(rule); m_layerRules.emplace_back(rule);
@@ -2661,9 +2661,9 @@ void CConfigManager::updateBlurredLS(const std::string& name, const bool forceBl
for (auto const& ls : lsl) { for (auto const& ls : lsl) {
if (BYADDRESS) { if (BYADDRESS) {
if (std::format("0x{:x}", (uintptr_t)ls.get()) == matchName) if (std::format("0x{:x}", (uintptr_t)ls.get()) == matchName)
ls->forceBlur = forceBlur; ls->m_forceBlur = forceBlur;
} else if (ls->szNamespace == matchName) } else if (ls->m_namespace == matchName)
ls->forceBlur = forceBlur; ls->m_forceBlur = forceBlur;
} }
} }
} }

View File

@@ -487,7 +487,7 @@ static std::string layersRequest(eHyprCtlOutputFormat format, std::string reques
"namespace": "{}", "namespace": "{}",
"pid": {} "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()); layer->getPID());
} }
@@ -519,8 +519,8 @@ static std::string layersRequest(eHyprCtlOutputFormat format, std::string reques
result += std::format("\tLayer level {} ({}):\n", layerLevel, levelNames[layerLevel]); result += std::format("\tLayer level {} ({}):\n", layerLevel, levelNames[layerLevel]);
for (auto const& layer : level) { 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, result += std::format("\t\tLayer {:x}: xywh: {} {} {} {}, namespace: {}, pid: {}\n", (uintptr_t)layer.get(), layer->m_geometry.x, layer->m_geometry.y,
layer->geometry.width, layer->geometry.height, layer->szNamespace, layer->getPID()); layer->m_geometry.width, layer->m_geometry.height, layer->m_namespace, layer->getPID());
} }
layerLevel++; layerLevel++;

View File

@@ -7,32 +7,32 @@
static const auto RULES = std::unordered_set<std::string>{"noanim", "blur", "blurpopups", "dimaround"}; static const auto RULES = std::unordered_set<std::string>{"noanim", "blur", "blurpopups", "dimaround"};
static const auto RULES_PREFIX = std::unordered_set<std::string>{"ignorealpha", "ignorezero", "xray", "animation", "order"}; static const auto RULES_PREFIX = std::unordered_set<std::string>{"ignorealpha", "ignorezero", "xray", "animation", "order"};
CLayerRule::CLayerRule(const std::string& rule_, const std::string& ns_) : targetNamespace(ns_), rule(rule_) { CLayerRule::CLayerRule(const std::string& rule_, const std::string& ns_) : m_targetNamespace(ns_), m_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); }); 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) if (!VALID)
return; return;
if (rule == "noanim") if (m_rule == "noanim")
ruleType = RULE_NOANIM; m_ruleType = RULE_NOANIM;
else if (rule == "blur") else if (m_rule == "blur")
ruleType = RULE_BLUR; m_ruleType = RULE_BLUR;
else if (rule == "blurpopups") else if (m_rule == "blurpopups")
ruleType = RULE_BLURPOPUPS; m_ruleType = RULE_BLURPOPUPS;
else if (rule == "dimaround") else if (m_rule == "dimaround")
ruleType = RULE_DIMAROUND; m_ruleType = RULE_DIMAROUND;
else if (rule.starts_with("ignorealpha")) else if (m_rule.starts_with("ignorealpha"))
ruleType = RULE_IGNOREALPHA; m_ruleType = RULE_IGNOREALPHA;
else if (rule.starts_with("ignorezero")) else if (m_rule.starts_with("ignorezero"))
ruleType = RULE_IGNOREZERO; m_ruleType = RULE_IGNOREZERO;
else if (rule.starts_with("xray")) else if (m_rule.starts_with("xray"))
ruleType = RULE_XRAY; m_ruleType = RULE_XRAY;
else if (rule.starts_with("animation")) else if (m_rule.starts_with("animation"))
ruleType = RULE_ANIMATION; m_ruleType = RULE_ANIMATION;
else if (rule.starts_with("order")) else if (m_rule.starts_with("order"))
ruleType = RULE_ORDER; m_ruleType = RULE_ORDER;
else { else {
Debug::log(ERR, "CLayerRule: didn't match a rule that was found valid?!"); Debug::log(ERR, "CLayerRule: didn't match a rule that was found valid?!");
ruleType = RULE_INVALID; m_ruleType = RULE_INVALID;
} }
} }

View File

@@ -22,10 +22,10 @@ class CLayerRule {
RULE_ZUMBA, RULE_ZUMBA,
}; };
eRuleType ruleType = RULE_INVALID; eRuleType m_ruleType = RULE_INVALID;
const std::string targetNamespace; const std::string m_targetNamespace;
const std::string rule; const std::string m_rule;
CRuleRegexContainer targetNamespaceRegex; CRuleRegexContainer m_targetNamespaceRegex;
}; };

View File

@@ -17,7 +17,7 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
auto pMonitor = resource->monitor.empty() ? g_pCompositor->m_lastMonitor.lock() : g_pCompositor->getMonitorFromName(resource->monitor); 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) { if (!pMonitor) {
Debug::log(ERR, "New LS has no monitor??"); Debug::log(ERR, "New LS has no monitor??");
@@ -27,54 +27,54 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
if (pMonitor->pMirrorOf) if (pMonitor->pMirrorOf)
pMonitor = g_pCompositor->m_monitors.front(); 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->m_layer = resource->current.layer;
pLS->popupHead = CPopup::create(pLS); pLS->m_popupHead = CPopup::create(pLS);
pLS->monitor = pMonitor; pLS->m_monitor = pMonitor;
pMonitor->m_aLayerSurfaceLayers[resource->current.layer].emplace_back(pLS); 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(0.f, pLS->m_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->m_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(Vector2D(0, 0), pLS->m_realSize, g_pConfigManager->getAnimationPropertyConfig("layersIn"), pLS, AVARDAMAGE_ENTIRE);
pLS->registerCallbacks(); 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; return pLS;
} }
void CLayerSurface::registerCallbacks() { void CLayerSurface::registerCallbacks() {
alpha->setUpdateCallback([this](auto) { m_alpha->setUpdateCallback([this](auto) {
if (dimAround) if (m_dimAround)
g_pHyprRenderer->damageMonitor(monitor.lock()); g_pHyprRenderer->damageMonitor(m_monitor.lock());
}); });
} }
CLayerSurface::CLayerSurface(SP<CLayerShellResource> resource_) : layerSurface(resource_) { CLayerSurface::CLayerSurface(SP<CLayerShellResource> resource_) : m_layerSurface(resource_) {
listeners.commit = layerSurface->events.commit.registerListener([this](std::any d) { onCommit(); }); m_listeners.commit = m_layerSurface->events.commit.registerListener([this](std::any d) { onCommit(); });
listeners.map = layerSurface->events.map.registerListener([this](std::any d) { onMap(); }); m_listeners.map = m_layerSurface->events.map.registerListener([this](std::any d) { onMap(); });
listeners.unmap = layerSurface->events.unmap.registerListener([this](std::any d) { onUnmap(); }); m_listeners.unmap = m_layerSurface->events.unmap.registerListener([this](std::any d) { onUnmap(); });
listeners.destroy = layerSurface->events.destroy.registerListener([this](std::any d) { onDestroy(); }); m_listeners.destroy = m_layerSurface->events.destroy.registerListener([this](std::any d) { onDestroy(); });
surface = CWLSurface::create(); m_surface = CWLSurface::create();
} }
CLayerSurface::~CLayerSurface() { CLayerSurface::~CLayerSurface() {
if (!g_pHyprOpenGL) if (!g_pHyprOpenGL)
return; return;
if (surface) if (m_surface)
surface->unassign(); m_surface->unassign();
g_pHyprRenderer->makeEGLCurrent(); 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 const& mon : g_pCompositor->m_realMonitors) {
for (auto& lsl : mon->m_aLayerSurfaceLayers) { for (auto& lsl : mon->m_aLayerSurfaceLayers) {
@@ -84,29 +84,29 @@ CLayerSurface::~CLayerSurface() {
} }
void CLayerSurface::onDestroy() { 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) if (!PMONITOR)
Debug::log(WARN, "Layersurface destroyed on an invalid monitor (removed?)"); Debug::log(WARN, "Layersurface destroyed on an invalid monitor (removed?)");
if (!fadingOut) { if (!m_fadingOut) {
if (mapped) { if (m_mapped) {
Debug::log(LOG, "Forcing an unmap of a LS that did a straight destroy!"); Debug::log(LOG, "Forcing an unmap of a LS that did a straight destroy!");
onUnmap(); onUnmap();
} else { } else {
Debug::log(LOG, "Removing LayerSurface that wasn't mapped."); Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
if (alpha) if (m_alpha)
alpha->setValueAndWarp(0.f); m_alpha->setValueAndWarp(0.f);
fadingOut = true; m_fadingOut = true;
g_pCompositor->addToFadingOutSafe(self.lock()); g_pCompositor->addToFadingOutSafe(m_self.lock());
} }
} }
popupHead.reset(); m_popupHead.reset();
noProcess = true; m_noProcess = true;
// rearrange to fix the reserved areas // rearrange to fix the reserved areas
if (PMONITOR) { if (PMONITOR) {
@@ -114,35 +114,35 @@ void CLayerSurface::onDestroy() {
PMONITOR->scheduledRecalc = true; PMONITOR->scheduledRecalc = true;
// and damage // 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); g_pHyprRenderer->damageBox(geomFixed);
} }
readyToDelete = true; m_readyToDelete = true;
layerSurface.reset(); m_layerSurface.reset();
if (surface) if (m_surface)
surface->unassign(); m_surface->unassign();
listeners.unmap.reset(); m_listeners.unmap.reset();
listeners.destroy.reset(); m_listeners.destroy.reset();
listeners.map.reset(); m_listeners.map.reset();
listeners.commit.reset(); m_listeners.commit.reset();
} }
void CLayerSurface::onMap() { 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; m_mapped = true;
interactivity = layerSurface->current.interactivity; m_interactivity = m_layerSurface->current.interactivity;
layerSurface->surface->map(); m_layerSurface->surface->map();
// this layer might be re-mapped. // this layer might be re-mapped.
fadingOut = false; m_fadingOut = false;
g_pCompositor->removeFromFadingOutSafe(self.lock()); g_pCompositor->removeFromFadingOutSafe(m_self.lock());
// fix if it changed its mon // fix if it changed its mon
const auto PMONITOR = monitor.lock(); const auto PMONITOR = m_monitor.lock();
if (!PMONITOR) if (!PMONITOR)
return; return;
@@ -153,15 +153,15 @@ void CLayerSurface::onMap() {
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID); 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) if (ISEXCLUSIVE)
g_pInputManager->m_dExclusiveLSes.push_back(self); g_pInputManager->m_dExclusiveLSes.push_back(m_self);
const bool GRABSFOCUS = ISEXCLUSIVE || 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 // don't focus if constrained
(g_pSeatManager->mouse.expired() || !g_pInputManager->isConstrained())); (g_pSeatManager->mouse.expired() || !g_pInputManager->isConstrained()));
@@ -169,69 +169,69 @@ void CLayerSurface::onMap() {
// TODO: use the new superb really very cool grab // TODO: use the new superb really very cool grab
g_pSeatManager->setGrab(nullptr); g_pSeatManager->setGrab(nullptr);
g_pInputManager->releaseAllMouseButtons(); 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); const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y);
g_pSeatManager->setPointerFocus(surface->resource(), LOCAL); g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL);
g_pInputManager->m_bEmptyFocusCursorSet = false; 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); g_pHyprRenderer->damageBox(geomFixed);
const bool FULLSCREEN = PMONITOR->activeWorkspace && PMONITOR->activeWorkspace->m_bHasFullscreenWindow && PMONITOR->activeWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN; 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)); startAnimation(!(m_layer == ZWLR_LAYER_SHELL_V1_LAYER_TOP && FULLSCREEN && !GRABSFOCUS));
readyToDelete = false; m_readyToDelete = false;
fadingOut = false; m_fadingOut = false;
g_pEventManager->postEvent(SHyprIPCEvent{"openlayer", szNamespace}); g_pEventManager->postEvent(SHyprIPCEvent{"openlayer", m_namespace});
EMIT_HOOK_EVENT("openLayer", self.lock()); EMIT_HOOK_EVENT("openLayer", m_self.lock());
g_pCompositor->setPreferredScaleForSurface(surface->resource(), PMONITOR->scale); g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->scale);
g_pCompositor->setPreferredTransformForSurface(surface->resource(), PMONITOR->transform); g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->transform);
} }
void CLayerSurface::onUnmap() { 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}); g_pEventManager->postEvent(SHyprIPCEvent{"closelayer", m_layerSurface->layerNamespace});
EMIT_HOOK_EVENT("closeLayer", self.lock()); 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."); Debug::log(WARN, "Layersurface unmapping on invalid monitor (removed?) ignoring.");
g_pCompositor->addToFadingOutSafe(self.lock()); g_pCompositor->addToFadingOutSafe(m_self.lock());
mapped = false; m_mapped = false;
if (layerSurface && layerSurface->surface) if (m_layerSurface && m_layerSurface->surface)
layerSurface->surface->unmap(); m_layerSurface->surface->unmap();
startAnimation(false); startAnimation(false);
return; return;
} }
// end any pending animations so that snapshot has right dimensions // end any pending animations so that snapshot has right dimensions
realPosition->warp(); m_realPosition->warp();
realSize->warp(); m_realSize->warp();
// make a snapshot and start fade // make a snapshot and start fade
g_pHyprRenderer->makeLayerSnapshot(self.lock()); g_pHyprRenderer->makeLayerSnapshot(m_self.lock());
startAnimation(false); startAnimation(false);
mapped = false; m_mapped = false;
if (layerSurface && layerSurface->surface) if (m_layerSurface && m_layerSurface->surface)
layerSurface->surface->unmap(); 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) if (!PMONITOR)
return; 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 (WASLASTFOCUS || (g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus->hlSurface && !g_pCompositor->m_lastFocus->hlSurface->keyboardFocusable())) {
if (!g_pInputManager->refocusLastWindow(PMONITOR)) if (!g_pInputManager->refocusLastWindow(PMONITOR))
g_pInputManager->refocus(); 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()); 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); g_pHyprRenderer->damageBox(geomFixed);
geomFixed = {geometry.x + (int)PMONITOR->vecPosition.x, geometry.y + (int)PMONITOR->vecPosition.y, (int)layerSurface->surface->current.size.x, geomFixed = {m_geometry.x + (int)PMONITOR->vecPosition.x, m_geometry.y + (int)PMONITOR->vecPosition.y, (int)m_layerSurface->surface->current.size.x,
(int)layerSurface->surface->current.size.y}; (int)m_layerSurface->surface->current.size.y};
g_pHyprRenderer->damageBox(geomFixed); g_pHyprRenderer->damageBox(geomFixed);
g_pInputManager->simulateMouseMovement(); g_pInputManager->simulateMouseMovement();
@@ -257,47 +257,47 @@ void CLayerSurface::onUnmap() {
} }
void CLayerSurface::onCommit() { void CLayerSurface::onCommit() {
if (!layerSurface) if (!m_layerSurface)
return; return;
if (!mapped) { if (!m_mapped) {
// we're re-mapping if this is the case // we're re-mapping if this is the case
if (layerSurface->surface && !layerSurface->surface->current.texture) { if (m_layerSurface->surface && !m_layerSurface->surface->current.texture) {
fadingOut = false; m_fadingOut = false;
geometry = {}; m_geometry = {};
g_pHyprRenderer->arrangeLayersForMonitor(monitorID()); g_pHyprRenderer->arrangeLayersForMonitor(monitorID());
} }
return; return;
} }
const auto PMONITOR = monitor.lock(); const auto PMONITOR = m_monitor.lock();
if (!PMONITOR) if (!PMONITOR)
return; 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 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); g_pHyprRenderer->damageBox(geomFixed);
if (layerSurface->current.committed != 0) { if (m_layerSurface->current.committed != 0) {
if (layerSurface->current.committed & CLayerShellResource::eCommittedState::STATE_LAYER) { if (m_layerSurface->current.committed & CLayerShellResource::eCommittedState::STATE_LAYER) {
for (auto it = PMONITOR->m_aLayerSurfaceLayers[layer].begin(); it != PMONITOR->m_aLayerSurfaceLayers[layer].end(); it++) { for (auto it = PMONITOR->m_aLayerSurfaceLayers[m_layer].begin(); it != PMONITOR->m_aLayerSurfaceLayers[m_layer].end(); it++) {
if (*it == self) { if (*it == m_self) {
if (layerSurface->current.layer == layer) if (m_layerSurface->current.layer == m_layer)
break; break;
PMONITOR->m_aLayerSurfaceLayers[layerSurface->current.layer].emplace_back(*it); PMONITOR->m_aLayerSurfaceLayers[m_layerSurface->current.layer].emplace_back(*it);
PMONITOR->m_aLayerSurfaceLayers[layer].erase(it); PMONITOR->m_aLayerSurfaceLayers[m_layer].erase(it);
break; 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 g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd
} }
@@ -305,136 +305,136 @@ void CLayerSurface::onCommit() {
PMONITOR->scheduledRecalc = true; PMONITOR->scheduledRecalc = true;
} else { } else {
position = Vector2D(geometry.x, geometry.y); m_position = Vector2D(m_geometry.x, m_geometry.y);
// update geom if it changed // 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. // fractional scaling. Dirty hack.
geometry = {geometry.pos(), layerSurface->surface->current.viewport.destination}; m_geometry = {m_geometry.pos(), m_layerSurface->surface->current.viewport.destination};
} else { } else {
// this is because some apps like e.g. rofi-lbonn can't fucking use the protocol correctly. // 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 (m_realPosition->goal() != m_geometry.pos()) {
if (realPosition->isBeingAnimated()) if (m_realPosition->isBeingAnimated())
*realPosition = geometry.pos(); *m_realPosition = m_geometry.pos();
else else
realPosition->setValueAndWarp(geometry.pos()); m_realPosition->setValueAndWarp(m_geometry.pos());
} }
if (realSize->goal() != geometry.size()) { if (m_realSize->goal() != m_geometry.size()) {
if (realSize->isBeingAnimated()) if (m_realSize->isBeingAnimated())
*realSize = geometry.size(); *m_realSize = m_geometry.size();
else 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; bool WASLASTFOCUS = false;
layerSurface->surface->breadthfirst( m_layerSurface->surface->breadthfirst(
[&WASLASTFOCUS](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) { WASLASTFOCUS = WASLASTFOCUS || g_pSeatManager->state.keyboardFocus == surf; }, [&WASLASTFOCUS](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) { WASLASTFOCUS = WASLASTFOCUS || g_pSeatManager->state.keyboardFocus == surf; },
nullptr); nullptr);
if (!WASLASTFOCUS && popupHead) { if (!WASLASTFOCUS && m_popupHead) {
popupHead->breadthfirst( m_popupHead->breadthfirst(
[&WASLASTFOCUS](WP<CPopup> popup, void* data) { [&WASLASTFOCUS](WP<CPopup> 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); nullptr);
} }
const bool WASEXCLUSIVE = interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE; const bool WASEXCLUSIVE = m_interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE;
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 (!WASEXCLUSIVE && ISEXCLUSIVE) if (!WASEXCLUSIVE && ISEXCLUSIVE)
g_pInputManager->m_dExclusiveLSes.push_back(self); g_pInputManager->m_dExclusiveLSes.push_back(m_self);
else if (WASEXCLUSIVE && !ISEXCLUSIVE) 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 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, // moveMouseUnified won't focus non interactive layers but it won't unfocus them either,
// so unfocus the surface here. // so unfocus the surface here.
g_pCompositor->focusSurface(nullptr); g_pCompositor->focusSurface(nullptr);
g_pInputManager->refocusLastWindow(monitor.lock()); g_pInputManager->refocusLastWindow(m_monitor.lock());
} else if (WASLASTFOCUS && WASEXCLUSIVE && layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) { } else if (WASLASTFOCUS && WASEXCLUSIVE && m_layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) {
g_pInputManager->simulateMouseMovement(); g_pInputManager->simulateMouseMovement();
} else if (!WASEXCLUSIVE && ISEXCLUSIVE) { } else if (!WASEXCLUSIVE && ISEXCLUSIVE) {
// if now exclusive and not previously // if now exclusive and not previously
g_pSeatManager->setGrab(nullptr); g_pSeatManager->setGrab(nullptr);
g_pInputManager->releaseAllMouseButtons(); 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); const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y);
g_pSeatManager->setPointerFocus(surface->resource(), LOCAL); g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL);
g_pInputManager->m_bEmptyFocusCursorSet = false; 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->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->scale);
g_pCompositor->setPreferredTransformForSurface(surface->resource(), PMONITOR->transform); g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->transform);
} }
void CLayerSurface::applyRules() { void CLayerSurface::applyRules() {
noAnimations = false; m_noAnimations = false;
forceBlur = false; m_forceBlur = false;
ignoreAlpha = false; m_ignoreAlpha = false;
ignoreAlphaValue = 0.f; m_ignoreAlphaValue = 0.f;
dimAround = false; m_dimAround = false;
xray = -1; m_xray = -1;
animationStyle.reset(); m_animationStyle.reset();
for (auto const& rule : g_pConfigManager->getMatchingRules(self.lock())) { for (auto const& rule : g_pConfigManager->getMatchingRules(m_self.lock())) {
switch (rule->ruleType) { switch (rule->m_ruleType) {
case CLayerRule::RULE_NOANIM: { case CLayerRule::RULE_NOANIM: {
noAnimations = true; m_noAnimations = true;
break; break;
} }
case CLayerRule::RULE_BLUR: { case CLayerRule::RULE_BLUR: {
forceBlur = true; m_forceBlur = true;
break; break;
} }
case CLayerRule::RULE_BLURPOPUPS: { case CLayerRule::RULE_BLURPOPUPS: {
forceBlurPopups = true; m_forceBlurPopups = true;
break; break;
} }
case CLayerRule::RULE_IGNOREALPHA: case CLayerRule::RULE_IGNOREALPHA:
case CLayerRule::RULE_IGNOREZERO: { 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 = ""; std::string alphaValue = "";
if (FIRST_SPACE_POS != std::string::npos) 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 { try {
ignoreAlpha = true; m_ignoreAlpha = true;
if (!alphaValue.empty()) if (!alphaValue.empty())
ignoreAlphaValue = std::stof(alphaValue); m_ignoreAlphaValue = std::stof(alphaValue);
} catch (...) { Debug::log(ERR, "Invalid value passed to ignoreAlpha"); } } catch (...) { Debug::log(ERR, "Invalid value passed to ignoreAlpha"); }
break; break;
} }
case CLayerRule::RULE_DIMAROUND: { case CLayerRule::RULE_DIMAROUND: {
dimAround = true; m_dimAround = true;
break; break;
} }
case CLayerRule::RULE_XRAY: { case CLayerRule::RULE_XRAY: {
CVarList vars{rule->rule, 0, ' '}; CVarList vars{rule->m_rule, 0, ' '};
try { try {
xray = configStringToInt(vars[1]).value_or(false); m_xray = configStringToInt(vars[1]).value_or(false);
} catch (...) {} } catch (...) {}
break; break;
} }
case CLayerRule::RULE_ANIMATION: { case CLayerRule::RULE_ANIMATION: {
CVarList vars{rule->rule, 2, 's'}; CVarList vars{rule->m_rule, 2, 's'};
animationStyle = vars[1]; m_animationStyle = vars[1];
break; break;
} }
case CLayerRule::RULE_ORDER: { case CLayerRule::RULE_ORDER: {
CVarList vars{rule->rule, 2, 's'}; CVarList vars{rule->m_rule, 2, 's'};
try { try {
order = std::stoi(vars[1]); m_order = std::stoi(vars[1]);
} catch (...) { Debug::log(ERR, "Invalid value passed to order"); } } catch (...) { Debug::log(ERR, "Invalid value passed to order"); }
break; break;
} }
@@ -445,19 +445,19 @@ void CLayerSurface::applyRules() {
void CLayerSurface::startAnimation(bool in, bool instant) { void CLayerSurface::startAnimation(bool in, bool instant) {
if (in) { if (in) {
realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersIn")); m_realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersIn"));
realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersIn")); m_realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersIn"));
alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn")); m_alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn"));
} else { } else {
realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersOut")); m_realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersOut"));
realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersOut")); m_realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("layersOut"));
alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeLayersOut")); 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")) { if (ANIMSTYLE.starts_with("slide")) {
// get closest edge // get closest edge
const auto MIDDLE = geometry.middle(); const auto MIDDLE = m_geometry.middle();
const auto PMONITOR = g_pCompositor->getMonitorFromVector(MIDDLE); const auto PMONITOR = g_pCompositor->getMonitorFromVector(MIDDLE);
@@ -495,38 +495,38 @@ void CLayerSurface::startAnimation(bool in, bool instant) {
} }
} }
realSize->setValueAndWarp(geometry.size()); m_realSize->setValueAndWarp(m_geometry.size());
alpha->setValueAndWarp(in ? 0.f : 1.f); m_alpha->setValueAndWarp(in ? 0.f : 1.f);
*alpha = in ? 1.f : 0.f; *m_alpha = in ? 1.f : 0.f;
Vector2D prePos; Vector2D prePos;
switch (leader) { switch (leader) {
case 0: case 0:
// TOP // TOP
prePos = {geometry.x, PMONITOR->vecPosition.y - geometry.h}; prePos = {m_geometry.x, PMONITOR->vecPosition.y - m_geometry.h};
break; break;
case 1: case 1:
// BOTTOM // BOTTOM
prePos = {geometry.x, PMONITOR->vecPosition.y + PMONITOR->vecSize.y}; prePos = {m_geometry.x, PMONITOR->vecPosition.y + PMONITOR->vecSize.y};
break; break;
case 2: case 2:
// LEFT // LEFT
prePos = {PMONITOR->vecPosition.x - geometry.w, geometry.y}; prePos = {PMONITOR->vecPosition.x - m_geometry.w, m_geometry.y};
break; break;
case 3: case 3:
// RIGHT // RIGHT
prePos = {PMONITOR->vecPosition.x + PMONITOR->vecSize.x, geometry.y}; prePos = {PMONITOR->vecPosition.x + PMONITOR->vecSize.x, m_geometry.y};
break; break;
default: UNREACHABLE(); default: UNREACHABLE();
} }
if (in) { if (in) {
realPosition->setValueAndWarp(prePos); m_realPosition->setValueAndWarp(prePos);
*realPosition = geometry.pos(); *m_realPosition = m_geometry.pos();
} else { } else {
realPosition->setValueAndWarp(geometry.pos()); m_realPosition->setValueAndWarp(m_geometry.pos());
*realPosition = prePos; *m_realPosition = prePos;
} }
} else if (ANIMSTYLE.starts_with("popin")) { } else if (ANIMSTYLE.starts_with("popin")) {
@@ -542,62 +542,62 @@ void CLayerSurface::startAnimation(bool in, bool instant) {
minPerc *= 0.01; minPerc *= 0.01;
const auto GOALSIZE = (geometry.size() * minPerc).clamp({5, 5}); const auto GOALSIZE = (m_geometry.size() * minPerc).clamp({5, 5});
const auto GOALPOS = geometry.pos() + (geometry.size() - GOALSIZE) / 2.f; const auto GOALPOS = m_geometry.pos() + (m_geometry.size() - GOALSIZE) / 2.f;
alpha->setValueAndWarp(in ? 0.f : 1.f); m_alpha->setValueAndWarp(in ? 0.f : 1.f);
*alpha = in ? 1.f : 0.f; *m_alpha = in ? 1.f : 0.f;
if (in) { if (in) {
realSize->setValueAndWarp(GOALSIZE); m_realSize->setValueAndWarp(GOALSIZE);
realPosition->setValueAndWarp(GOALPOS); m_realPosition->setValueAndWarp(GOALPOS);
*realSize = geometry.size(); *m_realSize = m_geometry.size();
*realPosition = geometry.pos(); *m_realPosition = m_geometry.pos();
} else { } else {
realSize->setValueAndWarp(geometry.size()); m_realSize->setValueAndWarp(m_geometry.size());
realPosition->setValueAndWarp(geometry.pos()); m_realPosition->setValueAndWarp(m_geometry.pos());
*realSize = GOALSIZE; *m_realSize = GOALSIZE;
*realPosition = GOALPOS; *m_realPosition = GOALPOS;
} }
} else { } else {
// fade // fade
realPosition->setValueAndWarp(geometry.pos()); m_realPosition->setValueAndWarp(m_geometry.pos());
realSize->setValueAndWarp(geometry.size()); m_realSize->setValueAndWarp(m_geometry.size());
*alpha = in ? 1.f : 0.f; *m_alpha = in ? 1.f : 0.f;
} }
if (!in) if (!in)
fadingOut = true; m_fadingOut = true;
} }
bool CLayerSurface::isFadedOut() { bool CLayerSurface::isFadedOut() {
if (!fadingOut) if (!m_fadingOut)
return false; return false;
return !realPosition->isBeingAnimated() && !realSize->isBeingAnimated() && !alpha->isBeingAnimated(); return !m_realPosition->isBeingAnimated() && !m_realSize->isBeingAnimated() && !m_alpha->isBeingAnimated();
} }
int CLayerSurface::popupsCount() { int CLayerSurface::popupsCount() {
if (!layerSurface || !mapped || fadingOut) if (!m_layerSurface || !m_mapped || m_fadingOut)
return 0; return 0;
int no = -1; // we have one dummy int no = -1; // we have one dummy
popupHead->breadthfirst([](WP<CPopup> p, void* data) { *(int*)data += 1; }, &no); m_popupHead->breadthfirst([](WP<CPopup> p, void* data) { *(int*)data += 1; }, &no);
return no; return no;
} }
MONITORID CLayerSurface::monitorID() { MONITORID CLayerSurface::monitorID() {
return monitor ? monitor->ID : MONITOR_INVALID; return m_monitor ? m_monitor->ID : MONITOR_INVALID;
} }
pid_t CLayerSurface::getPID() { pid_t CLayerSurface::getPID() {
pid_t PID = -1; pid_t PID = -1;
if (!layerSurface || !layerSurface->surface || !layerSurface->surface->getResource() || !layerSurface->surface->getResource()->resource() || if (!m_layerSurface || !m_layerSurface->surface || !m_layerSurface->surface->getResource() || !m_layerSurface->surface->getResource()->resource() ||
!layerSurface->surface->getResource()->resource()->client) !m_layerSurface->surface->getResource()->resource()->client)
return -1; 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; return PID;
} }

View File

@@ -22,44 +22,43 @@ class CLayerSurface {
bool isFadedOut(); bool isFadedOut();
int popupsCount(); int popupsCount();
PHLANIMVAR<Vector2D> realPosition; PHLANIMVAR<Vector2D> m_realPosition;
PHLANIMVAR<Vector2D> realSize; PHLANIMVAR<Vector2D> m_realSize;
PHLANIMVAR<float> alpha; PHLANIMVAR<float> m_alpha;
WP<CLayerShellResource> layerSurface; WP<CLayerShellResource> m_layerSurface;
wl_list link;
// the header providing the enum type cannot be imported here // the header providing the enum type cannot be imported here
int interactivity = 0; int m_interactivity = 0;
SP<CWLSurface> surface; SP<CWLSurface> m_surface;
bool mapped = false; bool m_mapped = false;
uint32_t layer = 0; uint32_t m_layer = 0;
PHLMONITORREF monitor; PHLMONITORREF m_monitor;
bool fadingOut = false; bool m_fadingOut = false;
bool readyToDelete = false; bool m_readyToDelete = false;
bool noProcess = false; bool m_noProcess = false;
bool noAnimations = false; bool m_noAnimations = false;
bool forceBlur = false; bool m_forceBlur = false;
bool forceBlurPopups = false; bool m_forceBlurPopups = false;
int64_t xray = -1; int64_t m_xray = -1;
bool ignoreAlpha = false; bool m_ignoreAlpha = false;
float ignoreAlphaValue = 0.f; float m_ignoreAlphaValue = 0.f;
bool dimAround = false; bool m_dimAround = false;
int64_t order = 0; int64_t m_order = 0;
std::optional<std::string> animationStyle; std::optional<std::string> m_animationStyle;
PHLLSREF self; PHLLSREF m_self;
CBox geometry = {0, 0, 0, 0}; CBox m_geometry = {0, 0, 0, 0};
Vector2D position; Vector2D m_position;
std::string szNamespace = ""; std::string m_namespace = "";
UP<CPopup> popupHead; UP<CPopup> m_popupHead;
pid_t getPID(); pid_t getPID();
@@ -75,12 +74,12 @@ class CLayerSurface {
CHyprSignalListener map; CHyprSignalListener map;
CHyprSignalListener unmap; CHyprSignalListener unmap;
CHyprSignalListener commit; CHyprSignalListener commit;
} listeners; } m_listeners;
void registerCallbacks(); void registerCallbacks();
// For the list lookup // For the list lookup
bool operator==(const CLayerSurface& rhs) const { bool operator==(const CLayerSurface& rhs) const {
return layerSurface == rhs.layerSurface && monitor == rhs.monitor; return m_layerSurface == rhs.m_layerSurface && m_monitor == rhs.m_monitor;
} }
}; };

View File

@@ -13,32 +13,32 @@
#include <ranges> #include <ranges>
UP<CPopup> CPopup::create(PHLWINDOW pOwner) { UP<CPopup> CPopup::create(PHLWINDOW pOwner) {
auto popup = UP<CPopup>(new CPopup()); auto popup = UP<CPopup>(new CPopup());
popup->m_pWindowOwner = pOwner; popup->m_windowOwner = pOwner;
popup->m_pSelf = popup; popup->m_self = popup;
popup->initAllSignals(); popup->initAllSignals();
return popup; return popup;
} }
UP<CPopup> CPopup::create(PHLLS pOwner) { UP<CPopup> CPopup::create(PHLLS pOwner) {
auto popup = UP<CPopup>(new CPopup()); auto popup = UP<CPopup>(new CPopup());
popup->m_pLayerOwner = pOwner; popup->m_layerOwner = pOwner;
popup->m_pSelf = popup; popup->m_self = popup;
popup->initAllSignals(); popup->initAllSignals();
return popup; return popup;
} }
UP<CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<CPopup> pOwner) { UP<CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<CPopup> pOwner) {
auto popup = UP<CPopup>(new CPopup()); auto popup = UP<CPopup>(new CPopup());
popup->m_pResource = resource; popup->m_resource = resource;
popup->m_pWindowOwner = pOwner->m_pWindowOwner; popup->m_windowOwner = pOwner->m_windowOwner;
popup->m_pLayerOwner = pOwner->m_pLayerOwner; popup->m_layerOwner = pOwner->m_layerOwner;
popup->m_pParent = pOwner; popup->m_parent = pOwner;
popup->m_pSelf = popup; popup->m_self = popup;
popup->m_pWLSurface = CWLSurface::create(); popup->m_wlSurface = CWLSurface::create();
popup->m_pWLSurface->assign(resource->surface->surface.lock(), popup.get()); 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->reposition();
popup->initAllSignals(); popup->initAllSignals();
@@ -46,104 +46,106 @@ UP<CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<CPopup> pOwner) {
} }
CPopup::~CPopup() { CPopup::~CPopup() {
if (m_pWLSurface) if (m_wlSurface)
m_pWLSurface->unassign(); m_wlSurface->unassign();
} }
void CPopup::initAllSignals() { void CPopup::initAllSignals() {
if (!m_pResource) { if (!m_resource) {
if (!m_pWindowOwner.expired()) if (!m_windowOwner.expired())
listeners.newPopup = m_pWindowOwner->m_pXDGSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast<SP<CXDGPopupResource>>(d)); }); m_listeners.newPopup =
else if (!m_pLayerOwner.expired()) m_windowOwner->m_pXDGSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast<SP<CXDGPopupResource>>(d)); });
listeners.newPopup = m_pLayerOwner->layerSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast<SP<CXDGPopupResource>>(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<SP<CXDGPopupResource>>(d)); });
else else
ASSERT(false); ASSERT(false);
return; return;
} }
listeners.reposition = m_pResource->events.reposition.registerListener([this](std::any d) { this->onReposition(); }); m_listeners.reposition = m_resource->events.reposition.registerListener([this](std::any d) { this->onReposition(); });
listeners.map = m_pResource->surface->events.map.registerListener([this](std::any d) { this->onMap(); }); m_listeners.map = m_resource->surface->events.map.registerListener([this](std::any d) { this->onMap(); });
listeners.unmap = m_pResource->surface->events.unmap.registerListener([this](std::any d) { this->onUnmap(); }); m_listeners.unmap = m_resource->surface->events.unmap.registerListener([this](std::any d) { this->onUnmap(); });
listeners.dismissed = m_pResource->events.dismissed.registerListener([this](std::any d) { this->onUnmap(); }); m_listeners.dismissed = m_resource->events.dismissed.registerListener([this](std::any d) { this->onUnmap(); });
listeners.destroy = m_pResource->surface->events.destroy.registerListener([this](std::any d) { this->onDestroy(); }); m_listeners.destroy = m_resource->surface->events.destroy.registerListener([this](std::any d) { this->onDestroy(); });
listeners.commit = m_pResource->surface->events.commit.registerListener([this](std::any d) { this->onCommit(); }); m_listeners.commit = m_resource->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<SP<CXDGPopupResource>>(d)); }); m_listeners.newPopup = m_resource->surface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast<SP<CXDGPopupResource>>(d)); });
} }
void CPopup::onNewPopup(SP<CXDGPopupResource> popup) { void CPopup::onNewPopup(SP<CXDGPopupResource> popup) {
const auto& POPUP = m_vChildren.emplace_back(CPopup::create(popup, m_pSelf)); const auto& POPUP = m_children.emplace_back(CPopup::create(popup, m_self));
POPUP->m_pSelf = POPUP; POPUP->m_self = POPUP;
Debug::log(LOG, "New popup at {:x}", (uintptr_t)POPUP); Debug::log(LOG, "New popup at {:x}", (uintptr_t)POPUP);
} }
void CPopup::onDestroy() { void CPopup::onDestroy() {
m_bInert = true; m_inert = true;
if (!m_pParent) if (!m_parent)
return; // head node 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() { void CPopup::onMap() {
if (m_bMapped) if (m_mapped)
return; return;
m_bMapped = true; m_mapped = true;
m_vLastSize = m_pResource->surface->surface->current.size; m_lastSize = m_resource->surface->surface->current.size;
const auto COORDS = coordsGlobal(); const auto COORDS = coordsGlobal();
const auto PMONITOR = g_pCompositor->getMonitorFromVector(COORDS); const auto PMONITOR = g_pCompositor->getMonitorFromVector(COORDS);
CBox box = m_pWLSurface->resource()->extends(); CBox box = m_wlSurface->resource()->extends();
box.translate(COORDS).expand(4); box.translate(COORDS).expand(4);
g_pHyprRenderer->damageBox(box); g_pHyprRenderer->damageBox(box);
m_vLastPos = coordsRelativeToParent(); m_lastPos = coordsRelativeToParent();
g_pInputManager->simulateMouseMovement(); g_pInputManager->simulateMouseMovement();
m_pSubsurfaceHead = CSubsurface::create(m_pSelf); m_subsurfaceHead = CSubsurface::create(m_self);
//unconstrain(); //unconstrain();
sendScale(); 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) if (!m_layerOwner.expired() && m_layerOwner->m_layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP)
g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_pLayerOwner->layer)); g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_layerOwner->m_layer));
} }
void CPopup::onUnmap() { void CPopup::onUnmap() {
if (!m_bMapped) if (!m_mapped)
return; return;
if (!m_pResource || !m_pResource->surface) { if (!m_resource || !m_resource->surface) {
Debug::log(ERR, "CPopup: orphaned (no surface/resource) and unmaps??"); Debug::log(ERR, "CPopup: orphaned (no surface/resource) and unmaps??");
onDestroy(); onDestroy();
return; 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(); const auto COORDS = coordsGlobal();
CBox box = m_pWLSurface->resource()->extends(); CBox box = m_wlSurface->resource()->extends();
box.translate(COORDS).expand(4); box.translate(COORDS).expand(4);
g_pHyprRenderer->damageBox(box); g_pHyprRenderer->damageBox(box);
m_pSubsurfaceHead.reset(); m_subsurfaceHead.reset();
if (!m_pLayerOwner.expired() && m_pLayerOwner->layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP) if (!m_layerOwner.expired() && m_layerOwner->m_layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP)
g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_pLayerOwner->layer)); g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_layerOwner->m_layer));
// damage all children // damage all children
breadthfirst( breadthfirst(
[](WP<CPopup> p, void* data) { [](WP<CPopup> p, void* data) {
if (!p->m_pResource) if (!p->m_resource)
return; return;
auto box = CBox{p->coordsGlobal(), p->size()}; auto box = CBox{p->coordsGlobal(), p->size()};
@@ -159,59 +161,59 @@ void CPopup::onUnmap() {
} }
void CPopup::onCommit(bool ignoreSiblings) { 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??"); Debug::log(ERR, "CPopup: orphaned (no surface/resource) and commits??");
onDestroy(); onDestroy();
return; return;
} }
if (m_pResource->surface->initialCommit) { if (m_resource->surface->initialCommit) {
m_pResource->surface->scheduleConfigure(); m_resource->surface->scheduleConfigure();
return; return;
} }
if (!m_pWindowOwner.expired() && (!m_pWindowOwner->m_bIsMapped || !m_pWindowOwner->m_pWorkspace->m_bVisible)) { if (!m_windowOwner.expired() && (!m_windowOwner->m_bIsMapped || !m_windowOwner->m_pWorkspace->m_bVisible)) {
m_vLastSize = m_pResource->surface->surface->current.size; m_lastSize = m_resource->surface->surface->current.size;
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage"); static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
if (*PLOGDAMAGE) 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; return;
} }
if (!m_pResource->surface->mapped) if (!m_resource->surface->mapped)
return; return;
const auto COORDS = coordsGlobal(); const auto COORDS = coordsGlobal();
const auto COORDSLOCAL = coordsRelativeToParent(); const auto COORDSLOCAL = coordsRelativeToParent();
if (m_vLastSize != m_pResource->surface->surface->current.size || m_bRequestedReposition || m_vLastPos != COORDSLOCAL) { if (m_lastSize != m_resource->surface->surface->current.size || m_requestedReposition || m_lastPos != COORDSLOCAL) {
CBox box = {localToGlobal(m_vLastPos), m_vLastSize}; CBox box = {localToGlobal(m_lastPos), m_lastSize};
g_pHyprRenderer->damageBox(box); g_pHyprRenderer->damageBox(box);
m_vLastSize = m_pResource->surface->surface->current.size; m_lastSize = m_resource->surface->surface->current.size;
box = {COORDS, m_vLastSize}; box = {COORDS, m_lastSize};
g_pHyprRenderer->damageBox(box); g_pHyprRenderer->damageBox(box);
m_vLastPos = COORDSLOCAL; m_lastPos = COORDSLOCAL;
} }
if (!ignoreSiblings && m_pSubsurfaceHead) if (!ignoreSiblings && m_subsurfaceHead)
m_pSubsurfaceHead->recheckDamageForSubsurfaces(); 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) if (!m_layerOwner.expired() && m_layerOwner->m_layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP)
g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_pLayerOwner->layer)); g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_layerOwner->m_layer));
} }
void CPopup::onReposition() { void CPopup::onReposition() {
Debug::log(LOG, "Popup {:x} requests reposition", (uintptr_t)this); Debug::log(LOG, "Popup {:x} requests reposition", (uintptr_t)this);
m_bRequestedReposition = true; m_requestedReposition = true;
m_vLastPos = coordsRelativeToParent(); m_lastPos = coordsRelativeToParent();
reposition(); reposition();
} }
@@ -224,31 +226,31 @@ void CPopup::reposition() {
return; return;
CBox box = {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; 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<CWLSurface> CPopup::getT1Owner() { SP<CWLSurface> CPopup::getT1Owner() {
if (m_pWindowOwner) if (m_windowOwner)
return m_pWindowOwner->m_pWLSurface; return m_windowOwner->m_pWLSurface;
else else
return m_pLayerOwner->surface; return m_layerOwner->m_surface;
} }
Vector2D CPopup::coordsRelativeToParent() { Vector2D CPopup::coordsRelativeToParent() {
Vector2D offset; Vector2D offset;
if (!m_pResource) if (!m_resource)
return {}; return {};
WP<CPopup> current = m_pSelf; WP<CPopup> current = m_self;
offset -= current->m_pResource->surface->current.geometry.pos(); 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_wlSurface->resource()->current.offset;
offset += current->m_pResource->geometry.pos(); offset += current->m_resource->geometry.pos();
current = current->m_pParent; current = current->m_parent;
} }
return offset; return offset;
@@ -263,30 +265,30 @@ Vector2D CPopup::localToGlobal(const Vector2D& rel) {
} }
Vector2D CPopup::t1ParentCoords() { Vector2D CPopup::t1ParentCoords() {
if (!m_pWindowOwner.expired()) if (!m_windowOwner.expired())
return m_pWindowOwner->m_vRealPosition->value(); return m_windowOwner->m_vRealPosition->value();
if (!m_pLayerOwner.expired()) if (!m_layerOwner.expired())
return m_pLayerOwner->realPosition->value(); return m_layerOwner->m_realPosition->value();
ASSERT(false); ASSERT(false);
return {}; return {};
} }
void CPopup::recheckTree() { void CPopup::recheckTree() {
WP<CPopup> curr = m_pSelf; WP<CPopup> curr = m_self;
while (curr->m_pParent) { while (curr->m_parent) {
curr = curr->m_pParent; curr = curr->m_parent;
} }
curr->recheckChildrenRecursive(); curr->recheckChildrenRecursive();
} }
void CPopup::recheckChildrenRecursive() { void CPopup::recheckChildrenRecursive() {
if (m_bInert || !m_pWLSurface) if (m_inert || !m_wlSurface)
return; return;
std::vector<WP<CPopup>> cpy; std::vector<WP<CPopup>> 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) { for (auto const& c : cpy) {
c->onCommit(true); c->onCommit(true);
c->recheckChildrenRecursive(); c->recheckChildrenRecursive();
@@ -294,25 +296,25 @@ void CPopup::recheckChildrenRecursive() {
} }
Vector2D CPopup::size() { Vector2D CPopup::size() {
return m_vLastSize; return m_lastSize;
} }
void CPopup::sendScale() { void CPopup::sendScale() {
if (!m_pWindowOwner.expired()) if (!m_windowOwner.expired())
g_pCompositor->setPreferredScaleForSurface(m_pWLSurface->resource(), m_pWindowOwner->m_pWLSurface->m_fLastScale); g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_windowOwner->m_pWLSurface->m_fLastScale);
else if (!m_pLayerOwner.expired()) else if (!m_layerOwner.expired())
g_pCompositor->setPreferredScaleForSurface(m_pWLSurface->resource(), m_pLayerOwner->surface->m_fLastScale); g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_layerOwner->m_surface->m_fLastScale);
else else
UNREACHABLE(); UNREACHABLE();
} }
bool CPopup::visible() { bool CPopup::visible() {
if (!m_pWindowOwner.expired()) if (!m_windowOwner.expired())
return g_pHyprRenderer->shouldRenderWindow(m_pWindowOwner.lock()); return g_pHyprRenderer->shouldRenderWindow(m_windowOwner.lock());
if (!m_pLayerOwner.expired()) if (!m_layerOwner.expired())
return true; return true;
if (m_pParent) if (m_parent)
return m_pParent->visible(); return m_parent->visible();
return false; return false;
} }
@@ -326,8 +328,8 @@ void CPopup::bfHelper(std::vector<WP<CPopup>> const& nodes, std::function<void(W
nodes2.reserve(nodes.size() * 2); nodes2.reserve(nodes.size() * 2);
for (auto const& n : nodes) { for (auto const& n : nodes) {
for (auto const& c : n->m_vChildren) { for (auto const& c : n->m_children) {
nodes2.push_back(c->m_pSelf); nodes2.push_back(c->m_self);
} }
} }
@@ -337,7 +339,7 @@ void CPopup::bfHelper(std::vector<WP<CPopup>> const& nodes, std::function<void(W
void CPopup::breadthfirst(std::function<void(WP<CPopup>, void*)> fn, void* data) { void CPopup::breadthfirst(std::function<void(WP<CPopup>, void*)> fn, void* data) {
std::vector<WP<CPopup>> popups; std::vector<WP<CPopup>> popups;
popups.push_back(m_pSelf); popups.push_back(m_self);
bfHelper(popups, fn, data); bfHelper(popups, fn, data);
} }
@@ -346,14 +348,14 @@ WP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
breadthfirst([&popups](WP<CPopup> popup, void* data) { popups.push_back(popup); }, &popups); breadthfirst([&popups](WP<CPopup> popup, void* data) { popups.push_back(popup); }, &popups);
for (auto const& p : popups | std::views::reverse) { for (auto const& p : popups | std::views::reverse) {
if (!p->m_pResource || !p->m_bMapped) if (!p->m_resource || !p->m_mapped)
continue; continue;
if (!allowsInput) { 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 offset = HASSURFACE ? p->m_resource->surface->current.geometry.pos() : Vector2D{};
Vector2D size = HASSURFACE ? p->m_pResource->surface->current.geometry.size() : p->size(); Vector2D size = HASSURFACE ? p->m_resource->surface->current.geometry.size() : p->size();
if (size == Vector2D{}) if (size == Vector2D{})
size = p->size(); size = p->size();
@@ -362,7 +364,7 @@ WP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
if (BOX.containsPoint(globalCoords)) if (BOX.containsPoint(globalCoords))
return p; return p;
} else { } 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)) if (REGION.containsPoint(globalCoords))
return p; return p;
} }
@@ -372,5 +374,5 @@ WP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
} }
bool CPopup::inert() const { bool CPopup::inert() const {
return m_bInert; return m_inert;
} }

View File

@@ -41,32 +41,32 @@ class CPopup {
WP<CPopup> at(const Vector2D& globalCoords, bool allowsInput = false); WP<CPopup> at(const Vector2D& globalCoords, bool allowsInput = false);
// //
SP<CWLSurface> m_pWLSurface; SP<CWLSurface> m_wlSurface;
WP<CPopup> m_pSelf; WP<CPopup> m_self;
bool m_bMapped = false; bool m_mapped = false;
private: private:
CPopup() = default; CPopup() = default;
// T1 owners, each popup has to have one of these // T1 owners, each popup has to have one of these
PHLWINDOWREF m_pWindowOwner; PHLWINDOWREF m_windowOwner;
PHLLSREF m_pLayerOwner; PHLLSREF m_layerOwner;
// T2 owners // T2 owners
WP<CPopup> m_pParent; WP<CPopup> m_parent;
WP<CXDGPopupResource> m_pResource; WP<CXDGPopupResource> m_resource;
Vector2D m_vLastSize = {}; Vector2D m_lastSize = {};
Vector2D m_vLastPos = {}; Vector2D m_lastPos = {};
bool m_bRequestedReposition = false; bool m_requestedReposition = false;
bool m_bInert = false; bool m_inert = false;
// //
std::vector<UP<CPopup>> m_vChildren; std::vector<UP<CPopup>> m_children;
UP<CSubsurface> m_pSubsurfaceHead; UP<CSubsurface> m_subsurfaceHead;
struct { struct {
CHyprSignalListener newPopup; CHyprSignalListener newPopup;
@@ -76,7 +76,7 @@ class CPopup {
CHyprSignalListener commit; CHyprSignalListener commit;
CHyprSignalListener dismissed; CHyprSignalListener dismissed;
CHyprSignalListener reposition; CHyprSignalListener reposition;
} listeners; } m_listeners;
void initAllSignals(); void initAllSignals();
void reposition(); void reposition();

View File

@@ -22,7 +22,7 @@ UP<CSubsurface> CSubsurface::create(WP<CPopup> pOwner) {
subsurface->m_pPopupParent = pOwner; subsurface->m_pPopupParent = pOwner;
subsurface->m_pSelf = subsurface; subsurface->m_pSelf = subsurface;
subsurface->initSignals(); subsurface->initSignals();
subsurface->initExistingSubsurfaces(pOwner->m_pWLSurface->resource()); subsurface->initExistingSubsurfaces(pOwner->m_wlSurface->resource());
return subsurface; return subsurface;
} }
@@ -63,7 +63,7 @@ void CSubsurface::initSignals() {
listeners.newSubsurface = m_pWindowParent->m_pWLSurface->resource()->events.newSubsurface.registerListener( listeners.newSubsurface = m_pWindowParent->m_pWLSurface->resource()->events.newSubsurface.registerListener(
[this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); }); [this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
else if (m_pPopupParent) 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<SP<CWLSubsurfaceResource>>(d)); }); [this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
else else
ASSERT(false); ASSERT(false);
@@ -107,7 +107,7 @@ void CSubsurface::onCommit() {
g_pHyprRenderer->damageSurface(m_pWLSurface->resource(), COORDS.x, COORDS.y); 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(); m_pPopupParent->recheckTree();
if (!m_pWindowParent.expired()) // I hate you firefox why are you doing this if (!m_pWindowParent.expired()) // I hate you firefox why are you doing this
m_pWindowParent->m_pPopupHead->recheckTree(); m_pWindowParent->m_pPopupHead->recheckTree();

View File

@@ -190,7 +190,7 @@ std::optional<CBox> CWLSurface::getSurfaceBoxGlobal() const {
if (!m_pWindowOwner.expired()) if (!m_pWindowOwner.expired())
return m_pWindowOwner->getWindowMainSurfaceBox(); return m_pWindowOwner->getWindowMainSurfaceBox();
if (!m_pLayerOwner.expired()) if (!m_pLayerOwner.expired())
return m_pLayerOwner->geometry; return m_pLayerOwner->m_geometry;
if (m_pPopupOwner) if (m_pPopupOwner)
return CBox{m_pPopupOwner->coordsGlobal(), m_pPopupOwner->size()}; return CBox{m_pPopupOwner->coordsGlobal(), m_pPopupOwner->size()};
if (m_pSubsurfaceOwner) if (m_pSubsurfaceOwner)
@@ -228,7 +228,7 @@ SP<CWLSurface> CWLSurface::fromResource(SP<CWLSurfaceResource> pSurface) {
bool CWLSurface::keyboardFocusable() const { bool CWLSurface::keyboardFocusable() const {
if (m_pWindowOwner || m_pPopupOwner || m_pSubsurfaceOwner) if (m_pWindowOwner || m_pPopupOwner || m_pSubsurfaceOwner)
return true; return true;
if (m_pLayerOwner && m_pLayerOwner->layerSurface) if (m_pLayerOwner && m_pLayerOwner->m_layerSurface)
return m_pLayerOwner->layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE; return m_pLayerOwner->m_layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
return false; return false;
} }

View File

@@ -162,7 +162,7 @@ SBoxExtents CWindow::getFullWindowExtents() {
// TODO: this could be better, perhaps make a getFullWindowRegion? // TODO: this could be better, perhaps make a getFullWindowRegion?
m_pPopupHead->breadthfirst( m_pPopupHead->breadthfirst(
[](WP<CPopup> popup, void* data) { [](WP<CPopup> popup, void* data) {
if (!popup->m_pWLSurface || !popup->m_pWLSurface->resource()) if (!popup->m_wlSurface || !popup->m_wlSurface->resource())
return; return;
CBox* pSurfaceExtents = (CBox*)data; CBox* pSurfaceExtents = (CBox*)data;
@@ -870,7 +870,7 @@ bool CWindow::hasPopupAt(const Vector2D& pos) {
auto popup = m_pPopupHead->at(pos); auto popup = m_pPopupHead->at(pos);
return popup && popup->m_pWLSurface->resource(); return popup && popup->m_wlSurface->resource();
} }
void CWindow::applyGroupRules() { void CWindow::applyGroupRules() {

View File

@@ -581,7 +581,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
// check LS focus grab // check LS focus grab
const auto PFORCEFOCUS = g_pCompositor->getForceFocus(); const auto PFORCEFOCUS = g_pCompositor->getForceFocus();
const auto PLSFROMFOCUS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock()); 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; PWINDOW->m_bNoInitialFocus = true;
if (PWINDOW->m_pWorkspace->m_bHasFullscreenWindow && !requestedInternalFSMode.has_value() && !requestedClientFSMode.has_value() && !PWINDOW->m_bIsFloating) { if (PWINDOW->m_pWorkspace->m_bHasFullscreenWindow && !requestedInternalFSMode.has_value() && !requestedClientFSMode.has_value() && !PWINDOW->m_bIsFloating) {

View File

@@ -339,8 +339,8 @@ void CMonitor::onDisconnect(bool destroy) {
for (size_t i = 0; i < 4; ++i) { for (size_t i = 0; i < 4; ++i) {
for (auto const& ls : m_aLayerSurfaceLayers[i]) { for (auto const& ls : m_aLayerSurfaceLayers[i]) {
if (ls->layerSurface && !ls->fadingOut) if (ls->m_layerSurface && !ls->m_fadingOut)
ls->layerSurface->sendClosed(); ls->m_layerSurface->sendClosed();
} }
m_aLayerSurfaceLayers[i].clear(); m_aLayerSurfaceLayers[i].clear();
} }

View File

@@ -135,14 +135,14 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
} }
} else if (PLAYER) { } else if (PLAYER) {
// "some fucking layers miss 1 pixel???" -- vaxry // "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); expandBox.expand(5);
g_pHyprRenderer->damageBox(expandBox); 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) if (!PMONITOR)
return; return;
animationsDisabled = animationsDisabled || PLAYER->noAnimations; animationsDisabled = animationsDisabled || PLAYER->m_noAnimations;
} }
const auto SPENT = av.getPercent(); const auto SPENT = av.getPercent();
@@ -174,11 +174,11 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
g_pHyprRenderer->damageWindow(w); g_pHyprRenderer->damageWindow(w);
} }
} else if (PLAYER) { } else if (PLAYER) {
if (PLAYER->layer <= 1) if (PLAYER->m_layer <= 1)
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR);
// some fucking layers miss 1 pixel??? // 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); expandBox.expand(5);
g_pHyprRenderer->damageBox(expandBox); g_pHyprRenderer->damageBox(expandBox);
} }

View File

@@ -618,7 +618,7 @@ void CSeatManager::setGrab(SP<CSeatGrab> grab) {
} }
if (!refocus && layer) 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) { if (refocus) {
auto candidate = g_pCompositor->m_lastWindow.lock(); auto candidate = g_pCompositor->m_lastWindow.lock();

View File

@@ -156,7 +156,7 @@ void CInputManager::sendMotionEventsToFocused() {
const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock()); const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock());
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(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; 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); foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &g_pInputManager->m_dExclusiveLSes, &surfaceCoords, &pFoundLayerSurface);
if (!foundSurface) { if (!foundSurface) {
foundSurface = (*g_pInputManager->m_dExclusiveLSes.begin())->surface->resource(); foundSurface = (*g_pInputManager->m_dExclusiveLSes.begin())->m_surface->resource();
surfacePos = (*g_pInputManager->m_dExclusiveLSes.begin())->realPosition->goal(); 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) { if (!refocus && g_pCompositor->m_lastFocus) {
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock()); 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; allowKeyboardRefocus = false;
} }
@@ -568,8 +568,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
unsetCursorImage(); unsetCursorImage();
} }
if (pFoundLayerSurface && (pFoundLayerSurface->layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) && FOLLOWMOUSE != 3 && if (pFoundLayerSurface && (pFoundLayerSurface->m_layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) && FOLLOWMOUSE != 3 &&
(allowKeyboardRefocus || pFoundLayerSurface->layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)) { (allowKeyboardRefocus || pFoundLayerSurface->m_layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)) {
g_pCompositor->focusSurface(foundSurface); g_pCompositor->focusSurface(foundSurface);
} }
@@ -1456,14 +1456,14 @@ bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {
if (!foundSurface) { if (!foundSurface) {
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
&surfaceCoords, &pFoundLayerSurface); &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; foundSurface = nullptr;
} }
if (!foundSurface) { if (!foundSurface) {
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
&surfaceCoords, &pFoundLayerSurface); &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; foundSurface = nullptr;
} }

View File

@@ -41,7 +41,7 @@ void CInputManager::beginWorkspaceSwipe() {
if (PWORKSPACE->m_bHasFullscreenWindow) { if (PWORKSPACE->m_bHasFullscreenWindow) {
for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) { 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 // apply alpha
for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) { 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;
} }
} }

View File

@@ -42,7 +42,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
if (m_sActiveSwipe.pWorkspaceBegin) { if (m_sActiveSwipe.pWorkspaceBegin) {
return; return;
// TODO: Don't swipe if you touched a floating window. // 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 PWORKSPACE = PMONITOR->activeWorkspace;
const auto STYLE = PWORKSPACE->m_vRenderOffset->getStyle(); const auto STYLE = PWORKSPACE->m_vRenderOffset->getStyle();
const bool VERTANIMS = STYLE == "slidevert" || STYLE.starts_with("slidefadevert"); 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; m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
} }
} else if (!m_sTouchData.touchFocusLS.expired()) { } 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; m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
} else } else
@@ -158,7 +158,7 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) {
g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local); g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local);
} else if (!m_sTouchData.touchFocusLS.expired()) { } 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); g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true);

View File

@@ -2098,7 +2098,7 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) {
for (auto const& m : g_pCompositor->m_monitors) { for (auto const& m : g_pCompositor->m_monitors) {
for (auto const& lsl : m->m_aLayerSurfaceLayers) { for (auto const& lsl : m->m_aLayerSurfaceLayers) {
for (auto const& ls : lsl) { for (auto const& ls : lsl) {
if (!ls->layerSurface || ls->xray != 1) if (!ls->m_layerSurface || ls->m_xray != 1)
continue; continue;
// if (ls->layerSurface->surface->opaque && ls->alpha->value() >= 1.f) // 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()) if (pWindow && pWindow->m_sWindowData.xray.hasValue() && !pWindow->m_sWindowData.xray.valueOrDefault())
return false; return false;
if (pLayer && pLayer->xray == 0) if (pLayer && pLayer->m_xray == 0)
return false; return false;
if ((*PBLURNEWOPTIMIZE && pWindow && !pWindow->m_bIsFloating && !pWindow->onSpecialWorkspace()) || *PBLURXRAY) if ((*PBLURNEWOPTIMIZE && pWindow && !pWindow->m_bIsFloating && !pWindow->onSpecialWorkspace()) || *PBLURXRAY)
return true; 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 true;
return false; return false;

View File

@@ -650,13 +650,13 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
pWindow->m_pPopupHead->breadthfirst( pWindow->m_pPopupHead->breadthfirst(
[this, &renderdata](WP<CPopup> popup, void* data) { [this, &renderdata](WP<CPopup> 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; return;
const auto pos = popup->coordsRelativeToParent(); const auto pos = popup->coordsRelativeToParent();
const Vector2D oldPos = renderdata.pos; const Vector2D oldPos = renderdata.pos;
renderdata.pos += pos; renderdata.pos += pos;
popup->m_pWLSurface->resource()->breadthfirst( popup->m_wlSurface->resource()->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) { [this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
renderdata.localPos = offset; renderdata.localPos = offset;
renderdata.texture = s->current.texture; renderdata.texture = s->current.texture;
@@ -696,14 +696,14 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
static auto PDIMAROUND = CConfigValue<Hyprlang::FLOAT>("decoration:dim_around"); static auto PDIMAROUND = CConfigValue<Hyprlang::FLOAT>("decoration:dim_around");
if (*PDIMAROUND && pLayer->dimAround && !m_bRenderingSnapshot && !popups) { if (*PDIMAROUND && pLayer->m_dimAround && !m_bRenderingSnapshot && !popups) {
CRectPassElement::SRectData data; CRectPassElement::SRectData data;
data.box = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.y}; 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<CRectPassElement>(data)); m_sRenderPass.add(makeShared<CRectPassElement>(data));
} }
if (pLayer->fadingOut) { if (pLayer->m_fadingOut) {
if (!popups) if (!popups)
renderSnapshot(pLayer); renderSnapshot(pLayer);
return; return;
@@ -713,33 +713,33 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
TRACY_GPU_ZONE("RenderLayer"); TRACY_GPU_ZONE("RenderLayer");
const auto REALPOS = pLayer->realPosition->value(); const auto REALPOS = pLayer->m_realPosition->value();
const auto REALSIZ = pLayer->realSize->value(); const auto REALSIZ = pLayer->m_realSize->value();
CSurfacePassElement::SRenderData renderdata = {pMonitor, time, REALPOS}; CSurfacePassElement::SRenderData renderdata = {pMonitor, time, REALPOS};
renderdata.fadeAlpha = pLayer->alpha->value(); renderdata.fadeAlpha = pLayer->m_alpha->value();
renderdata.blur = pLayer->forceBlur && *PBLUR; renderdata.blur = pLayer->m_forceBlur && *PBLUR;
renderdata.surface = pLayer->surface->resource(); renderdata.surface = pLayer->m_surface->resource();
renderdata.decorate = false; renderdata.decorate = false;
renderdata.w = REALSIZ.x; renderdata.w = REALSIZ.x;
renderdata.h = REALSIZ.y; renderdata.h = REALSIZ.y;
renderdata.pLS = pLayer; 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); 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.discardMode |= DISCARD_ALPHA;
renderdata.discardOpacity = pLayer->ignoreAlphaValue; renderdata.discardOpacity = pLayer->m_ignoreAlphaValue;
} }
if (!popups) if (!popups)
pLayer->surface->resource()->breadthfirst( pLayer->m_surface->resource()->breadthfirst(
[this, &renderdata, &pLayer](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) { [this, &renderdata, &pLayer](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
renderdata.localPos = offset; renderdata.localPos = offset;
renderdata.texture = s->current.texture; renderdata.texture = s->current.texture;
renderdata.surface = s; renderdata.surface = s;
renderdata.mainSurface = s == pLayer->surface->resource(); renderdata.mainSurface = s == pLayer->m_surface->resource();
m_sRenderPass.add(makeShared<CSurfacePassElement>(renderdata)); m_sRenderPass.add(makeShared<CSurfacePassElement>(renderdata));
renderdata.surfaceCounter++; renderdata.surfaceCounter++;
}, },
@@ -748,18 +748,18 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
renderdata.squishOversized = false; // don't squish popups renderdata.squishOversized = false; // don't squish popups
renderdata.dontRound = true; renderdata.dontRound = true;
renderdata.popup = true; renderdata.popup = true;
renderdata.blur = pLayer->forceBlurPopups; renderdata.blur = pLayer->m_forceBlurPopups;
renderdata.surfaceCounter = 0; renderdata.surfaceCounter = 0;
if (popups) { if (popups) {
pLayer->popupHead->breadthfirst( pLayer->m_popupHead->breadthfirst(
[this, &renderdata](WP<CPopup> popup, void* data) { [this, &renderdata](WP<CPopup> 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; return;
Vector2D pos = popup->coordsRelativeToParent(); Vector2D pos = popup->coordsRelativeToParent();
renderdata.localPos = pos; renderdata.localPos = pos;
renderdata.texture = popup->m_pWLSurface->resource()->current.texture; renderdata.texture = popup->m_wlSurface->resource()->current.texture;
renderdata.surface = popup->m_pWLSurface->resource(); renderdata.surface = popup->m_wlSurface->resource();
renderdata.mainSurface = false; renderdata.mainSurface = false;
m_sRenderPass.add(makeShared<CSurfacePassElement>(renderdata)); m_sRenderPass.add(makeShared<CSurfacePassElement>(renderdata));
renderdata.surfaceCounter++; renderdata.surfaceCounter++;
@@ -1603,10 +1603,10 @@ void CHyprRenderer::sendFrameEventsToWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE
for (auto const& lsl : pMonitor->m_aLayerSurfaceLayers) { for (auto const& lsl : pMonitor->m_aLayerSurfaceLayers) {
for (auto const& ls : lsl) { for (auto const& ls : lsl) {
if (ls->fadingOut || !ls->surface->resource()) if (ls->m_fadingOut || !ls->m_surface->resource())
continue; continue;
ls->surface->resource()->breadthfirst([now](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr); ls->m_surface->resource()->breadthfirst([now](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr);
} }
} }
} }
@@ -1682,10 +1682,10 @@ void CHyprRenderer::arrangeLayerArray(PHLMONITOR pMonitor, const std::vector<PHL
CBox full_area = {pMonitor->vecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y}; CBox full_area = {pMonitor->vecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y};
for (auto const& ls : layerSurfaces) { 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; continue;
const auto PLAYER = ls->layerSurface; const auto PLAYER = ls->m_layerSurface;
const auto PSTATE = &PLAYER->current; const auto PSTATE = &PLAYER->current;
if (exclusiveZone != (PSTATE->exclusive > 0)) if (exclusiveZone != (PSTATE->exclusive > 0))
continue; continue;
@@ -1696,7 +1696,7 @@ void CHyprRenderer::arrangeLayerArray(PHLMONITOR pMonitor, const std::vector<PHL
else else
bounds = *usableArea; bounds = *usableArea;
const Vector2D OLDSIZE = {ls->geometry.width, ls->geometry.height}; const Vector2D OLDSIZE = {ls->m_geometry.width, ls->m_geometry.height};
CBox box = {{}, PSTATE->desiredSize}; CBox box = {{}, PSTATE->desiredSize};
// Horizontal axis // Horizontal axis
@@ -1753,15 +1753,15 @@ void CHyprRenderer::arrangeLayerArray(PHLMONITOR pMonitor, const std::vector<PHL
box.round(); // fix rounding errors box.round(); // fix rounding errors
ls->geometry = 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); 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) if (Vector2D{box.width, box.height} != OLDSIZE)
ls->layerSurface->configure(box.size()); ls->m_layerSurface->configure(box.size());
*ls->realPosition = box.pos(); *ls->m_realPosition = box.pos();
*ls->realSize = box.size(); *ls->m_realSize = box.size();
} }
} }
@@ -1792,7 +1792,7 @@ void CHyprRenderer::arrangeLayersForMonitor(const MONITORID& monitor) {
} }
for (auto& la : PMONITOR->m_aLayerSurfaceLayers) { 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) for (auto const& la : PMONITOR->m_aLayerSurfaceLayers)
@@ -2139,7 +2139,7 @@ void CHyprRenderer::recheckSolitaryForMonitor(PHLMONITOR pMonitor) {
return; return;
for (auto const& topls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { 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; return;
} }
@@ -2463,7 +2463,7 @@ void CHyprRenderer::makeWindowSnapshot(PHLWINDOW pWindow) {
void CHyprRenderer::makeLayerSnapshot(PHLLS pLayer) { void CHyprRenderer::makeLayerSnapshot(PHLLS pLayer) {
// we trust the window is valid. // 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) if (!PMONITOR || !PMONITOR->output || PMONITOR->vecPixelSize.x <= 0 || PMONITOR->vecPixelSize.y <= 0)
return; return;
@@ -2485,13 +2485,13 @@ void CHyprRenderer::makeLayerSnapshot(PHLLS pLayer) {
g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 0)); // JIC g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 0)); // JIC
const auto BLURLSSTATUS = pLayer->forceBlur; const auto BLURLSSTATUS = pLayer->m_forceBlur;
pLayer->forceBlur = false; pLayer->m_forceBlur = false;
// draw the layer // draw the layer
renderLayer(pLayer, PMONITOR, Time::steadyNow()); renderLayer(pLayer, PMONITOR, Time::steadyNow());
pLayer->forceBlur = BLURLSSTATUS; pLayer->m_forceBlur = BLURLSSTATUS;
endRender(); endRender();
@@ -2556,18 +2556,20 @@ void CHyprRenderer::renderSnapshot(PHLLS pLayer) {
if (!FBDATA->getTexture()) if (!FBDATA->getTexture())
return; return;
const auto PMONITOR = pLayer->monitor.lock(); const auto PMONITOR = pLayer->m_monitor.lock();
CBox layerBox; CBox layerBox;
// some mafs to figure out the correct box // some mafs to figure out the correct box
// the originalClosedPos is relative to the monitor's pos // the originalClosedPos is relative to the monitor's pos
Vector2D scaleXY = Vector2D((PMONITOR->scale * pLayer->realSize->value().x / (pLayer->geometry.w * PMONITOR->scale)), Vector2D scaleXY = Vector2D((PMONITOR->scale * pLayer->m_realSize->value().x / (pLayer->m_geometry.w * PMONITOR->scale)),
(PMONITOR->scale * pLayer->realSize->value().y / (pLayer->geometry.h * PMONITOR->scale))); (PMONITOR->scale * pLayer->m_realSize->value().y / (pLayer->m_geometry.h * PMONITOR->scale)));
layerBox.width = PMONITOR->vecTransformedSize.x * scaleXY.x; layerBox.width = PMONITOR->vecTransformedSize.x * scaleXY.x;
layerBox.height = PMONITOR->vecTransformedSize.y * scaleXY.y; 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.x =
layerBox.y = ((pLayer->realPosition->value().y - PMONITOR->vecPosition.y) * PMONITOR->scale) - (((pLayer->geometry.y - PMONITOR->vecPosition.y) * PMONITOR->scale) * scaleXY.y); ((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}; CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
@@ -2575,7 +2577,7 @@ void CHyprRenderer::renderSnapshot(PHLLS pLayer) {
data.flipEndFrame = true; data.flipEndFrame = true;
data.tex = FBDATA->getTexture(); data.tex = FBDATA->getTexture();
data.box = layerBox; data.box = layerBox;
data.a = pLayer->alpha->value(); data.a = pLayer->m_alpha->value();
data.damage = fakeDamage; data.damage = fakeDamage;
m_sRenderPass.add(makeShared<CTexPassElement>(data)); m_sRenderPass.add(makeShared<CTexPassElement>(data));