diff options
Diffstat (limited to 'src/desktop')
| -rw-r--r-- | src/desktop/LayerSurface.cpp | 14 | ||||
| -rw-r--r-- | src/desktop/Popup.cpp | 14 | ||||
| -rw-r--r-- | src/desktop/Subsurface.cpp | 44 | ||||
| -rw-r--r-- | src/desktop/WLSurface.cpp | 41 | ||||
| -rw-r--r-- | src/desktop/Window.cpp | 30 |
5 files changed, 72 insertions, 71 deletions
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp index c31f9bb7..9818c093 100644 --- a/src/desktop/LayerSurface.cpp +++ b/src/desktop/LayerSurface.cpp @@ -238,7 +238,7 @@ void CLayerSurface::onUnmap() { // refocus if needed // vvvvvvvvvvvvv if there is a last focus and the last focus is not keyboard focusable, fallback to window - 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->m_hlSurface && !g_pCompositor->m_lastFocus->m_hlSurface->keyboardFocusable())) { if (!g_pInputManager->refocusLastWindow(PMONITOR)) g_pInputManager->refocus(); } else if (g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus != m_surface->resource()) @@ -247,8 +247,8 @@ void CLayerSurface::onUnmap() { CBox geomFixed = {m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y, m_geometry.width, m_geometry.height}; g_pHyprRenderer->damageBox(geomFixed); - geomFixed = {m_geometry.x + (int)PMONITOR->m_position.x, m_geometry.y + (int)PMONITOR->m_position.y, (int)m_layerSurface->surface->current.size.x, - (int)m_layerSurface->surface->current.size.y}; + geomFixed = {m_geometry.x + (int)PMONITOR->m_position.x, m_geometry.y + (int)PMONITOR->m_position.y, (int)m_layerSurface->surface->m_current.size.x, + (int)m_layerSurface->surface->m_current.size.y}; g_pHyprRenderer->damageBox(geomFixed); g_pInputManager->simulateMouseMovement(); @@ -262,7 +262,7 @@ void CLayerSurface::onCommit() { if (!m_mapped) { // we're re-mapping if this is the case - if (m_layerSurface->surface && !m_layerSurface->surface->current.texture) { + if (m_layerSurface->surface && !m_layerSurface->surface->m_current.texture) { m_fadingOut = false; m_geometry = {}; g_pHyprRenderer->arrangeLayersForMonitor(monitorID()); @@ -308,12 +308,12 @@ void CLayerSurface::onCommit() { m_position = Vector2D(m_geometry.x, m_geometry.y); // update geom if it changed - if (m_layerSurface->surface->current.scale == 1 && PMONITOR->m_scale != 1.f && m_layerSurface->surface->current.viewport.hasDestination) { + if (m_layerSurface->surface->m_current.scale == 1 && PMONITOR->m_scale != 1.f && m_layerSurface->surface->m_current.viewport.hasDestination) { // fractional scaling. Dirty hack. - m_geometry = {m_geometry.pos(), m_layerSurface->surface->current.viewport.destination}; + m_geometry = {m_geometry.pos(), m_layerSurface->surface->m_current.viewport.destination}; } else { // this is because some apps like e.g. rofi-lbonn can't fucking use the protocol correctly. - m_geometry = {m_geometry.pos(), m_layerSurface->surface->current.size}; + m_geometry = {m_geometry.pos(), m_layerSurface->surface->m_current.size}; } } diff --git a/src/desktop/Popup.cpp b/src/desktop/Popup.cpp index 30cf966d..86928faf 100644 --- a/src/desktop/Popup.cpp +++ b/src/desktop/Popup.cpp @@ -93,7 +93,7 @@ void CPopup::onMap() { return; m_mapped = true; - m_lastSize = m_resource->surface->surface->current.size; + m_lastSize = m_resource->surface->surface->m_current.size; const auto COORDS = coordsGlobal(); const auto PMONITOR = g_pCompositor->getMonitorFromVector(COORDS); @@ -128,7 +128,7 @@ void CPopup::onUnmap() { m_mapped = false; - m_lastSize = m_resource->surface->surface->current.size; + m_lastSize = m_resource->surface->surface->m_current.size; const auto COORDS = coordsGlobal(); @@ -172,7 +172,7 @@ void CPopup::onCommit(bool ignoreSiblings) { } if (!m_windowOwner.expired() && (!m_windowOwner->m_isMapped || !m_windowOwner->m_workspace->m_visible)) { - m_lastSize = m_resource->surface->surface->current.size; + m_lastSize = m_resource->surface->surface->m_current.size; static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage"); if (*PLOGDAMAGE) @@ -186,10 +186,10 @@ void CPopup::onCommit(bool ignoreSiblings) { const auto COORDS = coordsGlobal(); const auto COORDSLOCAL = coordsRelativeToParent(); - if (m_lastSize != m_resource->surface->surface->current.size || m_requestedReposition || m_lastPos != COORDSLOCAL) { + if (m_lastSize != m_resource->surface->surface->m_current.size || m_requestedReposition || m_lastPos != COORDSLOCAL) { CBox box = {localToGlobal(m_lastPos), m_lastSize}; g_pHyprRenderer->damageBox(box); - m_lastSize = m_resource->surface->surface->current.size; + m_lastSize = m_resource->surface->surface->m_current.size; box = {COORDS, m_lastSize}; g_pHyprRenderer->damageBox(box); @@ -246,7 +246,7 @@ Vector2D CPopup::coordsRelativeToParent() { while (current->m_parent && current->m_resource) { - offset += current->m_wlSurface->resource()->current.offset; + offset += current->m_wlSurface->resource()->m_current.offset; offset += current->m_resource->geometry.pos(); current = current->m_parent; @@ -363,7 +363,7 @@ WP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) { if (BOX.containsPoint(globalCoords)) return p; } else { - const auto REGION = CRegion{p->m_wlSurface->resource()->current.input}.intersect(CBox{{}, p->m_wlSurface->resource()->current.size}).translate(p->coordsGlobal()); + const auto REGION = CRegion{p->m_wlSurface->resource()->m_current.input}.intersect(CBox{{}, p->m_wlSurface->resource()->m_current.size}).translate(p->coordsGlobal()); if (REGION.containsPoint(globalCoords)) return p; } diff --git a/src/desktop/Subsurface.cpp b/src/desktop/Subsurface.cpp index 419c7e31..1c5d5c70 100644 --- a/src/desktop/Subsurface.cpp +++ b/src/desktop/Subsurface.cpp @@ -32,9 +32,9 @@ UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, PHLWI subsurface->m_subsurface = pSubsurface; subsurface->m_self = subsurface; subsurface->m_wlSurface = CWLSurface::create(); - subsurface->m_wlSurface->assign(pSubsurface->surface.lock(), subsurface.get()); + subsurface->m_wlSurface->assign(pSubsurface->m_surface.lock(), subsurface.get()); subsurface->initSignals(); - subsurface->initExistingSubsurfaces(pSubsurface->surface.lock()); + subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock()); return subsurface; } @@ -44,27 +44,27 @@ UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, WP<CP subsurface->m_subsurface = pSubsurface; subsurface->m_self = subsurface; subsurface->m_wlSurface = CWLSurface::create(); - subsurface->m_wlSurface->assign(pSubsurface->surface.lock(), subsurface.get()); + subsurface->m_wlSurface->assign(pSubsurface->m_surface.lock(), subsurface.get()); subsurface->initSignals(); - subsurface->initExistingSubsurfaces(pSubsurface->surface.lock()); + subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock()); return subsurface; } void CSubsurface::initSignals() { if (m_subsurface) { - m_listeners.commitSubsurface = m_subsurface->surface->events.commit.registerListener([this](std::any d) { onCommit(); }); - m_listeners.destroySubsurface = m_subsurface->events.destroy.registerListener([this](std::any d) { onDestroy(); }); - m_listeners.mapSubsurface = m_subsurface->surface->events.map.registerListener([this](std::any d) { onMap(); }); - m_listeners.unmapSubsurface = m_subsurface->surface->events.unmap.registerListener([this](std::any d) { onUnmap(); }); + m_listeners.commitSubsurface = m_subsurface->m_surface->m_events.commit.registerListener([this](std::any d) { onCommit(); }); + m_listeners.destroySubsurface = m_subsurface->m_events.destroy.registerListener([this](std::any d) { onDestroy(); }); + m_listeners.mapSubsurface = m_subsurface->m_surface->m_events.map.registerListener([this](std::any d) { onMap(); }); + m_listeners.unmapSubsurface = m_subsurface->m_surface->m_events.unmap.registerListener([this](std::any d) { onUnmap(); }); m_listeners.newSubsurface = - m_subsurface->surface->events.newSubsurface.registerListener([this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); }); + m_subsurface->m_surface->m_events.newSubsurface.registerListener([this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); }); } else { if (m_windowParent) - m_listeners.newSubsurface = m_windowParent->m_wlSurface->resource()->events.newSubsurface.registerListener( + m_listeners.newSubsurface = m_windowParent->m_wlSurface->resource()->m_events.newSubsurface.registerListener( [this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); }); else if (m_popupParent) - m_listeners.newSubsurface = - m_popupParent->m_wlSurface->resource()->events.newSubsurface.registerListener([this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); }); + m_listeners.newSubsurface = m_popupParent->m_wlSurface->resource()->m_events.newSubsurface.registerListener( + [this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); }); else ASSERT(false); } @@ -95,7 +95,7 @@ void CSubsurface::recheckDamageForSubsurfaces() { void CSubsurface::onCommit() { // no damaging if it's not visible if (!m_windowParent.expired() && (!m_windowParent->m_isMapped || !m_windowParent->m_workspace->m_visible)) { - m_lastSize = m_wlSurface->resource()->current.size; + m_lastSize = m_wlSurface->resource()->m_current.size; static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage"); if (*PLOGDAMAGE) @@ -115,10 +115,10 @@ void CSubsurface::onCommit() { // I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox) checkSiblingDamage(); - if (m_lastSize != m_wlSurface->resource()->current.size || m_lastPosition != m_subsurface->position) { + if (m_lastSize != m_wlSurface->resource()->m_current.size || m_lastPosition != m_subsurface->m_position) { damageLastArea(); - m_lastSize = m_wlSurface->resource()->current.size; - m_lastPosition = m_subsurface->position; + m_lastSize = m_wlSurface->resource()->m_current.size; + m_lastPosition = m_subsurface->m_position; } } @@ -151,8 +151,8 @@ void CSubsurface::onNewSubsurface(SP<CWLSubsurfaceResource> pSubsurface) { } void CSubsurface::onMap() { - m_lastSize = m_wlSurface->resource()->current.size; - m_lastPosition = m_subsurface->position; + m_lastSize = m_wlSurface->resource()->m_current.size; + m_lastPosition = m_subsurface->m_position; const auto COORDS = coordsGlobal(); CBox box{COORDS, m_lastSize}; @@ -175,7 +175,7 @@ void CSubsurface::onUnmap() { } void CSubsurface::damageLastArea() { - const auto COORDS = coordsGlobal() + m_lastPosition - m_subsurface->position; + const auto COORDS = coordsGlobal() + m_lastPosition - m_subsurface->m_position; CBox box{COORDS, m_lastSize}; box.expand(4); g_pHyprRenderer->damageBox(box); @@ -199,15 +199,15 @@ Vector2D CSubsurface::coordsGlobal() { } void CSubsurface::initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface) { - for (auto const& s : pSurface->subsurfaces) { - if (!s || s->surface->hlSurface /* already assigned */) + for (auto const& s : pSurface->m_subsurfaces) { + if (!s || s->m_surface->m_hlSurface /* already assigned */) continue; onNewSubsurface(s.lock()); } } Vector2D CSubsurface::size() { - return m_wlSurface->resource()->current.size; + return m_wlSurface->resource()->m_current.size; } bool CSubsurface::visible() { diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp index d5e35be1..6666ea52 100644 --- a/src/desktop/WLSurface.cpp +++ b/src/desktop/WLSurface.cpp @@ -59,12 +59,12 @@ bool CWLSurface::small() const { if (!validMapped(m_windowOwner) || !exists()) return false; - if (!m_resource->current.texture) + if (!m_resource->m_current.texture) return false; const auto O = m_windowOwner.lock(); - return O->m_reportedSize.x > m_resource->current.size.x + 1 || O->m_reportedSize.y > m_resource->current.size.y + 1; + return O->m_reportedSize.x > m_resource->m_current.size.x + 1 || O->m_reportedSize.y > m_resource->m_current.size.y + 1; } Vector2D CWLSurface::correctSmallVec() const { @@ -78,36 +78,37 @@ Vector2D CWLSurface::correctSmallVec() const { } Vector2D CWLSurface::correctSmallVecBuf() const { - if (!exists() || !small() || m_fillIgnoreSmall || !m_resource->current.texture) + if (!exists() || !small() || m_fillIgnoreSmall || !m_resource->m_current.texture) return {}; const auto SIZE = getViewporterCorrectedSize(); - const auto BS = m_resource->current.bufferSize; + const auto BS = m_resource->m_current.bufferSize; return Vector2D{(BS.x - SIZE.x) / 2, (BS.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}); } Vector2D CWLSurface::getViewporterCorrectedSize() const { - if (!exists() || !m_resource->current.texture) + if (!exists() || !m_resource->m_current.texture) return {}; - return m_resource->current.viewport.hasDestination ? m_resource->current.viewport.destination : m_resource->current.bufferSize; + return m_resource->m_current.viewport.hasDestination ? m_resource->m_current.viewport.destination : m_resource->m_current.bufferSize; } CRegion CWLSurface::computeDamage() const { - if (!m_resource->current.texture) + if (!m_resource->m_current.texture) return {}; - CRegion damage = m_resource->current.accumulateBufferDamage(); - damage.transform(wlTransformToHyprutils(m_resource->current.transform), m_resource->current.bufferSize.x, m_resource->current.bufferSize.y); + CRegion damage = m_resource->m_current.accumulateBufferDamage(); + damage.transform(wlTransformToHyprutils(m_resource->m_current.transform), m_resource->m_current.bufferSize.x, m_resource->m_current.bufferSize.y); - const auto BUFSIZE = m_resource->current.bufferSize; + const auto BUFSIZE = m_resource->m_current.bufferSize; const auto CORRECTVEC = correctSmallVecBuf(); - if (m_resource->current.viewport.hasSource) - damage.intersect(m_resource->current.viewport.source); + if (m_resource->m_current.viewport.hasSource) + damage.intersect(m_resource->m_current.viewport.source); - const auto SCALEDSRCSIZE = m_resource->current.viewport.hasSource ? m_resource->current.viewport.source.size() * m_resource->current.scale : m_resource->current.bufferSize; + const auto SCALEDSRCSIZE = + m_resource->m_current.viewport.hasSource ? m_resource->m_current.viewport.source.size() * m_resource->m_current.scale : m_resource->m_current.bufferSize; damage.scale({BUFSIZE.x / SCALEDSRCSIZE.x, BUFSIZE.y / SCALEDSRCSIZE.y}); damage.translate(CORRECTVEC); @@ -115,8 +116,8 @@ CRegion CWLSurface::computeDamage() const { // go from buffer coords in the damage to hl logical const auto BOX = getSurfaceBoxGlobal(); - const Vector2D SCALE = BOX.has_value() ? BOX->size() / m_resource->current.bufferSize : - Vector2D{1.0 / m_resource->current.scale, 1.0 / m_resource->current.scale /* Wrong... but we can't really do better */}; + const Vector2D SCALE = BOX.has_value() ? BOX->size() / m_resource->m_current.bufferSize : + Vector2D{1.0 / m_resource->m_current.scale, 1.0 / m_resource->m_current.scale /* Wrong... but we can't really do better */}; damage.scale(SCALE); @@ -135,7 +136,7 @@ void CWLSurface::destroy() { m_constraint.reset(); m_listeners.destroy.reset(); - m_resource->hlSurface.reset(); + m_resource->m_hlSurface.reset(); m_windowOwner.reset(); m_layerOwner.reset(); m_popupOwner = nullptr; @@ -154,11 +155,11 @@ void CWLSurface::init() { if (!m_resource) return; - RASSERT(!m_resource->hlSurface, "Attempted to duplicate CWLSurface ownership!"); + RASSERT(!m_resource->m_hlSurface, "Attempted to duplicate CWLSurface ownership!"); - m_resource->hlSurface = m_self.lock(); + m_resource->m_hlSurface = m_self.lock(); - m_listeners.destroy = m_resource->events.destroy.registerListener([this](std::any d) { destroy(); }); + m_listeners.destroy = m_resource->m_events.destroy.registerListener([this](std::any d) { destroy(); }); Debug::log(LOG, "CWLSurface {:x} called init()", (uintptr_t)this); } @@ -222,7 +223,7 @@ bool CWLSurface::visible() { SP<CWLSurface> CWLSurface::fromResource(SP<CWLSurfaceResource> pSurface) { if (!pSurface) return nullptr; - return pSurface->hlSurface.lock(); + return pSurface->m_hlSurface.lock(); } bool CWLSurface::keyboardFocusable() const { diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 64771895..4686ecb1 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -184,11 +184,11 @@ SBoxExtents CWindow::getFullWindowExtents() { if (-surfaceExtents.y > maxExtents.topLeft.y) maxExtents.topLeft.y = -surfaceExtents.y; - if (surfaceExtents.x + surfaceExtents.width > m_wlSurface->resource()->current.size.x + maxExtents.bottomRight.x) - maxExtents.bottomRight.x = surfaceExtents.x + surfaceExtents.width - m_wlSurface->resource()->current.size.x; + if (surfaceExtents.x + surfaceExtents.width > m_wlSurface->resource()->m_current.size.x + maxExtents.bottomRight.x) + maxExtents.bottomRight.x = surfaceExtents.x + surfaceExtents.width - m_wlSurface->resource()->m_current.size.x; - if (surfaceExtents.y + surfaceExtents.height > m_wlSurface->resource()->current.size.y + maxExtents.bottomRight.y) - maxExtents.bottomRight.y = surfaceExtents.y + surfaceExtents.height - m_wlSurface->resource()->current.size.y; + if (surfaceExtents.y + surfaceExtents.height > m_wlSurface->resource()->m_current.size.y + maxExtents.bottomRight.y) + maxExtents.bottomRight.y = surfaceExtents.y + surfaceExtents.height - m_wlSurface->resource()->m_current.size.y; } return maxExtents; @@ -1159,18 +1159,18 @@ bool CWindow::opaque() { if (PWORKSPACE->m_alpha->value() != 1.f) return false; - if (m_isX11 && m_xwaylandSurface && m_xwaylandSurface->surface && m_xwaylandSurface->surface->current.texture) - return m_xwaylandSurface->surface->current.texture->m_bOpaque; + if (m_isX11 && m_xwaylandSurface && m_xwaylandSurface->surface && m_xwaylandSurface->surface->m_current.texture) + return m_xwaylandSurface->surface->m_current.texture->m_bOpaque; - if (!m_wlSurface->resource() || !m_wlSurface->resource()->current.texture) + if (!m_wlSurface->resource() || !m_wlSurface->resource()->m_current.texture) return false; // TODO: this is wrong - const auto EXTENTS = m_xdgSurface->surface->current.opaque.getExtents(); - if (EXTENTS.w >= m_xdgSurface->surface->current.bufferSize.x && EXTENTS.h >= m_xdgSurface->surface->current.bufferSize.y) + const auto EXTENTS = m_xdgSurface->surface->m_current.opaque.getExtents(); + if (EXTENTS.w >= m_xdgSurface->surface->m_current.bufferSize.x && EXTENTS.h >= m_xdgSurface->surface->m_current.bufferSize.y) return true; - return m_wlSurface->resource()->current.texture->m_bOpaque; + return m_wlSurface->resource()->m_current.texture->m_bOpaque; } float CWindow::rounding() { @@ -1772,19 +1772,19 @@ void CWindow::sendWindowSize(bool force) { } NContentType::eContentType CWindow::getContentType() { - if (!m_wlSurface || !m_wlSurface->resource() || !m_wlSurface->resource()->contentType.valid()) + if (!m_wlSurface || !m_wlSurface->resource() || !m_wlSurface->resource()->m_contentType.valid()) return CONTENT_TYPE_NONE; - return m_wlSurface->resource()->contentType->value; + return m_wlSurface->resource()->m_contentType->value; } void CWindow::setContentType(NContentType::eContentType contentType) { - if (!m_wlSurface->resource()->contentType.valid()) - m_wlSurface->resource()->contentType = PROTO::contentType->getContentType(m_wlSurface->resource()); + if (!m_wlSurface->resource()->m_contentType.valid()) + m_wlSurface->resource()->m_contentType = PROTO::contentType->getContentType(m_wlSurface->resource()); // else disallow content type change if proto is used? Debug::log(INFO, "ContentType for window {}", (int)contentType); - m_wlSurface->resource()->contentType->value = contentType; + m_wlSurface->resource()->m_contentType->value = contentType; } void CWindow::deactivateGroupMembers() { |
