core/surface: fixup a few pointer handling edge cases

This commit is contained in:
Vaxry
2024-07-29 19:02:58 +02:00
parent 9c38b0fdbe
commit e673220340
3 changed files with 13 additions and 2 deletions

View File

@@ -151,6 +151,8 @@ void CPointerManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hots
currentCursorImage.surface = surf;
currentCursorImage.scale = surf->resource()->current.scale;
surf->resource()->map();
currentCursorImage.destroySurface = surf->events.destroy.registerListener([this](std::any data) { resetCursorImage(); });
currentCursorImage.commitSurface = surf->resource()->events.commit.registerListener([this](std::any data) {
damageIfSoftware();
@@ -222,6 +224,8 @@ void CPointerManager::resetCursorImage(bool apply) {
currentCursorImage.surface->resource()->leave(m);
}
currentCursorImage.surface->resource()->unmap();
currentCursorImage.destroySurface.reset();
currentCursorImage.commitSurface.reset();
currentCursorImage.surface.reset();