internal: minor fixups for fading out xwayland windows

fixes #4935
This commit is contained in:
Vaxry 2024-03-14 18:25:28 +00:00
parent 3e67ee0f5f
commit 164e92f8e3
4 changed files with 25 additions and 9 deletions

View file

@ -1433,11 +1433,15 @@ void CCompositor::cleanupFadingOut(const int& monid) {
bool valid = windowExists(w); bool valid = windowExists(w);
if (!valid || !w->m_bFadingOut || w->m_fAlpha.value() == 0.f) { if (!valid || !w->m_bFadingOut || w->m_fAlpha.value() == 0.f) {
if (valid && !w->m_bReadyToDelete) if (valid) {
continue; w->m_bFadingOut = false;
if (!w->m_bReadyToDelete)
continue;
removeWindowFromVectorSafe(w);
}
w->m_bFadingOut = false;
removeWindowFromVectorSafe(w);
std::erase(m_vWindowsFadingOut, w); std::erase(m_vWindowsFadingOut, w);
Debug::log(LOG, "Cleanup: destroyed a window"); Debug::log(LOG, "Cleanup: destroyed a window");

View file

@ -1137,3 +1137,9 @@ void CWindow::setSuspended(bool suspend) {
wlr_xdg_toplevel_set_suspended(m_uSurface.xdg->toplevel, suspend); wlr_xdg_toplevel_set_suspended(m_uSurface.xdg->toplevel, suspend);
m_bSuspended = suspend; m_bSuspended = suspend;
} }
bool CWindow::visibleOnMonitor(CMonitor* pMonitor) {
CBox wbox = {m_vRealPosition.value(), m_vRealSize.value()};
return wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, wbox.pWlr());
}

View file

@ -395,6 +395,7 @@ class CWindow {
bool canBeTorn(); bool canBeTorn();
bool shouldSendFullscreenState(); bool shouldSendFullscreenState();
void setSuspended(bool suspend); void setSuspended(bool suspend);
bool visibleOnMonitor(CMonitor* pMonitor);
int getRealBorderSize(); int getRealBorderSize();
void updateSpecialRenderData(); void updateSpecialRenderData();

View file

@ -335,7 +335,7 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, CWorkspace* pWork
// Non-floating main // Non-floating main
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut) if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut))
continue; continue;
if (w->m_bIsFloating) if (w->m_bIsFloating)
@ -362,7 +362,7 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, CWorkspace* pWork
// Non-floating popup // Non-floating popup
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut) if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut))
continue; continue;
if (w->m_bIsFloating) if (w->m_bIsFloating)
@ -380,7 +380,7 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, CWorkspace* pWork
// floating on top // floating on top
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut) if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut))
continue; continue;
if (!w->m_bIsFloating || w->m_bPinned) if (!w->m_bIsFloating || w->m_bPinned)
@ -410,6 +410,9 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
return; return;
} }
if (!pWindow->m_bIsMapped)
return;
TRACY_GPU_ZONE("RenderWindow"); TRACY_GPU_ZONE("RenderWindow");
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
@ -2414,8 +2417,10 @@ void CHyprRenderer::recheckSolitaryForMonitor(CMonitor* pMonitor) {
} }
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_iWorkspaceID == PCANDIDATE->m_iWorkspaceID && w->m_bIsFloating && w->m_bCreatedOverFullscreen && !w->isHidden() && (w->m_bIsMapped || w->m_bFadingOut) && if (w.get() == PCANDIDATE || (!w->m_bIsMapped && !w->m_bFadingOut) || w->isHidden())
w.get() != PCANDIDATE) continue;
if (w->m_iWorkspaceID == PCANDIDATE->m_iWorkspaceID && w->m_bIsFloating && w->m_bCreatedOverFullscreen && w->visibleOnMonitor(pMonitor))
return; return;
} }