mirror of https://github.com/hyprwm/Hyprland
protocols: minor style improvements to new impls
This commit is contained in:
parent
75c87bde3c
commit
55f1f3fedf
|
@ -1,4 +1,5 @@
|
|||
#include "CursorShape.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
// clang-format off
|
||||
constexpr const char* SHAPE_NAMES[] = {
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue