diff options
author | Vaxry <[email protected]> | 2024-04-21 19:29:45 +0100 |
---|---|---|
committer | Vaxry <[email protected]> | 2024-04-21 19:29:45 +0100 |
commit | 55f1f3fedfc6dc5da7f304bdfc8296a0a056f781 (patch) | |
tree | e82c7dcbf82cc50427430d465cb919cea4a7752f | |
parent | 75c87bde3cfa38105a8c882c790e235503dc46bd (diff) | |
download | Hyprland-55f1f3fedfc6dc5da7f304bdfc8296a0a056f781.tar.gz Hyprland-55f1f3fedfc6dc5da7f304bdfc8296a0a056f781.zip |
protocols: minor style improvements to new impls
-rw-r--r-- | src/protocols/CursorShape.cpp | 1 | ||||
-rw-r--r-- | src/protocols/CursorShape.hpp | 18 | ||||
-rw-r--r-- | src/protocols/FractionalScale.hpp | 15 | ||||
-rw-r--r-- | src/protocols/IdleInhibit.hpp | 13 | ||||
-rw-r--r-- | src/protocols/TearingControl.cpp | 1 | ||||
-rw-r--r-- | src/protocols/TearingControl.hpp | 12 | ||||
-rw-r--r-- | src/protocols/XDGOutput.hpp | 12 |
7 files changed, 41 insertions, 31 deletions
diff --git a/src/protocols/CursorShape.cpp b/src/protocols/CursorShape.cpp index da27dbda..e94dda60 100644 --- a/src/protocols/CursorShape.cpp +++ b/src/protocols/CursorShape.cpp @@ -1,4 +1,5 @@ #include "CursorShape.hpp" +#include <algorithm> // clang-format off constexpr const char* SHAPE_NAMES[] = { diff --git a/src/protocols/CursorShape.hpp b/src/protocols/CursorShape.hpp index f410bf5b..9a527f85 100644 --- a/src/protocols/CursorShape.hpp +++ b/src/protocols/CursorShape.hpp @@ -12,14 +12,6 @@ class CCursorShapeProtocol : public IWaylandProtocol { virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); - void onManagerResourceDestroy(wl_resource* res); - void onDeviceResourceDestroy(wl_resource* res); - - void onGetPointer(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* pointer); - void onGetTabletToolV2(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* tablet); - - void onSetShape(CWpCursorShapeDeviceV1* pMgr, uint32_t serial, wpCursorShapeDeviceV1Shape shape); - struct SSetShapeEvent { CWpCursorShapeDeviceV1* pMgr = nullptr; wpCursorShapeDeviceV1Shape shape; @@ -31,8 +23,16 @@ class CCursorShapeProtocol : public IWaylandProtocol { } events; private: - void createCursorShapeDevice(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* resource); + void onManagerResourceDestroy(wl_resource* res); + void onDeviceResourceDestroy(wl_resource* res); + + void onGetPointer(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* pointer); + void onGetTabletToolV2(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* tablet); + + void onSetShape(CWpCursorShapeDeviceV1* pMgr, uint32_t serial, wpCursorShapeDeviceV1Shape shape); + void createCursorShapeDevice(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* resource); + // std::unordered_map<wl_resource*, SP<CWpCursorShapeDeviceV1>> m_mDevices; std::vector<UP<CWpCursorShapeManagerV1>> m_vManagers; }; diff --git a/src/protocols/FractionalScale.hpp b/src/protocols/FractionalScale.hpp index b800124f..10ebf49a 100644 --- a/src/protocols/FractionalScale.hpp +++ b/src/protocols/FractionalScale.hpp @@ -45,22 +45,23 @@ class CFractionalScaleProtocol : public IWaylandProtocol { virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); - void onManagerResourceDestroy(wl_resource* res); - void onGetFractionalScale(CWpFractionalScaleManagerV1* pMgr, uint32_t id, wlr_surface* surface); - - void sendScale(wlr_surface* surf, const float& scale); void onSurfaceDestroy(wlr_surface* surf); - - void removeAddon(CFractionalScaleAddon*); + void sendScale(wlr_surface* surf, const float& scale); private: - void registerSurface(wlr_surface*); + void removeAddon(CFractionalScaleAddon*); + void registerSurface(wlr_surface*); + void onManagerResourceDestroy(wl_resource* res); + void onGetFractionalScale(CWpFractionalScaleManagerV1* pMgr, uint32_t id, wlr_surface* surface); + // std::unordered_map<wlr_surface*, SSurfaceListener> m_mSurfaceDestroyListeners; std::unordered_map<wlr_surface*, float> m_mSurfaceScales; std::unordered_map<wlr_surface*, UP<CFractionalScaleAddon>> m_mAddons; std::vector<UP<CWpFractionalScaleManagerV1>> m_vManagers; + + friend class CFractionalScaleAddon; }; namespace PROTO { diff --git a/src/protocols/IdleInhibit.hpp b/src/protocols/IdleInhibit.hpp index 3283333f..3ea8f691 100644 --- a/src/protocols/IdleInhibit.hpp +++ b/src/protocols/IdleInhibit.hpp @@ -44,18 +44,21 @@ class CIdleInhibitProtocol : public IWaylandProtocol { virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); - void onManagerResourceDestroy(wl_resource* res); - void onCreateInhibitor(CZwpIdleInhibitManagerV1* pMgr, uint32_t id, wlr_surface* surface); - - void removeInhibitor(CIdleInhibitorResource*); - struct { CSignal newIdleInhibitor; // data: SP<CIdleInhibitor> } events; private: + void onManagerResourceDestroy(wl_resource* res); + void onCreateInhibitor(CZwpIdleInhibitManagerV1* pMgr, uint32_t id, wlr_surface* surface); + + void removeInhibitor(CIdleInhibitorResource*); + + // std::vector<UP<CZwpIdleInhibitManagerV1>> m_vManagers; std::vector<SP<CIdleInhibitorResource>> m_vInhibitors; + + friend class CIdleInhibitorResource; }; namespace PROTO { diff --git a/src/protocols/TearingControl.cpp b/src/protocols/TearingControl.cpp index 21d37e3c..40167766 100644 --- a/src/protocols/TearingControl.cpp +++ b/src/protocols/TearingControl.cpp @@ -26,6 +26,7 @@ void CTearingControlProtocol::onGetController(wl_client* client, wl_resource* re m_vTearingControllers.emplace_back(std::make_unique<CTearingControl>(std::make_shared<CWpTearingControlV1>(client, wl_resource_get_version(resource), id), surf)).get(); if (!CONTROLLER->good()) { + wl_resource_post_no_memory(resource); m_vTearingControllers.pop_back(); return; } diff --git a/src/protocols/TearingControl.hpp b/src/protocols/TearingControl.hpp index fbd0e1fc..b13bbb82 100644 --- a/src/protocols/TearingControl.hpp +++ b/src/protocols/TearingControl.hpp @@ -39,15 +39,17 @@ class CTearingControlProtocol : public IWaylandProtocol { virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); - void onManagerResourceDestroy(wl_resource* res); - void onControllerDestroy(CTearingControl* control); - void onGetController(wl_client* client, wl_resource* resource, uint32_t id, wlr_surface* surf); - private: - void onWindowDestroy(CWindow* pWindow); + void onManagerResourceDestroy(wl_resource* res); + void onControllerDestroy(CTearingControl* control); + void onGetController(wl_client* client, wl_resource* resource, uint32_t id, wlr_surface* surf); + void onWindowDestroy(CWindow* pWindow); + // std::vector<UP<CWpTearingControlManagerV1>> m_vManagers; std::vector<UP<CTearingControl>> m_vTearingControllers; + + friend class CTearingControl; }; namespace PROTO { diff --git a/src/protocols/XDGOutput.hpp b/src/protocols/XDGOutput.hpp index d2314b7b..73e7d53e 100644 --- a/src/protocols/XDGOutput.hpp +++ b/src/protocols/XDGOutput.hpp @@ -31,15 +31,17 @@ class CXDGOutputProtocol : public IWaylandProtocol { virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); - void onManagerResourceDestroy(wl_resource* res); - void onOutputResourceDestroy(wl_resource* res); - void onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32_t id, wl_resource* outputResource); - private: - void updateAllOutputs(); + void onManagerResourceDestroy(wl_resource* res); + void onOutputResourceDestroy(wl_resource* res); + void onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32_t id, wl_resource* outputResource); + void updateAllOutputs(); + // std::vector<UP<CZxdgOutputManagerV1>> m_vManagerResources; std::vector<UP<CXDGOutput>> m_vXDGOutputs; + + friend class CXDGOutput; }; namespace PROTO { |