renderer: use optional for cursor surface storing

because nullptr is a valid surface.

fixes #3692
This commit is contained in:
Vaxry 2023-10-30 00:18:40 +00:00
parent 86318ce04f
commit 8e91c038db
2 changed files with 3 additions and 3 deletions

View file

@ -1956,7 +1956,7 @@ void CHyprRenderer::setCursorFromName(const std::string& name) {
return; return;
m_sLastCursorData.name = name; m_sLastCursorData.name = name;
m_sLastCursorData.surf = nullptr; m_sLastCursorData.surf.reset();
wlr_cursor_set_xcursor(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sWLRXCursorMgr, name.c_str()); wlr_cursor_set_xcursor(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sWLRXCursorMgr, name.c_str());
} }

View file

@ -84,7 +84,7 @@ class CHyprRenderer {
CTimer m_tRenderTimer; CTimer m_tRenderTimer;
struct { struct {
wlr_surface* surf = nullptr; std::optional<wlr_surface*> surf = nullptr;
std::string name; std::string name;
} m_sLastCursorData; } m_sLastCursorData;