diff --git a/src/Hyprpaper.cpp b/src/Hyprpaper.cpp index 6a76313..09b45c8 100644 --- a/src/Hyprpaper.cpp +++ b/src/Hyprpaper.cpp @@ -146,7 +146,9 @@ void CHyprpaper::recheckMonitor(SMonitor* pMonitor) { XCURSOR_SIZE = 24; } } - pMonitor->pCurrentLayerSurface->pCursorImg = wl_cursor_theme_get_cursor(wl_cursor_theme_load(getenv("XCURSOR_THEME"), XCURSOR_SIZE * pMonitor->scale, m_sSHM), "left_ptr")->images[0]; + + pMonitor->pCurrentLayerSurface->pCursorTheme = wl_cursor_theme_load(getenv("XCURSOR_THEME"), XCURSOR_SIZE * pMonitor->scale, m_sSHM); + pMonitor->pCurrentLayerSurface->pCursorImg = wl_cursor_theme_get_cursor(pMonitor->pCurrentLayerSurface->pCursorTheme, "left_ptr")->images[0]; } } diff --git a/src/render/LayerSurface.cpp b/src/render/LayerSurface.cpp index 9425802..cd0b21a 100644 --- a/src/render/LayerSurface.cpp +++ b/src/render/LayerSurface.cpp @@ -49,6 +49,10 @@ CLayerSurface::CLayerSurface(SMonitor* pMonitor) { } CLayerSurface::~CLayerSurface() { + + if (pCursorTheme) + wl_cursor_theme_destroy(pCursorTheme); + if (g_pHyprpaper->m_sFractionalScale && pFractionalScaleInfo) { wp_fractional_scale_v1_destroy(pFractionalScaleInfo); diff --git a/src/render/LayerSurface.hpp b/src/render/LayerSurface.hpp index d030540..151a8bf 100644 --- a/src/render/LayerSurface.hpp +++ b/src/render/LayerSurface.hpp @@ -14,6 +14,7 @@ public: zwlr_layer_surface_v1* pLayerSurface = nullptr; wl_surface* pSurface = nullptr; + wl_cursor_theme* pCursorTheme = nullptr; wl_cursor_image* pCursorImg = nullptr; wl_surface* pCursorSurface = nullptr;