protocols: fix alpha-modifier noncompliance (#8929)
Also fixes small issues with hyprland-surface opacity < 1.0 while surface alpha = 1.0.
This commit is contained in:
parent
cbd2451570
commit
42fd366046
4 changed files with 90 additions and 83 deletions
|
|
@ -8,25 +8,28 @@
|
|||
#include "../helpers/signal/Signal.hpp"
|
||||
|
||||
class CWLSurfaceResource;
|
||||
class CAlphaModifierProtocol;
|
||||
|
||||
class CAlphaModifier {
|
||||
public:
|
||||
CAlphaModifier(SP<CWpAlphaModifierSurfaceV1> resource_, SP<CWLSurfaceResource> surface);
|
||||
~CAlphaModifier();
|
||||
|
||||
bool good();
|
||||
SP<CWLSurfaceResource> getSurface();
|
||||
void onSurfaceDestroy();
|
||||
bool good();
|
||||
void setResource(SP<CWpAlphaModifierSurfaceV1> resource);
|
||||
|
||||
private:
|
||||
SP<CWpAlphaModifierSurfaceV1> resource;
|
||||
WP<CWLSurfaceResource> pSurface;
|
||||
SP<CWpAlphaModifierSurfaceV1> m_pResource;
|
||||
WP<CWLSurfaceResource> m_pSurface;
|
||||
float m_fAlpha = 1.0;
|
||||
|
||||
void setSurfaceAlpha(float a);
|
||||
void destroy();
|
||||
|
||||
struct {
|
||||
CHyprSignalListener destroySurface;
|
||||
CHyprSignalListener surfaceCommitted;
|
||||
CHyprSignalListener surfaceDestroyed;
|
||||
} listeners;
|
||||
|
||||
friend class CAlphaModifierProtocol;
|
||||
};
|
||||
|
||||
class CAlphaModifierProtocol : public IWaylandProtocol {
|
||||
|
|
@ -36,13 +39,13 @@ class CAlphaModifierProtocol : public IWaylandProtocol {
|
|||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
||||
|
||||
private:
|
||||
void onManagerResourceDestroy(wl_resource* res);
|
||||
void destroyModifier(CAlphaModifier* decoration);
|
||||
void onGetSurface(CWpAlphaModifierV1* pMgr, uint32_t id, SP<CWLSurfaceResource> surface);
|
||||
void destroyManager(CWpAlphaModifierV1* res);
|
||||
void destroyAlphaModifier(CAlphaModifier* surface);
|
||||
void getSurface(CWpAlphaModifierV1* manager, uint32_t id, SP<CWLSurfaceResource> surface);
|
||||
|
||||
//
|
||||
std::vector<UP<CWpAlphaModifierV1>> m_vManagers;
|
||||
std::unordered_map<WP<CWLSurfaceResource>, UP<CAlphaModifier>> m_mAlphaModifiers; // xdg_toplevel -> deco
|
||||
std::unordered_map<WP<CWLSurfaceResource>, UP<CAlphaModifier>> m_mAlphaModifiers;
|
||||
|
||||
friend class CAlphaModifier;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue