surface: fix damage tearing feedback

fixes #4935
This commit is contained in:
Vaxry 2024-03-05 00:21:37 +00:00
parent 9c48c322d4
commit 12985fa0d8
2 changed files with 16 additions and 18 deletions

View file

@ -145,24 +145,6 @@ void CSubsurface::onCommit() {
box = {COORDS, m_vLastSize}; box = {COORDS, m_vLastSize};
g_pHyprRenderer->damageBox(&box); g_pHyprRenderer->damageBox(&box);
} }
if (m_pWindowParent) {
// tearing: if solitary, redraw it. This still might be a single surface window
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_pWindowParent->m_iMonitorID);
if (PMONITOR && PMONITOR->solitaryClient == m_pWindowParent && m_pWindowParent->canBeTorn() && PMONITOR->tearingState.canTear &&
m_sWLSurface.wlr()->current.committed & WLR_SURFACE_STATE_BUFFER) {
CRegion damageBox{&m_sWLSurface.wlr()->buffer_damage};
if (!damageBox.empty()) {
if (PMONITOR->tearingState.busy) {
PMONITOR->tearingState.frameScheduledWhileBusy = true;
} else {
PMONITOR->tearingState.nextRenderTorn = true;
g_pHyprRenderer->renderMonitor(PMONITOR);
}
}
}
}
} }
void CSubsurface::onDestroy() { void CSubsurface::onDestroy() {

View file

@ -841,6 +841,22 @@ void Events::listener_commitWindow(void* owner, void* data) {
PWINDOW->m_pPopupHead->recheckTree(); PWINDOW->m_pPopupHead->recheckTree();
} }
// tearing: if solitary, redraw it. This still might be a single surface window
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
if (PMONITOR && PMONITOR->solitaryClient == PWINDOW && PWINDOW->canBeTorn() && PMONITOR->tearingState.canTear &&
PWINDOW->m_pWLSurface.wlr()->current.committed & WLR_SURFACE_STATE_BUFFER) {
CRegion damageBox{&PWINDOW->m_pWLSurface.wlr()->buffer_damage};
if (!damageBox.empty()) {
if (PMONITOR->tearingState.busy) {
PMONITOR->tearingState.frameScheduledWhileBusy = true;
} else {
PMONITOR->tearingState.nextRenderTorn = true;
g_pHyprRenderer->renderMonitor(PMONITOR);
}
}
}
if (PWINDOW->m_bIsX11 || !PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen) if (PWINDOW->m_bIsX11 || !PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen)
return; return;