mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-07 18:45:59 +01:00
parent
f2b03e9679
commit
5e6f7b1cdb
2 changed files with 5 additions and 11 deletions
|
@ -48,11 +48,11 @@ CCursorShapeProtocol::CCursorShapeProtocol(const wl_interface* iface, const int&
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCursorShapeProtocol::onManagerResourceDestroy(wl_resource* res) {
|
void CCursorShapeProtocol::onManagerResourceDestroy(wl_resource* res) {
|
||||||
std::erase_if(m_vManagers, [&](const auto& other) { return other->resource() == res; });
|
std::erase_if(m_vManagers, [res](const auto& other) { return other->resource() == res; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCursorShapeProtocol::onDeviceResourceDestroy(wl_resource* res) {
|
void CCursorShapeProtocol::onDeviceResourceDestroy(wl_resource* res) {
|
||||||
m_mDevices.erase(res);
|
std::erase_if(m_vDevices, [res](const auto& other) { return other->resource() == res; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCursorShapeProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
void CCursorShapeProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||||
|
@ -73,14 +73,8 @@ void CCursorShapeProtocol::onGetTabletToolV2(CWpCursorShapeManagerV1* pMgr, uint
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCursorShapeProtocol::createCursorShapeDevice(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* resource) {
|
void CCursorShapeProtocol::createCursorShapeDevice(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* resource) {
|
||||||
if (m_mDevices.contains(resource)) {
|
|
||||||
LOGM(ERR, "CursorShape device already exists for {:x}", (uintptr_t)resource);
|
|
||||||
wl_resource_post_error(resource, 0, "Device already exists");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto CLIENT = wl_resource_get_client(pMgr->resource());
|
const auto CLIENT = wl_resource_get_client(pMgr->resource());
|
||||||
const auto RESOURCE = m_mDevices.emplace(resource, std::make_shared<CWpCursorShapeDeviceV1>(CLIENT, wl_resource_get_version(pMgr->resource()), id)).first->second.get();
|
const auto RESOURCE = m_vDevices.emplace_back(std::make_shared<CWpCursorShapeDeviceV1>(CLIENT, wl_resource_get_version(pMgr->resource()), id));
|
||||||
RESOURCE->setOnDestroy([this](CWpCursorShapeDeviceV1* p) { this->onDeviceResourceDestroy(p->resource()); });
|
RESOURCE->setOnDestroy([this](CWpCursorShapeDeviceV1* p) { this->onDeviceResourceDestroy(p->resource()); });
|
||||||
|
|
||||||
RESOURCE->setDestroy([this](CWpCursorShapeDeviceV1* p) { this->onDeviceResourceDestroy(p->resource()); });
|
RESOURCE->setDestroy([this](CWpCursorShapeDeviceV1* p) { this->onDeviceResourceDestroy(p->resource()); });
|
||||||
|
|
|
@ -33,7 +33,7 @@ class CCursorShapeProtocol : public IWaylandProtocol {
|
||||||
void createCursorShapeDevice(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* resource);
|
void createCursorShapeDevice(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* resource);
|
||||||
|
|
||||||
//
|
//
|
||||||
std::unordered_map<wl_resource*, SP<CWpCursorShapeDeviceV1>> m_mDevices;
|
std::vector<SP<CWpCursorShapeDeviceV1>> m_vDevices;
|
||||||
std::vector<UP<CWpCursorShapeManagerV1>> m_vManagers;
|
std::vector<UP<CWpCursorShapeManagerV1>> m_vManagers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue