renderer: remove widgets for destroyed lockSurfaces

This commit is contained in:
Maximilian Seidler 2024-06-27 19:53:19 +02:00
parent 8e91c4b0f9
commit ee9d75b580
3 changed files with 11 additions and 1 deletions

View file

@ -300,7 +300,11 @@ void CHyprlock::onGlobal(void* data, struct wl_registry* registry, uint32_t name
void CHyprlock::onGlobalRemoved(void* data, struct wl_registry* registry, uint32_t name) {
Debug::log(LOG, " | removed iface {}", name);
std::erase_if(m_vOutputs, [name](const auto& other) { return other->name == name; });
auto outputIt = std::find_if(m_vOutputs.begin(), m_vOutputs.end(), [name](const auto& other) { return other->name == name; });
if (outputIt != m_vOutputs.end()) {
g_pRenderer->removeWidgetsFor(outputIt->get()->sessionLockSurface.get());
m_vOutputs.erase(outputIt);
}
}
// end wl_registry

View file

@ -512,3 +512,7 @@ void CRenderer::popFb() {
boundFBs.pop_back();
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, boundFBs.empty() ? 0 : boundFBs.back());
}
void CRenderer::removeWidgetsFor(const CSessionLockSurface* surf) {
widgets.erase(surf);
}

View file

@ -41,6 +41,8 @@ class CRenderer {
void pushFb(GLint fb);
void popFb();
void removeWidgetsFor(const CSessionLockSurface* surf);
private:
widgetMap_t widgets;