cursorshape: use unique ptrs

less refcounting.
This commit is contained in:
Tom Englund
2025-07-10 12:55:00 +02:00
committed by Vaxry
parent a21882be33
commit 87653077f8
2 changed files with 4 additions and 4 deletions

View File

@@ -32,8 +32,8 @@ void CCursorShapeProtocol::onGetTabletToolV2(CWpCursorShapeManagerV1* pMgr, uint
}
void CCursorShapeProtocol::createCursorShapeDevice(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* resource) {
const auto CLIENT = pMgr->client();
const auto RESOURCE = m_devices.emplace_back(makeShared<CWpCursorShapeDeviceV1>(CLIENT, pMgr->version(), id));
const auto CLIENT = pMgr->client();
const auto& RESOURCE = m_devices.emplace_back(makeUnique<CWpCursorShapeDeviceV1>(CLIENT, pMgr->version(), id));
RESOURCE->setOnDestroy([this](CWpCursorShapeDeviceV1* p) { this->onDeviceResourceDestroy(p->resource()); });
RESOURCE->setDestroy([this](CWpCursorShapeDeviceV1* p) { this->onDeviceResourceDestroy(p->resource()); });
@@ -52,4 +52,4 @@ void CCursorShapeProtocol::onSetShape(CWpCursorShapeDeviceV1* pMgr, uint32_t ser
event.shapeName = CURSOR_SHAPE_NAMES.at(shape);
m_events.setShape.emit(event);
}
}

View File

@@ -32,7 +32,7 @@ class CCursorShapeProtocol : public IWaylandProtocol {
void createCursorShapeDevice(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* resource);
//
std::vector<SP<CWpCursorShapeDeviceV1>> m_devices;
std::vector<UP<CWpCursorShapeDeviceV1>> m_devices;
std::vector<UP<CWpCursorShapeManagerV1>> m_managers;
};