protocols/toplevelExport: Support transparency in toplevel export (#12824)

This commit is contained in:
ArchSav 2026-01-21 01:32:32 +11:00 committed by GitHub
parent f0b6714539
commit c44292c723
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 4 deletions

View file

@ -100,7 +100,9 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re
g_pHyprRenderer->makeEGLCurrent();
m_shmFormat = g_pHyprOpenGL->getPreferredReadFormat(PMONITOR);
m_shmFormat = NFormatUtils::alphaFormat(g_pHyprOpenGL->getPreferredReadFormat(PMONITOR));
LOGM(Log::DEBUG, "Format {:x}", m_shmFormat);
//m_shmFormat = NFormatUtils::alphaFormat(m_shmFormat);
if UNLIKELY (m_shmFormat == DRM_FORMAT_INVALID) {
LOGM(Log::ERR, "No format supported by renderer in capture toplevel");
m_resource->sendFailed();
@ -114,7 +116,7 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re
return;
}
m_dmabufFormat = g_pHyprOpenGL->getPreferredReadFormat(PMONITOR);
m_dmabufFormat = NFormatUtils::alphaFormat(g_pHyprOpenGL->getPreferredReadFormat(PMONITOR));
m_box = {0, 0, sc<int>(m_window->m_realSize->value().x * PMONITOR->m_scale), sc<int>(m_window->m_realSize->value().y * PMONITOR->m_scale)};
@ -253,7 +255,7 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) {
if (!g_pHyprRenderer->beginRender(PMONITOR, fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &outFB))
return false;
g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 1.0));
g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 0));
// render client at 0,0
if (PERM == PERMISSION_RULE_ALLOW_MODE_ALLOW) {
@ -356,7 +358,7 @@ bool CToplevelExportFrame::copyDmabuf(const Time::steady_tp& now) {
if (!g_pHyprRenderer->beginRender(PMONITOR, fakeDamage, RENDER_MODE_TO_BUFFER, m_buffer.m_buffer))
return false;
g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 1.0));
g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 0));
if (PERM == PERMISSION_RULE_ALLOW_MODE_ALLOW) {
if (!m_window->m_ruleApplicator->noScreenShare().valueOrDefault()) {
g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(m_window); // block the feedback to avoid spamming the surface if it's visible