mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 21:45:59 +01:00
renderer: add occlusion for special workspaces
This commit is contained in:
parent
d5811283d2
commit
f013acc6ee
2 changed files with 34 additions and 0 deletions
|
@ -685,11 +685,15 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
|
||||||
// pre window pass
|
// pre window pass
|
||||||
g_pHyprOpenGL->preWindowPass();
|
g_pHyprOpenGL->preWindowPass();
|
||||||
|
|
||||||
|
setOccludedForMainWorkspace(g_pHyprOpenGL->m_RenderData.damage, pWorkspace);
|
||||||
|
|
||||||
if (pWorkspace->m_bHasFullscreenWindow)
|
if (pWorkspace->m_bHasFullscreenWindow)
|
||||||
renderWorkspaceWindowsFullscreen(pMonitor, pWorkspace, time);
|
renderWorkspaceWindowsFullscreen(pMonitor, pWorkspace, time);
|
||||||
else
|
else
|
||||||
renderWorkspaceWindows(pMonitor, pWorkspace, time);
|
renderWorkspaceWindows(pMonitor, pWorkspace, time);
|
||||||
|
|
||||||
|
g_pHyprOpenGL->m_RenderData.damage = preOccludedDamage;
|
||||||
|
|
||||||
g_pHyprOpenGL->m_RenderData.renderModif = {};
|
g_pHyprOpenGL->m_RenderData.renderModif = {};
|
||||||
|
|
||||||
// and then special
|
// and then special
|
||||||
|
@ -2196,6 +2200,35 @@ void CHyprRenderer::initiateManualCrash() {
|
||||||
g_pConfigManager->setInt("debug:damage_tracking", 0);
|
g_pConfigManager->setInt("debug:damage_tracking", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHyprRenderer::setOccludedForMainWorkspace(CRegion& region, CWorkspace* pWorkspace) {
|
||||||
|
CRegion rg;
|
||||||
|
|
||||||
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID);
|
||||||
|
|
||||||
|
if (!PMONITOR->specialWorkspaceID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
|
if (!w->m_bIsMapped || w->isHidden() || w->m_iWorkspaceID != PMONITOR->specialWorkspaceID)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!w->opaque())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const auto ROUNDING = w->rounding() * PMONITOR->scale;
|
||||||
|
const Vector2D POS = w->m_vRealPosition.vec() + Vector2D{ROUNDING, ROUNDING} - PMONITOR->vecPosition + (w->m_bPinned ? Vector2D{} : pWorkspace->m_vRenderOffset.vec());
|
||||||
|
const Vector2D SIZE = w->m_vRealSize.vec() - Vector2D{ROUNDING * 2, ROUNDING * 2};
|
||||||
|
|
||||||
|
CBox box = {POS.x, POS.y, SIZE.x, SIZE.y};
|
||||||
|
|
||||||
|
box.scale(PMONITOR->scale);
|
||||||
|
|
||||||
|
rg.add(box);
|
||||||
|
}
|
||||||
|
|
||||||
|
region.subtract(rg);
|
||||||
|
}
|
||||||
|
|
||||||
void CHyprRenderer::setOccludedForBackLayers(CRegion& region, CWorkspace* pWorkspace) {
|
void CHyprRenderer::setOccludedForBackLayers(CRegion& region, CWorkspace* pWorkspace) {
|
||||||
CRegion rg;
|
CRegion rg;
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ class CHyprRenderer {
|
||||||
std::tuple<float, float, float> getRenderTimes(CMonitor* pMonitor); // avg max min
|
std::tuple<float, float, float> getRenderTimes(CMonitor* pMonitor); // avg max min
|
||||||
void renderLockscreen(CMonitor* pMonitor, timespec* now);
|
void renderLockscreen(CMonitor* pMonitor, timespec* now);
|
||||||
void setOccludedForBackLayers(CRegion& region, CWorkspace* pWorkspace);
|
void setOccludedForBackLayers(CRegion& region, CWorkspace* pWorkspace);
|
||||||
|
void setOccludedForMainWorkspace(CRegion& region, CWorkspace* pWorkspace); // TODO: merge occlusion methods
|
||||||
bool canSkipBackBufferClear(CMonitor* pMonitor);
|
bool canSkipBackBufferClear(CMonitor* pMonitor);
|
||||||
void recheckSolitaryForMonitor(CMonitor* pMonitor);
|
void recheckSolitaryForMonitor(CMonitor* pMonitor);
|
||||||
void setCursorSurface(wlr_surface* surf, int hotspotX, int hotspotY, bool force = false);
|
void setCursorSurface(wlr_surface* surf, int hotspotX, int hotspotY, bool force = false);
|
||||||
|
|
Loading…
Reference in a new issue