mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 11:45:58 +01:00
protocols: minor style improvements to new impls
This commit is contained in:
parent
75c87bde3c
commit
55f1f3fedf
7 changed files with 41 additions and 31 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include "CursorShape.hpp"
|
#include "CursorShape.hpp"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
constexpr const char* SHAPE_NAMES[] = {
|
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);
|
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 {
|
struct SSetShapeEvent {
|
||||||
CWpCursorShapeDeviceV1* pMgr = nullptr;
|
CWpCursorShapeDeviceV1* pMgr = nullptr;
|
||||||
wpCursorShapeDeviceV1Shape shape;
|
wpCursorShapeDeviceV1Shape shape;
|
||||||
|
@ -31,8 +23,16 @@ class CCursorShapeProtocol : public IWaylandProtocol {
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
private:
|
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::unordered_map<wl_resource*, SP<CWpCursorShapeDeviceV1>> m_mDevices;
|
||||||
std::vector<UP<CWpCursorShapeManagerV1>> m_vManagers;
|
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);
|
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 onSurfaceDestroy(wlr_surface* surf);
|
||||||
|
void sendScale(wlr_surface* surf, const float& scale);
|
||||||
void removeAddon(CFractionalScaleAddon*);
|
|
||||||
|
|
||||||
private:
|
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*, SSurfaceListener> m_mSurfaceDestroyListeners;
|
||||||
|
|
||||||
std::unordered_map<wlr_surface*, float> m_mSurfaceScales;
|
std::unordered_map<wlr_surface*, float> m_mSurfaceScales;
|
||||||
std::unordered_map<wlr_surface*, UP<CFractionalScaleAddon>> m_mAddons;
|
std::unordered_map<wlr_surface*, UP<CFractionalScaleAddon>> m_mAddons;
|
||||||
std::vector<UP<CWpFractionalScaleManagerV1>> m_vManagers;
|
std::vector<UP<CWpFractionalScaleManagerV1>> m_vManagers;
|
||||||
|
|
||||||
|
friend class CFractionalScaleAddon;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace PROTO {
|
namespace PROTO {
|
||||||
|
|
|
@ -44,18 +44,21 @@ class CIdleInhibitProtocol : public IWaylandProtocol {
|
||||||
|
|
||||||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
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 {
|
struct {
|
||||||
CSignal newIdleInhibitor; // data: SP<CIdleInhibitor>
|
CSignal newIdleInhibitor; // data: SP<CIdleInhibitor>
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
private:
|
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<UP<CZwpIdleInhibitManagerV1>> m_vManagers;
|
||||||
std::vector<SP<CIdleInhibitorResource>> m_vInhibitors;
|
std::vector<SP<CIdleInhibitorResource>> m_vInhibitors;
|
||||||
|
|
||||||
|
friend class CIdleInhibitorResource;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace PROTO {
|
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();
|
m_vTearingControllers.emplace_back(std::make_unique<CTearingControl>(std::make_shared<CWpTearingControlV1>(client, wl_resource_get_version(resource), id), surf)).get();
|
||||||
|
|
||||||
if (!CONTROLLER->good()) {
|
if (!CONTROLLER->good()) {
|
||||||
|
wl_resource_post_no_memory(resource);
|
||||||
m_vTearingControllers.pop_back();
|
m_vTearingControllers.pop_back();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,15 +39,17 @@ class CTearingControlProtocol : public IWaylandProtocol {
|
||||||
|
|
||||||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
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:
|
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<CWpTearingControlManagerV1>> m_vManagers;
|
||||||
std::vector<UP<CTearingControl>> m_vTearingControllers;
|
std::vector<UP<CTearingControl>> m_vTearingControllers;
|
||||||
|
|
||||||
|
friend class CTearingControl;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace PROTO {
|
namespace PROTO {
|
||||||
|
|
|
@ -31,15 +31,17 @@ class CXDGOutputProtocol : public IWaylandProtocol {
|
||||||
|
|
||||||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
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:
|
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<CZxdgOutputManagerV1>> m_vManagerResources;
|
||||||
std::vector<UP<CXDGOutput>> m_vXDGOutputs;
|
std::vector<UP<CXDGOutput>> m_vXDGOutputs;
|
||||||
|
|
||||||
|
friend class CXDGOutput;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace PROTO {
|
namespace PROTO {
|
||||||
|
|
Loading…
Reference in a new issue