summaryrefslogtreecommitdiff
path: root/src/render/decorations/CHyprDropShadowDecoration.hpp
blob: d8a01edb082e7c9ab762c9d8a9048985a78273d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once

#include "IHyprWindowDecoration.hpp"

struct SShadowRenderData {
    bool    ignoreWindow = false;
    bool    valid        = false;
    CBox    fullBox;
    CBox    windowBox;
    CRegion saveDamage;
    float   rounding      = 0;
    float   roundingPower = 0;
    int     size          = 0;
};

class CHyprDropShadowDecoration : public IHyprWindowDecoration {
  public:
    CHyprDropShadowDecoration(PHLWINDOW);
    virtual ~CHyprDropShadowDecoration() = default;

    virtual SDecorationPositioningInfo getPositioningInfo();

    virtual void                       onPositioningReply(const SDecorationPositioningReply& reply);

    virtual void                       draw(PHLMONITOR, float const& a);

    virtual eDecorationType            getDecorationType();

    virtual void                       updateWindow(PHLWINDOW);

    virtual void                       damageEntire();

    virtual eDecorationLayer           getDecorationLayer();

    virtual uint64_t                   getDecorationFlags();

    virtual std::string                getDisplayName();

    bool                               canRender(PHLMONITOR);
    SShadowRenderData                  getRenderData(PHLMONITOR, float const& a);
    void                               reposition();

    // TODO remove
    void render(PHLMONITOR, float const& a);

  private:
    SBoxExtents  m_extents;
    SBoxExtents  m_reportedExtents;

    PHLWINDOWREF m_window;

    Vector2D     m_lastWindowPos;
    Vector2D     m_lastWindowSize;

    void         drawShadowInternal(const CBox& box, int round, float roundingPower, int range, CHyprColor color, float a);

    CBox         m_lastWindowBox          = {0};
    CBox         m_lastWindowBoxWithDecos = {0};
};