From 496e37d044a091baa2097c6e8e1d4a3992e11ec6 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 9 Oct 2022 17:02:32 +0100 Subject: ensure texture safety in clearWithTex() --- src/render/OpenGL.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 1877a08e..96a3fdbd 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -1291,7 +1291,15 @@ void CHyprOpenGLImpl::clearWithTex() { static auto *const PRENDERTEX = &g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo")->intValue; if (!*PRENDERTEX) { - renderTexture(m_mMonitorBGTextures[m_RenderData.pMonitor], &m_mMonitorRenderResources[m_RenderData.pMonitor].backgroundTexBox, 255, 0); + auto TEXIT = m_mMonitorBGTextures.find(m_RenderData.pMonitor); + + if (TEXIT == m_mMonitorBGTextures.end()) { + createBGTextureForMonitor(m_RenderData.pMonitor); + TEXIT = m_mMonitorBGTextures.find(m_RenderData.pMonitor); + } + + if (TEXIT != m_mMonitorBGTextures.end()) + renderTexture(TEXIT->second, &m_mMonitorRenderResources[m_RenderData.pMonitor].backgroundTexBox, 255, 0); } } -- cgit v1.2.3 From 0743dab3f05667afe187558fe06dcb07ec66c990 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 9 Oct 2022 17:09:11 +0100 Subject: use popup base surface instead of subsurface for addPopupGlobalCoords --- src/events/Popups.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/events/Popups.cpp b/src/events/Popups.cpp index 74865f95..afc1e7c8 100644 --- a/src/events/Popups.cpp +++ b/src/events/Popups.cpp @@ -32,8 +32,8 @@ void addPopupGlobalCoords(void* pPopup, int* x, int* y) { py -= curPopup->popup->base->current.geometry.y; } - if (curPopup->pSurfaceTree && curPopup->pSurfaceTree->pSurface && !curPopup->parentPopup && !curPopup->parentWindow) { - const auto EXTENTSSURFACE = pixman_region32_extents(&curPopup->pSurfaceTree->pSurface->input_region); + if (curPopup->popup && !curPopup->parentPopup && !curPopup->parentWindow) { + const auto EXTENTSSURFACE = pixman_region32_extents(&curPopup->popup->base->surface->input_region); px -= EXTENTSSURFACE->x1; py -= EXTENTSSURFACE->y1; } -- cgit v1.2.3 From 881f8282501845f57505015e85abbe668bfb740f Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 9 Oct 2022 17:23:12 +0100 Subject: better subsurface handling on unmaps --- src/helpers/SubsurfaceTree.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/helpers/SubsurfaceTree.cpp b/src/helpers/SubsurfaceTree.cpp index a5c7f0a0..349f5090 100644 --- a/src/helpers/SubsurfaceTree.cpp +++ b/src/helpers/SubsurfaceTree.cpp @@ -178,19 +178,23 @@ void Events::listener_unmapSubsurface(void* owner, void* data) { if (subsurface->pChild) { const auto PNODE = subsurface->pChild; - int lx = 0, ly = 0; - addSurfaceGlobalOffset(PNODE, &lx, &ly); + const auto IT = std::find_if(SubsurfaceTree::surfaceTreeNodes.begin(), SubsurfaceTree::surfaceTreeNodes.end(), [&](const SSurfaceTreeNode& other) { return &other == PNODE; }); - wlr_box extents = {lx, ly, 0, 0}; - if (PNODE->pSurface) { - extents.width = PNODE->pSurface->current.width; - extents.height = PNODE->pSurface->current.height; + if (IT != SubsurfaceTree::surfaceTreeNodes.end()) { + int lx = 0, ly = 0; + addSurfaceGlobalOffset(PNODE, &lx, &ly); - g_pHyprRenderer->damageBox(&extents); - } + wlr_box extents = {lx, ly, 0, 0}; + if (PNODE->pSurface) { + extents.width = PNODE->pSurface->current.width; + extents.height = PNODE->pSurface->current.height; - //SubsurfaceTree::destroySurfaceTree(subsurface->pChild); - //subsurface->pChild = nullptr; + g_pHyprRenderer->damageBox(&extents); + } + + // SubsurfaceTree::destroySurfaceTree(subsurface->pChild); + // subsurface->pChild = nullptr; + } } } -- cgit v1.2.3