diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 86202929..29d21f6f 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -268,8 +268,7 @@ void Events::listener_mapWindow(void* owner, void* data) { g_pCompositor->setWindowFullscreen(PWINDOW, true, FULLSCREEN_FULL); } - if (!PWINDOW->m_bIsX11) - PWINDOW->m_pSurfaceTree = SubsurfaceTree::createTreeRoot(g_pXWaylandManager->getWindowSurface(PWINDOW), addViewCoords, PWINDOW, PWINDOW); + PWINDOW->m_pSurfaceTree = SubsurfaceTree::createTreeRoot(g_pXWaylandManager->getWindowSurface(PWINDOW), addViewCoords, PWINDOW, PWINDOW); Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y); } diff --git a/src/helpers/SubsurfaceTree.cpp b/src/helpers/SubsurfaceTree.cpp index bcff2986..c511b900 100644 --- a/src/helpers/SubsurfaceTree.cpp +++ b/src/helpers/SubsurfaceTree.cpp @@ -193,12 +193,22 @@ void Events::listener_commitSubsurface(void* owner, void* data) { Debug::log(LOG, "Refusing to commit damage from %x because it's invisible.", pNode->pWindowOwner); return; } - int lx = 0, ly = 0; addSurfaceGlobalOffset(pNode, &lx, &ly); + // I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox) + // What this does is that basically, if the pNode is a child of some other node, on commit, + // it will also damage (check & damage if needed) all its siblings. + if (pNode->pParent) for (auto& cs : pNode->pParent->childSubsurfaces) { + const auto NODECOORDS = pNode->pSubsurface ? Vector2D(pNode->pSubsurface->pSubsurface->current.x, pNode->pSubsurface->pSubsurface->current.y) : Vector2D(); + + if (&cs != pNode->pSubsurface && cs.pSubsurface) { + g_pHyprRenderer->damageSurface(cs.pSubsurface->surface, lx - NODECOORDS.x + cs.pSubsurface->current.x, ly - NODECOORDS.y + cs.pSubsurface->current.y); + } + } + g_pHyprRenderer->damageSurface(pNode->pSurface, lx, ly); } diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 5d167592..72a5b854 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -551,6 +551,11 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) { pixman_region32_init(&damageBox); wlr_surface_get_effective_damage(pSurface, &damageBox); + if (!pixman_region32_not_empty(&damageBox)) { + pixman_region32_fini(&damageBox); + return; + } + pixman_region32_translate(&damageBox, x, y); for (auto& m : g_pCompositor->m_lMonitors) {