[client] wayland: do not leak cursor wl_buffer and wl_surface

This commit is contained in:
Quantum
2021-04-05 20:06:49 -04:00
committed by Geoffrey McRae
parent a380803d37
commit 30c3b399f2
3 changed files with 14 additions and 3 deletions

View File

@@ -82,17 +82,25 @@ bool waylandCursorInit(void)
return false;
}
struct wl_buffer * cursorBuffer = createCursorBuffer();
if (cursorBuffer)
wlWm.cursorBuffer = createCursorBuffer();
if (wlWm.cursorBuffer)
{
wlWm.cursor = wl_compositor_create_surface(wlWm.compositor);
wl_surface_attach(wlWm.cursor, cursorBuffer, 0, 0);
wl_surface_attach(wlWm.cursor, wlWm.cursorBuffer, 0, 0);
wl_surface_commit(wlWm.cursor);
}
return true;
}
void waylandCursorFree(void)
{
if (wlWm.cursor)
wl_surface_destroy(wlWm.cursor);
if (wlWm.cursorBuffer)
wl_buffer_destroy(wlWm.cursorBuffer);
}
void waylandShowPointer(bool show)
{
wlWm.showPointer = show;