summaryrefslogtreecommitdiff
path: root/src/protocols/Screencopy.cpp
diff options
context:
space:
mode:
authorusering-around <226918848+usering-around@users.noreply.github.com>2025-11-11 22:42:53 +0200
committerGitHub <noreply@github.com>2025-11-11 20:42:53 +0000
commitc330d4334f0f14ea46fdcafc164faeec09ea82e9 (patch)
tree1e51d5dd5366072a40886238e6d0083e4e59b314 /src/protocols/Screencopy.cpp
parentcadf922417dcfd104c73e9648ebcc5d6f31435bf (diff)
renderer: fix noscreenshare layerrule popups (#12260)
Diffstat (limited to 'src/protocols/Screencopy.cpp')
-rw-r--r--src/protocols/Screencopy.cpp40
1 files changed, 23 insertions, 17 deletions
diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp
index 687c4045..1b47fb66 100644
--- a/src/protocols/Screencopy.cpp
+++ b/src/protocols/Screencopy.cpp
@@ -211,6 +211,24 @@ void CScreencopyFrame::renderMon() {
g_pHyprOpenGL->setRenderModifEnabled(true);
g_pHyprOpenGL->popMonitorTransformEnabled();
+ auto hidePopups = [&](Vector2D popupBaseOffset) {
+ return [&, popupBaseOffset](WP<CPopup> popup, void*) {
+ if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
+ return;
+
+ const auto popRel = popup->coordsRelativeToParent();
+ popup->m_wlSurface->resource()->breadthfirst(
+ [&](SP<CWLSurfaceResource> surf, const Vector2D& localOff, void*) {
+ const auto size = surf->m_current.size;
+ const auto surfBox = CBox{popupBaseOffset + popRel + localOff, size}.translate(m_monitor->m_position).scale(m_monitor->m_scale).translate(-m_box.pos());
+
+ if LIKELY (surfBox.w > 0 && surfBox.h > 0)
+ g_pHyprOpenGL->renderRect(surfBox, Colors::BLACK, {});
+ },
+ nullptr);
+ };
+ };
+
for (auto const& l : g_pCompositor->m_layers) {
if (!l->m_noScreenShare)
continue;
@@ -225,6 +243,10 @@ void CScreencopyFrame::renderMon() {
CBox{REALPOS.x, REALPOS.y, std::max(REALSIZE.x, 5.0), std::max(REALSIZE.y, 5.0)}.translate(-m_monitor->m_position).scale(m_monitor->m_scale).translate(-m_box.pos());
g_pHyprOpenGL->renderRect(noScreenShareBox, Colors::BLACK, {});
+
+ const auto geom = l->m_geometry;
+ const Vector2D popupBaseOffset = REALPOS - Vector2D{geom.pos().x, geom.pos().y};
+ l->m_popupHead->breadthfirst(hidePopups(popupBaseOffset), nullptr);
}
for (auto const& w : g_pCompositor->m_windows) {
@@ -261,23 +283,7 @@ void CScreencopyFrame::renderMon() {
const auto geom = w->m_xdgSurface->m_current.geometry;
const Vector2D popupBaseOffset = REALPOS - Vector2D{geom.pos().x, geom.pos().y};
- w->m_popupHead->breadthfirst(
- [&](WP<CPopup> popup, void*) {
- if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
- return;
-
- const auto popRel = popup->coordsRelativeToParent();
- popup->m_wlSurface->resource()->breadthfirst(
- [&](SP<CWLSurfaceResource> surf, const Vector2D& localOff, void*) {
- const auto size = surf->m_current.size;
- const auto surfBox = CBox{popupBaseOffset + popRel + localOff, size}.translate(-m_monitor->m_position).scale(m_monitor->m_scale).translate(-m_box.pos());
-
- if LIKELY (surfBox.w > 0 && surfBox.h > 0)
- g_pHyprOpenGL->renderRect(surfBox, Colors::BLACK, {});
- },
- nullptr);
- },
- nullptr);
+ w->m_popupHead->breadthfirst(hidePopups(popupBaseOffset), nullptr);
}
if (m_overlayCursor)