From 7ae1d1dabdb688f2d52880e76648448fa6b63a4d Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Fri, 3 Feb 2023 10:46:18 +0000 Subject: [PATCH] don't flush display after disconnect --- src/helpers/LayerSurface.cpp | 5 +++-- src/hyprpicker.cpp | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/helpers/LayerSurface.cpp b/src/helpers/LayerSurface.cpp index dc2b4bc..aaacca8 100644 --- a/src/helpers/LayerSurface.cpp +++ b/src/helpers/LayerSurface.cpp @@ -1,7 +1,7 @@ #include "LayerSurface.hpp" -#include "../hyprpicker.hpp" #include "../events/Events.hpp" +#include "../hyprpicker.hpp" CLayerSurface::CLayerSurface(SMonitor* pMonitor) { m_pMonitor = pMonitor; @@ -36,5 +36,6 @@ CLayerSurface::~CLayerSurface() { wl_surface_destroy(pSurface); zwlr_layer_surface_v1_destroy(pLayerSurface); - wl_display_flush(g_pHyprpicker->m_pWLDisplay); + if (g_pHyprpicker->m_pWLDisplay) + wl_display_flush(g_pHyprpicker->m_pWLDisplay); } \ No newline at end of file diff --git a/src/hyprpicker.cpp b/src/hyprpicker.cpp index 8ac7019..e89513b 100644 --- a/src/hyprpicker.cpp +++ b/src/hyprpicker.cpp @@ -1,4 +1,5 @@ #include "hyprpicker.hpp" + #include "events/Events.hpp" void CHyprpicker::init() { @@ -33,6 +34,9 @@ void CHyprpicker::init() { while (m_bRunning && wl_display_dispatch(m_pWLDisplay) != -1) { //renderSurface(m_pLastSurface); } + + wl_display_disconnect(m_pWLDisplay); + m_pWLDisplay = nullptr; } void CHyprpicker::finish(int code) { @@ -210,12 +214,11 @@ void CHyprpicker::convertBuffer(SPoolBuffer* pBuffer) { std::swap(px->red, px->blue); } } - } - break; + } break; default: { Debug::log(CRIT, "Unsupported format %i", pBuffer->format); } - g_pHyprpicker->finish(1); + g_pHyprpicker->finish(1); } } @@ -271,7 +274,6 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) { // | --------- | // - cairo_restore(PCAIRO); cairo_save(PCAIRO);