tearing: cleanup vars and avoid rendering before drm is ready

This commit is contained in:
vaxerski
2023-09-30 17:07:50 +01:00
parent e2b72b2975
commit a2a29a60e5
6 changed files with 37 additions and 33 deletions

View File

@@ -249,14 +249,19 @@ void Events::listener_commitSubsurface(void* owner, void* data) {
if (pNode->pWindowOwner) {
// tearing: if solitary, redraw it. This still might be a single surface window
const auto PMONITOR = g_pCompositor->getMonitorFromID(pNode->pWindowOwner->m_iMonitorID);
if (PMONITOR->solitaryClient == pNode->pWindowOwner && pNode->pWindowOwner->canBeTorn() && PMONITOR->canTear) {
if (PMONITOR->solitaryClient == pNode->pWindowOwner && pNode->pWindowOwner->canBeTorn() && PMONITOR->tearingState.canTear) {
CRegion damageBox;
wlr_surface_get_effective_damage(pNode->pSurface->wlr(), damageBox.pixman());
if (!damageBox.empty()) {
PMONITOR->nextRenderTorn = true;
g_pHyprRenderer->renderMonitor(PMONITOR);
if (PMONITOR->tearingState.busy) {
PMONITOR->tearingState.frameScheduledWhileBusy = true;
} else {
PMONITOR->tearingState.nextRenderTorn = true;
g_pHyprRenderer->renderMonitor(PMONITOR);
}
}
}
}