mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 09:45:59 +01:00
renderer: separate workspace window render logic
Makes the logic used to render stuff over the windows (special, popups, ime, lockscreen) unified by yeeting the workspace window logic (which is separate cuz fullscreen windows) into their own funcs. Fixes #2053
This commit is contained in:
parent
35df4693ea
commit
32f75ebb70
2 changed files with 79 additions and 129 deletions
|
@ -136,7 +136,7 @@ bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time) {
|
void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time) {
|
||||||
CWindow* pWorkspaceWindow = nullptr;
|
CWindow* pWorkspaceWindow = nullptr;
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
||||||
|
@ -201,56 +201,92 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWor
|
||||||
|
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// and then special windows
|
void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time) {
|
||||||
if (pMonitor->specialWorkspaceID)
|
CWindow* lastWindow = nullptr;
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
|
||||||
if (!g_pCompositor->windowValidMapped(w.get()) && !w->m_bFadingOut)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (w->m_iWorkspaceID != pMonitor->specialWorkspaceID)
|
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
|
// Non-floating main
|
||||||
continue;
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
|
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
|
||||||
|
continue;
|
||||||
|
|
||||||
// render the bad boy
|
if (w->m_bIsFloating)
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
continue; // floating are in the second pass
|
||||||
|
|
||||||
|
if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
|
||||||
|
continue; // special are in the third pass
|
||||||
|
|
||||||
|
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// render active window after all others of this pass
|
||||||
|
if (w.get() == g_pCompositor->m_pLastWindow) {
|
||||||
|
lastWindow = w.get();
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("render", RENDER_POST_WINDOWS);
|
// render the bad boy
|
||||||
|
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_MAIN);
|
||||||
// and the overlay layers
|
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
|
||||||
if (ls->alpha.fl() != 0.f)
|
|
||||||
renderLayer(ls.get(), pMonitor, time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
|
if (lastWindow)
|
||||||
renderLayer(ls.get(), pMonitor, time);
|
renderWindow(lastWindow, pMonitor, time, true, RENDER_PASS_MAIN);
|
||||||
|
|
||||||
|
// Non-floating popup
|
||||||
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
|
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (w->m_bIsFloating)
|
||||||
|
continue; // floating are in the second pass
|
||||||
|
|
||||||
|
if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
|
||||||
|
continue; // special are in the third pass
|
||||||
|
|
||||||
|
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// render the bad boy
|
||||||
|
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_POPUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render IME popups
|
// floating on top
|
||||||
for (auto& imep : g_pInputManager->m_sIMERelay.m_lIMEPopups) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
renderIMEPopup(&imep, pMonitor, time);
|
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!w->m_bIsFloating || w->m_bPinned)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// render the bad boy
|
||||||
|
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderDragIcon(pMonitor, time);
|
// pinned always above
|
||||||
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
|
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
|
||||||
|
continue;
|
||||||
|
|
||||||
// if correct monitor draw hyprerror
|
if (!w->m_bPinned || !w->m_bIsFloating)
|
||||||
if (pMonitor == g_pCompositor->m_vMonitors.front().get())
|
continue;
|
||||||
g_pHyprError->draw();
|
|
||||||
|
|
||||||
if (g_pSessionLockManager->isSessionLocked()) {
|
if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
|
||||||
const auto PSLS = g_pSessionLockManager->getSessionLockSurfaceForMonitor(pMonitor->ID);
|
continue;
|
||||||
|
|
||||||
if (!PSLS) {
|
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
|
||||||
// locked with no surface, fill with red
|
continue;
|
||||||
wlr_box boxe = {0, 0, INT16_MAX, INT16_MAX};
|
|
||||||
g_pHyprOpenGL->renderRect(&boxe, CColor(1.0, 0.2, 0.2, 1.0));
|
// render the bad boy
|
||||||
} else {
|
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
||||||
renderSessionLockSurface(PSLS, pMonitor, time);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,99 +541,12 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
|
||||||
// pre window pass
|
// pre window pass
|
||||||
g_pHyprOpenGL->preWindowPass();
|
g_pHyprOpenGL->preWindowPass();
|
||||||
|
|
||||||
// if there is a fullscreen window, render it and then do not render anymore.
|
if (pWorkspace->m_bHasFullscreenWindow)
|
||||||
// fullscreen window will hide other windows and top layers
|
renderWorkspaceWindowsFullscreen(pMonitor, pWorkspace, time);
|
||||||
|
else
|
||||||
|
renderWorkspaceWindows(pMonitor, pWorkspace, time);
|
||||||
|
|
||||||
if (pWorkspace->m_bHasFullscreenWindow) {
|
g_pHyprOpenGL->m_RenderData.renderModif = {};
|
||||||
renderWorkspaceWithFullscreenWindow(pMonitor, pWorkspace, time);
|
|
||||||
g_pHyprOpenGL->m_RenderData.renderModif = {};
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CWindow* lastWindow = nullptr;
|
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
|
||||||
|
|
||||||
// Non-floating main
|
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
|
||||||
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (w->m_bIsFloating)
|
|
||||||
continue; // floating are in the second pass
|
|
||||||
|
|
||||||
if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
|
|
||||||
continue; // special are in the third pass
|
|
||||||
|
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// render active window after all others of this pass
|
|
||||||
if (w.get() == g_pCompositor->m_pLastWindow) {
|
|
||||||
lastWindow = w.get();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// render the bad boy
|
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_MAIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastWindow)
|
|
||||||
renderWindow(lastWindow, pMonitor, time, true, RENDER_PASS_MAIN);
|
|
||||||
|
|
||||||
// Non-floating popup
|
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
|
||||||
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (w->m_bIsFloating)
|
|
||||||
continue; // floating are in the second pass
|
|
||||||
|
|
||||||
if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
|
|
||||||
continue; // special are in the third pass
|
|
||||||
|
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// render the bad boy
|
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_POPUP);
|
|
||||||
}
|
|
||||||
|
|
||||||
// floating on top
|
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
|
||||||
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!w->m_bIsFloating || w->m_bPinned)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// render the bad boy
|
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// pinned always above
|
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
|
||||||
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!w->m_bPinned || !w->m_bIsFloating)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// render the bad boy
|
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// and then special
|
// and then special
|
||||||
for (auto& ws : g_pCompositor->m_vWorkspaces) {
|
for (auto& ws : g_pCompositor->m_vWorkspaces) {
|
||||||
|
|
|
@ -77,7 +77,8 @@ class CHyprRenderer {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void arrangeLayerArray(CMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, wlr_box*);
|
void arrangeLayerArray(CMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, wlr_box*);
|
||||||
void renderWorkspaceWithFullscreenWindow(CMonitor*, CWorkspace*, timespec*);
|
void renderWorkspaceWindowsFullscreen(CMonitor*, CWorkspace*, timespec*); // renders workspace windows (fullscreen) (tiled, floating, pinned, but no special)
|
||||||
|
void renderWorkspaceWindows(CMonitor*, CWorkspace*, timespec*); // renders workspace windows (no fullscreen) (tiled, floating, pinned, but no special)
|
||||||
void renderWindow(CWindow*, CMonitor*, timespec*, bool, eRenderPassMode, bool ignorePosition = false, bool ignoreAllGeometry = false);
|
void renderWindow(CWindow*, CMonitor*, timespec*, bool, eRenderPassMode, bool ignorePosition = false, bool ignoreAllGeometry = false);
|
||||||
void renderLayer(SLayerSurface*, CMonitor*, timespec*);
|
void renderLayer(SLayerSurface*, CMonitor*, timespec*);
|
||||||
void renderSessionLockSurface(SSessionLockSurface*, CMonitor*, timespec*);
|
void renderSessionLockSurface(SSessionLockSurface*, CMonitor*, timespec*);
|
||||||
|
|
Loading…
Reference in a new issue