* keybindmgr: avoid uint rollover on mouse keycode mouse keycode is 0, and the switch case checks for 0 - 8 and rolls over, just return early if keycode is 0. * watchdog: avoid data races in watchdog asan thread sanitizer reported data races in the watchdog from reading and setting the bool variables make them std::atomic bools. also add a atomic bool for the main thread to wait for to avoid data race when reading the config values. * hyprdebug: change non unicode character to name asan created false positives and didnt like this bit, so for the sake of easier debugging rename it to something unicode.
52 lines
No EOL
1.6 KiB
C++
52 lines
No EOL
1.6 KiB
C++
#pragma once
|
|
|
|
#include "../defines.hpp"
|
|
#include "../helpers/Monitor.hpp"
|
|
#include "../render/Texture.hpp"
|
|
#include <deque>
|
|
#include <cairo/cairo.h>
|
|
#include <unordered_map>
|
|
|
|
class CHyprRenderer;
|
|
|
|
class CHyprMonitorDebugOverlay {
|
|
public:
|
|
int draw(int offset);
|
|
|
|
void renderData(CMonitor* pMonitor, float durationUs);
|
|
void renderDataNoOverlay(CMonitor* pMonitor, float durationUs);
|
|
void frameData(CMonitor* pMonitor);
|
|
|
|
private:
|
|
std::deque<float> m_dLastFrametimes;
|
|
std::deque<float> m_dLastRenderTimes;
|
|
std::deque<float> m_dLastRenderTimesNoOverlay;
|
|
std::deque<float> m_dLastAnimationTicks;
|
|
std::chrono::high_resolution_clock::time_point m_tpLastFrame;
|
|
CMonitor* m_pMonitor = nullptr;
|
|
CBox m_wbLastDrawnBox;
|
|
|
|
friend class CHyprRenderer;
|
|
};
|
|
|
|
class CHyprDebugOverlay {
|
|
public:
|
|
CHyprDebugOverlay();
|
|
void draw();
|
|
void renderData(CMonitor*, float durationUs);
|
|
void renderDataNoOverlay(CMonitor*, float durationUs);
|
|
void frameData(CMonitor*);
|
|
|
|
private:
|
|
std::unordered_map<CMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
|
|
|
|
cairo_surface_t* m_pCairoSurface = nullptr;
|
|
cairo_t* m_pCairo = nullptr;
|
|
|
|
SP<CTexture> m_pTexture;
|
|
|
|
friend class CHyprMonitorDebugOverlay;
|
|
friend class CHyprRenderer;
|
|
};
|
|
|
|
inline std::unique_ptr<CHyprDebugOverlay> g_pDebugOverlay; |