|
13 | 13 | #include "types/Buffer.hpp" |
14 | 14 | #include "../helpers/Format.hpp" |
15 | 15 | #include "../helpers/time/Time.hpp" |
| 16 | +#include "XDGShell.hpp" |
16 | 17 |
|
17 | 18 | #include <algorithm> |
18 | 19 | #include <functional> |
@@ -200,6 +201,59 @@ void CScreencopyFrame::renderMon() { |
200 | 201 | g_pHyprOpenGL->renderTexture(TEXTURE, monbox, 1); |
201 | 202 | g_pHyprOpenGL->setRenderModifEnabled(true); |
202 | 203 | g_pHyprOpenGL->setMonitorTransformEnabled(false); |
| 204 | + |
| 205 | + for (auto const& w : g_pCompositor->m_windows) { |
| 206 | + if (!w->m_windowData.noScreenShare.valueOrDefault()) |
| 207 | + continue; |
| 208 | + |
| 209 | + if (!g_pHyprRenderer->shouldRenderWindow(w)) |
| 210 | + continue; |
| 211 | + |
| 212 | + const auto PWORKSPACE = w->m_workspace; |
| 213 | + |
| 214 | + if UNLIKELY (!PWORKSPACE) |
| 215 | + continue; |
| 216 | + |
| 217 | + const auto REALPOS = w->m_realPosition->value() + (w->m_pinned ? Vector2D{} : PWORKSPACE->m_renderOffset->value()); |
| 218 | + const auto noScreenShareBox = CBox{REALPOS.x, REALPOS.y, std::max(w->m_realSize->value().x, 5.0), std::max(w->m_realSize->value().y, 5.0)} |
| 219 | + .scale(m_monitor->m_scale) |
| 220 | + .translate({-m_monitor->m_position.x, -m_monitor->m_position.y}) |
| 221 | + .translate({-m_box.x, -m_box.y}); |
| 222 | + |
| 223 | + const auto dontRound = w->isEffectiveInternalFSMode(FSMODE_FULLSCREEN) || w->m_windowData.noRounding.valueOrDefault(); |
| 224 | + const auto rounding = dontRound ? 0 : w->rounding() * m_monitor->m_scale; |
| 225 | + const auto roundingPower = dontRound ? 2.0f : w->roundingPower(); |
| 226 | + |
| 227 | + g_pHyprOpenGL->renderRect(noScreenShareBox, {0, 0, 0, 255}, rounding, roundingPower); |
| 228 | + |
| 229 | + if (w->m_isX11 || !w->m_popupHead) |
| 230 | + continue; |
| 231 | + |
| 232 | + const auto geom = w->m_xdgSurface->m_current.geometry; |
| 233 | + const Vector2D popupBaseOffset = REALPOS - Vector2D{geom.pos().x, geom.pos().y}; |
| 234 | + |
| 235 | + w->m_popupHead->breadthfirst( |
| 236 | + [&](WP<CPopup> popup, void*) { |
| 237 | + if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped) |
| 238 | + return; |
| 239 | + |
| 240 | + const auto popRel = popup->coordsRelativeToParent(); |
| 241 | + popup->m_wlSurface->resource()->breadthfirst( |
| 242 | + [&](SP<CWLSurfaceResource> surf, const Vector2D& localOff, void*) { |
| 243 | + const auto size = surf->m_current.size; |
| 244 | + const auto surfBox = CBox{popupBaseOffset.x + popRel.x + localOff.x, popupBaseOffset.y + popRel.y + localOff.y, size.x, size.y} |
| 245 | + .scale(m_monitor->m_scale) |
| 246 | + .translate({-m_monitor->m_position.x, -m_monitor->m_position.y}) |
| 247 | + .translate({-m_box.x, -m_box.y}); |
| 248 | + |
| 249 | + if LIKELY (surfBox.w > 0 && surfBox.h > 0) |
| 250 | + g_pHyprOpenGL->renderRect(surfBox, {0, 0, 0, 255}); |
| 251 | + }, |
| 252 | + nullptr); |
| 253 | + }, |
| 254 | + nullptr); |
| 255 | + } |
| 256 | + |
203 | 257 | if (m_overlayCursor) |
204 | 258 | g_pPointerManager->renderSoftwareCursorsFor(m_monitor.lock(), Time::steadyNow(), fakeDamage, |
205 | 259 | g_pInputManager->getMouseCoordsInternal() - m_monitor->m_position - m_box.pos(), true); |
|
0 commit comments