summaryrefslogtreecommitdiff
path: root/src/debug/HyprNotificationOverlay.hpp
blob: 12ad8e385e55b17f2467c5c543c10b93dd791b7b (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
#pragma once

#include "../defines.hpp"
#include "../helpers/Timer.hpp"
#include "../helpers/Monitor.hpp"
#include "../render/Texture.hpp"

#include <deque>

#include <cairo/cairo.h>

struct SNotification {
    std::string text = "";
    CColor      color;
    CTimer      started;
    float       timeMs = 0;
};

class CHyprNotificationOverlay {
  public:
    CHyprNotificationOverlay();

    void draw(CMonitor* pMonitor);
    void addNotification(const std::string& text, const CColor& color, const float timeMs);

  private:
    wlr_box                                    drawNotifications(CMonitor* pMonitor);
    wlr_box                                    m_bLastDamage;

    std::deque<std::unique_ptr<SNotification>> m_dNotifications;

    cairo_surface_t*                           m_pCairoSurface = nullptr;
    cairo_t*                                   m_pCairo        = nullptr;

    CMonitor*                                  m_pLastMonitor = nullptr;

    CTexture                                   m_tTexture;
};

inline std::unique_ptr<CHyprNotificationOverlay> g_pHyprNotificationOverlay;