mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-07-25 17:21:54 -07:00
ctmcontrol: move to unique ptrs
less refcounting, move by rvalue.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../helpers/MiscFunctions.hpp"
|
||||
|
||||
CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlManagerV1> resource_) : m_resource(resource_) {
|
||||
CHyprlandCTMControlResource::CHyprlandCTMControlResource(UP<CHyprlandCtmControlManagerV1>&& resource_) : m_resource(std::move(resource_)) {
|
||||
if UNLIKELY (!good())
|
||||
return;
|
||||
|
||||
@@ -87,7 +87,7 @@ CHyprlandCTMControlProtocol::CHyprlandCTMControlProtocol(const wl_interface* ifa
|
||||
}
|
||||
|
||||
void CHyprlandCTMControlProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||
const auto RESOURCE = m_managers.emplace_back(makeShared<CHyprlandCTMControlResource>(makeShared<CHyprlandCtmControlManagerV1>(client, ver, id)));
|
||||
const auto& RESOURCE = m_managers.emplace_back(makeUnique<CHyprlandCTMControlResource>(makeUnique<CHyprlandCtmControlManagerV1>(client, ver, id)));
|
||||
|
||||
if UNLIKELY (!RESOURCE->good()) {
|
||||
wl_client_post_no_memory(client);
|
||||
|
@@ -12,14 +12,14 @@ class CMonitor;
|
||||
|
||||
class CHyprlandCTMControlResource {
|
||||
public:
|
||||
CHyprlandCTMControlResource(SP<CHyprlandCtmControlManagerV1> resource_);
|
||||
CHyprlandCTMControlResource(UP<CHyprlandCtmControlManagerV1>&& resource_);
|
||||
~CHyprlandCTMControlResource();
|
||||
|
||||
bool good();
|
||||
void block();
|
||||
|
||||
private:
|
||||
SP<CHyprlandCtmControlManagerV1> m_resource;
|
||||
UP<CHyprlandCtmControlManagerV1> m_resource;
|
||||
|
||||
std::unordered_map<std::string, Mat3x3> m_ctms;
|
||||
bool m_blocked = false;
|
||||
@@ -38,7 +38,7 @@ class CHyprlandCTMControlProtocol : public IWaylandProtocol {
|
||||
bool isCTMAnimationEnabled();
|
||||
|
||||
//
|
||||
std::vector<SP<CHyprlandCTMControlResource>> m_managers;
|
||||
std::vector<UP<CHyprlandCTMControlResource>> m_managers;
|
||||
WP<CHyprlandCTMControlResource> m_manager;
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user