debug: refactor class member vars (#10130)

This commit is contained in:
davc0n
2025-04-21 20:42:02 +02:00
committed by GitHub
parent a3b96961a2
commit 400dd16072
15 changed files with 218 additions and 218 deletions

View File

@@ -308,7 +308,7 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
initManagers(STAGE_PRIORITY);
if (envEnabled("HYPRLAND_TRACE"))
Debug::trace = true;
Debug::m_trace = true;
// set the buffer size to 1MB to avoid disconnects due to an app hanging for a short while
wl_display_set_default_max_buffer_size(m_sWLDisplay, 1_MB);
@@ -536,7 +536,7 @@ void CCompositor::cleanup() {
removeLockFile();
m_bIsShuttingDown = true;
Debug::shuttingDown = true;
Debug::m_shuttingDown = true;
#ifdef USES_SYSTEMD
if (NSystemd::sdBooted() > 0 && !envEnabled("HYPRLAND_NO_SD_NOTIFY"))

View File

@@ -800,8 +800,8 @@ CConfigManager::CConfigManager() {
"https://wiki.hyprland.org/Configuring/Variables/#debug");
}
Debug::disableLogs = reinterpret_cast<int64_t* const*>(m_config->getConfigValuePtr("debug:disable_logs")->getDataStaticPtr());
Debug::disableTime = reinterpret_cast<int64_t* const*>(m_config->getConfigValuePtr("debug:disable_time")->getDataStaticPtr());
Debug::m_disableLogs = reinterpret_cast<int64_t* const*>(m_config->getConfigValuePtr("debug:disable_logs")->getDataStaticPtr());
Debug::m_disableTime = reinterpret_cast<int64_t* const*>(m_config->getConfigValuePtr("debug:disable_time")->getDataStaticPtr());
if (g_pEventLoopManager && ERR.has_value())
g_pEventLoopManager->doLater([ERR] { g_pHyprError->queueCreate(ERR.value(), CHyprColor{1.0, 0.1, 0.1, 1.0}); });
@@ -1076,11 +1076,11 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
g_pHyprRenderer->initiateManualCrash();
}
Debug::disableStdout = !std::any_cast<Hyprlang::INT>(m_config->getConfigValue("debug:enable_stdout_logs"));
if (Debug::disableStdout && m_isFirstLaunch)
Debug::m_disableStdout = !std::any_cast<Hyprlang::INT>(m_config->getConfigValue("debug:enable_stdout_logs"));
if (Debug::m_disableStdout && m_isFirstLaunch)
Debug::log(LOG, "Disabling stdout logs! Check the log for further logs.");
Debug::coloredLogs = reinterpret_cast<int64_t* const*>(m_config->getConfigValuePtr("debug:colored_stdout_logs")->getDataStaticPtr());
Debug::m_coloredLogs = reinterpret_cast<int64_t* const*>(m_config->getConfigValuePtr("debug:colored_stdout_logs")->getDataStaticPtr());
for (auto const& m : g_pCompositor->m_vMonitors) {
// mark blur dirty

View File

@@ -242,5 +242,5 @@ void NCrashReporter::createAndSaveCrash(int sig) {
finalCrashReport += "\n\nLog tail:\n";
finalCrashReport += std::string_view(Debug::rollingLog).substr(Debug::rollingLog.find('\n') + 1);
finalCrashReport += std::string_view(Debug::m_rollingLog).substr(Debug::m_rollingLog.find('\n') + 1);
}

View File

@@ -288,7 +288,7 @@ static std::string clientsRequest(eHyprCtlOutputFormat format, std::string reque
result += "[";
for (auto const& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
if (!w->m_bIsMapped && !g_pHyprCtl->m_currentRequestParams.all)
continue;
result += CHyprCtl::getWindowData(w, format);
@@ -299,7 +299,7 @@ static std::string clientsRequest(eHyprCtlOutputFormat format, std::string reque
result += "]";
} else {
for (auto const& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
if (!w->m_bIsMapped && !g_pHyprCtl->m_currentRequestParams.all)
continue;
result += CHyprCtl::getWindowData(w, format);
@@ -801,10 +801,10 @@ static std::string rollinglogRequest(eHyprCtlOutputFormat format, std::string re
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
result += "[\n\"log\":\"";
result += escapeJSONStrings(Debug::rollingLog);
result += escapeJSONStrings(Debug::m_rollingLog);
result += "\"]";
} else {
result = Debug::rollingLog;
result = Debug::m_rollingLog;
}
return result;
@@ -1030,7 +1030,7 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
} else
result += "\tunknown: not runtime\n";
if (g_pHyprCtl && g_pHyprCtl->m_sCurrentRequestParams.sysInfoConfig) {
if (g_pHyprCtl && g_pHyprCtl->m_currentRequestParams.sysInfoConfig) {
result += "\n======Config-Start======\n";
result += g_pConfigManager->getConfigString();
result += "\n======Config-End========\n";
@@ -1702,17 +1702,17 @@ CHyprCtl::~CHyprCtl() {
}
SP<SHyprCtlCommand> CHyprCtl::registerCommand(SHyprCtlCommand cmd) {
return m_vCommands.emplace_back(makeShared<SHyprCtlCommand>(cmd));
return m_commands.emplace_back(makeShared<SHyprCtlCommand>(cmd));
}
void CHyprCtl::unregisterCommand(const SP<SHyprCtlCommand>& cmd) {
std::erase(m_vCommands, cmd);
std::erase(m_commands, cmd);
}
std::string CHyprCtl::getReply(std::string request) {
auto format = eHyprCtlOutputFormat::FORMAT_NORMAL;
bool reloadAll = false;
m_sCurrentRequestParams = {};
m_currentRequestParams = {};
// process flags for non-batch requests
if (!request.starts_with("[[BATCH]]") && request.contains("/")) {
@@ -1736,9 +1736,9 @@ std::string CHyprCtl::getReply(std::string request) {
else if (c == 'r')
reloadAll = true;
else if (c == 'a')
m_sCurrentRequestParams.all = true;
m_currentRequestParams.all = true;
else if (c == 'c')
m_sCurrentRequestParams.sysInfoConfig = true;
m_currentRequestParams.sysInfoConfig = true;
}
if (sepIndex < request.size())
@@ -1748,7 +1748,7 @@ std::string CHyprCtl::getReply(std::string request) {
std::string result = "";
// parse exact cmds first, then non-exact.
for (auto const& cmd : m_vCommands) {
for (auto const& cmd : m_commands) {
if (!cmd->exact)
continue;
@@ -1759,7 +1759,7 @@ std::string CHyprCtl::getReply(std::string request) {
}
if (result.empty())
for (auto const& cmd : m_vCommands) {
for (auto const& cmd : m_commands) {
if (cmd->exact)
continue;
@@ -1855,13 +1855,13 @@ static int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
if (mask & WL_EVENT_ERROR || mask & WL_EVENT_HANGUP)
return 0;
if (!g_pHyprCtl->m_iSocketFD.isValid())
if (!g_pHyprCtl->m_socketFD.isValid())
return 0;
sockaddr_in clientAddress;
socklen_t clientSize = sizeof(clientAddress);
const auto ACCEPTEDCONNECTION = accept4(g_pHyprCtl->m_iSocketFD.get(), (sockaddr*)&clientAddress, &clientSize, SOCK_CLOEXEC);
const auto ACCEPTEDCONNECTION = accept4(g_pHyprCtl->m_socketFD.get(), (sockaddr*)&clientAddress, &clientSize, SOCK_CLOEXEC);
std::array<char, 1024> readBuffer;
@@ -1918,9 +1918,9 @@ static int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
}
void CHyprCtl::startHyprCtlSocket() {
m_iSocketFD = CFileDescriptor{socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)};
m_socketFD = CFileDescriptor{socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)};
if (!m_iSocketFD.isValid()) {
if (!m_socketFD.isValid()) {
Debug::log(ERR, "Couldn't start the Hyprland Socket. (1) IPC will not work.");
return;
}
@@ -1931,15 +1931,15 @@ void CHyprCtl::startHyprCtlSocket() {
strcpy(SERVERADDRESS.sun_path, m_socketPath.c_str());
if (bind(m_iSocketFD.get(), (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS)) < 0) {
if (bind(m_socketFD.get(), (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS)) < 0) {
Debug::log(ERR, "Couldn't start the Hyprland Socket. (2) IPC will not work.");
return;
}
// 10 max queued.
listen(m_iSocketFD.get(), 10);
listen(m_socketFD.get(), 10);
Debug::log(LOG, "Hypr socket started at {}", m_socketPath);
m_eventSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, m_iSocketFD.get(), WL_EVENT_READABLE, hyprCtlFDTick, nullptr);
m_eventSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, m_socketFD.get(), WL_EVENT_READABLE, hyprCtlFDTick, nullptr);
}

View File

@@ -20,12 +20,12 @@ class CHyprCtl {
void unregisterCommand(const SP<SHyprCtlCommand>& cmd);
std::string getReply(std::string);
Hyprutils::OS::CFileDescriptor m_iSocketFD;
Hyprutils::OS::CFileDescriptor m_socketFD;
struct {
bool all = false;
bool sysInfoConfig = false;
} m_sCurrentRequestParams;
} m_currentRequestParams;
static std::string getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format);
static std::string getWorkspaceData(PHLWORKSPACE w, eHyprCtlOutputFormat format);
@@ -34,7 +34,7 @@ class CHyprCtl {
private:
void startHyprCtlSocket();
std::vector<SP<SHyprCtlCommand>> m_vCommands;
std::vector<SP<SHyprCtlCommand>> m_commands;
wl_event_source* m_eventSource = nullptr;
std::string m_socketPath;
};

View File

@@ -7,7 +7,7 @@
#include "../managers/AnimationManager.hpp"
CHyprDebugOverlay::CHyprDebugOverlay() {
m_pTexture = makeShared<CTexture>();
m_texture = makeShared<CTexture>();
}
void CHyprMonitorDebugOverlay::renderData(PHLMONITOR pMonitor, float durationUs) {
@@ -16,13 +16,13 @@ void CHyprMonitorDebugOverlay::renderData(PHLMONITOR pMonitor, float durationUs)
if (!*PDEBUGOVERLAY)
return;
m_dLastRenderTimes.emplace_back(durationUs / 1000.f);
m_lastRenderTimes.emplace_back(durationUs / 1000.f);
if (m_dLastRenderTimes.size() > (long unsigned int)pMonitor->refreshRate)
m_dLastRenderTimes.pop_front();
if (m_lastRenderTimes.size() > (long unsigned int)pMonitor->refreshRate)
m_lastRenderTimes.pop_front();
if (!m_pMonitor)
m_pMonitor = pMonitor;
if (!m_monitor)
m_monitor = pMonitor;
}
void CHyprMonitorDebugOverlay::renderDataNoOverlay(PHLMONITOR pMonitor, float durationUs) {
@@ -31,13 +31,13 @@ void CHyprMonitorDebugOverlay::renderDataNoOverlay(PHLMONITOR pMonitor, float du
if (!*PDEBUGOVERLAY)
return;
m_dLastRenderTimesNoOverlay.emplace_back(durationUs / 1000.f);
m_lastRenderTimesNoOverlay.emplace_back(durationUs / 1000.f);
if (m_dLastRenderTimesNoOverlay.size() > (long unsigned int)pMonitor->refreshRate)
m_dLastRenderTimesNoOverlay.pop_front();
if (m_lastRenderTimesNoOverlay.size() > (long unsigned int)pMonitor->refreshRate)
m_lastRenderTimesNoOverlay.pop_front();
if (!m_pMonitor)
m_pMonitor = pMonitor;
if (!m_monitor)
m_monitor = pMonitor;
}
void CHyprMonitorDebugOverlay::frameData(PHLMONITOR pMonitor) {
@@ -46,36 +46,36 @@ void CHyprMonitorDebugOverlay::frameData(PHLMONITOR pMonitor) {
if (!*PDEBUGOVERLAY)
return;
m_dLastFrametimes.emplace_back(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - m_tpLastFrame).count() / 1000.f);
m_lastFrametimes.emplace_back(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - m_lastFrame).count() / 1000.f);
if (m_dLastFrametimes.size() > (long unsigned int)pMonitor->refreshRate)
m_dLastFrametimes.pop_front();
if (m_lastFrametimes.size() > (long unsigned int)pMonitor->refreshRate)
m_lastFrametimes.pop_front();
m_tpLastFrame = std::chrono::high_resolution_clock::now();
m_lastFrame = std::chrono::high_resolution_clock::now();
if (!m_pMonitor)
m_pMonitor = pMonitor;
if (!m_monitor)
m_monitor = pMonitor;
// anim data too
const auto PMONITORFORTICKS = g_pHyprRenderer->m_pMostHzMonitor ? g_pHyprRenderer->m_pMostHzMonitor.lock() : g_pCompositor->m_pLastMonitor.lock();
if (PMONITORFORTICKS) {
if (m_dLastAnimationTicks.size() > (long unsigned int)PMONITORFORTICKS->refreshRate)
m_dLastAnimationTicks.pop_front();
if (m_lastAnimationTicks.size() > (long unsigned int)PMONITORFORTICKS->refreshRate)
m_lastAnimationTicks.pop_front();
m_dLastAnimationTicks.push_back(g_pAnimationManager->m_fLastTickTime);
m_lastAnimationTicks.push_back(g_pAnimationManager->m_fLastTickTime);
}
}
int CHyprMonitorDebugOverlay::draw(int offset) {
if (!m_pMonitor)
if (!m_monitor)
return 0;
// get avg fps
float avgFrametime = 0;
float maxFrametime = 0;
float minFrametime = 9999;
for (auto const& ft : m_dLastFrametimes) {
for (auto const& ft : m_lastFrametimes) {
if (ft > maxFrametime)
maxFrametime = ft;
if (ft < minFrametime)
@@ -83,12 +83,12 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
avgFrametime += ft;
}
float varFrametime = maxFrametime - minFrametime;
avgFrametime /= m_dLastFrametimes.size() == 0 ? 1 : m_dLastFrametimes.size();
avgFrametime /= m_lastFrametimes.size() == 0 ? 1 : m_lastFrametimes.size();
float avgRenderTime = 0;
float maxRenderTime = 0;
float minRenderTime = 9999;
for (auto const& rt : m_dLastRenderTimes) {
for (auto const& rt : m_lastRenderTimes) {
if (rt > maxRenderTime)
maxRenderTime = rt;
if (rt < minRenderTime)
@@ -96,12 +96,12 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
avgRenderTime += rt;
}
float varRenderTime = maxRenderTime - minRenderTime;
avgRenderTime /= m_dLastRenderTimes.size() == 0 ? 1 : m_dLastRenderTimes.size();
avgRenderTime /= m_lastRenderTimes.size() == 0 ? 1 : m_lastRenderTimes.size();
float avgRenderTimeNoOverlay = 0;
float maxRenderTimeNoOverlay = 0;
float minRenderTimeNoOverlay = 9999;
for (auto const& rt : m_dLastRenderTimesNoOverlay) {
for (auto const& rt : m_lastRenderTimesNoOverlay) {
if (rt > maxRenderTimeNoOverlay)
maxRenderTimeNoOverlay = rt;
if (rt < minRenderTimeNoOverlay)
@@ -109,12 +109,12 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
avgRenderTimeNoOverlay += rt;
}
float varRenderTimeNoOverlay = maxRenderTimeNoOverlay - minRenderTimeNoOverlay;
avgRenderTimeNoOverlay /= m_dLastRenderTimes.size() == 0 ? 1 : m_dLastRenderTimes.size();
avgRenderTimeNoOverlay /= m_lastRenderTimes.size() == 0 ? 1 : m_lastRenderTimes.size();
float avgAnimMgrTick = 0;
float maxAnimMgrTick = 0;
float minAnimMgrTick = 9999;
for (auto const& at : m_dLastAnimationTicks) {
for (auto const& at : m_lastAnimationTicks) {
if (at > maxAnimMgrTick)
maxAnimMgrTick = at;
if (at < minAnimMgrTick)
@@ -122,13 +122,13 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
avgAnimMgrTick += at;
}
float varAnimMgrTick = maxAnimMgrTick - minAnimMgrTick;
avgAnimMgrTick /= m_dLastAnimationTicks.size() == 0 ? 1 : m_dLastAnimationTicks.size();
avgAnimMgrTick /= m_lastAnimationTicks.size() == 0 ? 1 : m_lastAnimationTicks.size();
const float FPS = 1.f / (avgFrametime / 1000.f); // frametimes are in ms
const float idealFPS = m_dLastFrametimes.size();
const float idealFPS = m_lastFrametimes.size();
static auto fontFamily = CConfigValue<std::string>("misc:font_family");
PangoLayout* layoutText = pango_cairo_create_layout(g_pDebugOverlay->m_pCairo);
PangoLayout* layoutText = pango_cairo_create_layout(g_pDebugOverlay->m_cairo);
PangoFontDescription* pangoFD = pango_font_description_new();
pango_font_description_set_family(pangoFD, (*fontFamily).c_str());
@@ -137,7 +137,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
float maxTextW = 0;
int fontSize = 0;
auto cr = g_pDebugOverlay->m_pCairo;
auto cr = g_pDebugOverlay->m_cairo;
auto showText = [cr, layoutText, pangoFD, &maxTextW, &fontSize](const char* text, int size) {
if (fontSize != size) {
@@ -163,22 +163,22 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
const int MARGIN_TOP = 8;
const int MARGIN_LEFT = 4;
cairo_move_to(cr, MARGIN_LEFT, MARGIN_TOP + offset);
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 1.f, 1.f, 1.f);
cairo_set_source_rgba(g_pDebugOverlay->m_cairo, 1.f, 1.f, 1.f, 1.f);
std::string text;
showText(m_pMonitor->szName.c_str(), 10);
showText(m_monitor->szName.c_str(), 10);
if (FPS > idealFPS * 0.95f)
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 0.2f, 1.f, 0.2f, 1.f);
cairo_set_source_rgba(g_pDebugOverlay->m_cairo, 0.2f, 1.f, 0.2f, 1.f);
else if (FPS > idealFPS * 0.8f)
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 1.f, 0.2f, 1.f);
cairo_set_source_rgba(g_pDebugOverlay->m_cairo, 1.f, 1.f, 0.2f, 1.f);
else
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 0.2f, 0.2f, 1.f);
cairo_set_source_rgba(g_pDebugOverlay->m_cairo, 1.f, 0.2f, 0.2f, 1.f);
text = std::format("{} FPS", (int)FPS);
showText(text.c_str(), 16);
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 1.f, 1.f, 1.f);
cairo_set_source_rgba(g_pDebugOverlay->m_cairo, 1.f, 1.f, 1.f, 1.f);
text = std::format("Avg Frametime: {:.2f}ms (var {:.2f}ms)", avgFrametime, varFrametime);
showText(text.c_str(), 10);
@@ -198,10 +198,10 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
double posX = 0, posY = 0;
cairo_get_current_point(cr, &posX, &posY);
g_pHyprRenderer->damageBox(m_wbLastDrawnBox);
m_wbLastDrawnBox = {(int)g_pCompositor->m_vMonitors.front()->vecPosition.x + MARGIN_LEFT - 1, (int)g_pCompositor->m_vMonitors.front()->vecPosition.y + offset + MARGIN_TOP - 1,
g_pHyprRenderer->damageBox(m_lastDrawnBox);
m_lastDrawnBox = {(int)g_pCompositor->m_vMonitors.front()->vecPosition.x + MARGIN_LEFT - 1, (int)g_pCompositor->m_vMonitors.front()->vecPosition.y + offset + MARGIN_TOP - 1,
(int)maxTextW + 2, posY - offset - MARGIN_TOP + 2};
g_pHyprRenderer->damageBox(m_wbLastDrawnBox);
g_pHyprRenderer->damageBox(m_lastDrawnBox);
return posY - offset;
}
@@ -212,7 +212,7 @@ void CHyprDebugOverlay::renderData(PHLMONITOR pMonitor, float durationUs) {
if (!*PDEBUGOVERLAY)
return;
m_mMonitorOverlays[pMonitor].renderData(pMonitor, durationUs);
m_monitorOverlays[pMonitor].renderData(pMonitor, durationUs);
}
void CHyprDebugOverlay::renderDataNoOverlay(PHLMONITOR pMonitor, float durationUs) {
@@ -221,7 +221,7 @@ void CHyprDebugOverlay::renderDataNoOverlay(PHLMONITOR pMonitor, float durationU
if (!*PDEBUGOVERLAY)
return;
m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, durationUs);
m_monitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, durationUs);
}
void CHyprDebugOverlay::frameData(PHLMONITOR pMonitor) {
@@ -230,37 +230,37 @@ void CHyprDebugOverlay::frameData(PHLMONITOR pMonitor) {
if (!*PDEBUGOVERLAY)
return;
m_mMonitorOverlays[pMonitor].frameData(pMonitor);
m_monitorOverlays[pMonitor].frameData(pMonitor);
}
void CHyprDebugOverlay::draw() {
const auto PMONITOR = g_pCompositor->m_vMonitors.front();
if (!m_pCairoSurface || !m_pCairo) {
m_pCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
m_pCairo = cairo_create(m_pCairoSurface);
if (!m_cairoSurface || !m_cairo) {
m_cairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
m_cairo = cairo_create(m_cairoSurface);
}
// clear the pixmap
cairo_save(m_pCairo);
cairo_set_operator(m_pCairo, CAIRO_OPERATOR_CLEAR);
cairo_paint(m_pCairo);
cairo_restore(m_pCairo);
cairo_save(m_cairo);
cairo_set_operator(m_cairo, CAIRO_OPERATOR_CLEAR);
cairo_paint(m_cairo);
cairo_restore(m_cairo);
// draw the things
int offsetY = 0;
for (auto const& m : g_pCompositor->m_vMonitors) {
offsetY += m_mMonitorOverlays[m].draw(offsetY);
offsetY += m_monitorOverlays[m].draw(offsetY);
offsetY += 5; // for padding between mons
}
cairo_surface_flush(m_pCairoSurface);
cairo_surface_flush(m_cairoSurface);
// copy the data to an OpenGL texture we have
const auto DATA = cairo_image_surface_get_data(m_pCairoSurface);
m_pTexture->allocate();
glBindTexture(GL_TEXTURE_2D, m_pTexture->m_iTexID);
const auto DATA = cairo_image_surface_get_data(m_cairoSurface);
m_texture->allocate();
glBindTexture(GL_TEXTURE_2D, m_texture->m_iTexID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -272,7 +272,7 @@ void CHyprDebugOverlay::draw() {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
CTexPassElement::SRenderData data;
data.tex = m_pTexture;
data.tex = m_texture;
data.box = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
g_pHyprRenderer->m_sRenderPass.add(makeShared<CTexPassElement>(data));
}

View File

@@ -17,13 +17,13 @@ class CHyprMonitorDebugOverlay {
void frameData(PHLMONITOR 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;
PHLMONITORREF m_pMonitor;
CBox m_wbLastDrawnBox;
std::deque<float> m_lastFrametimes;
std::deque<float> m_lastRenderTimes;
std::deque<float> m_lastRenderTimesNoOverlay;
std::deque<float> m_lastAnimationTicks;
std::chrono::high_resolution_clock::time_point m_lastFrame;
PHLMONITORREF m_monitor;
CBox m_lastDrawnBox;
friend class CHyprRenderer;
};
@@ -37,12 +37,12 @@ class CHyprDebugOverlay {
void frameData(PHLMONITOR);
private:
std::map<PHLMONITORREF, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
std::map<PHLMONITORREF, CHyprMonitorDebugOverlay> m_monitorOverlays;
cairo_surface_t* m_pCairoSurface = nullptr;
cairo_t* m_pCairo = nullptr;
cairo_surface_t* m_cairoSurface = nullptr;
cairo_t* m_cairo = nullptr;
SP<CTexture> m_pTexture;
SP<CTexture> m_texture;
friend class CHyprMonitorDebugOverlay;
friend class CHyprRenderer;

View File

@@ -23,24 +23,24 @@ static inline auto iconBackendFromLayout(PangoLayout* layout) {
CHyprNotificationOverlay::CHyprNotificationOverlay() {
static auto P = g_pHookSystem->hookDynamic("focusedMon", [&](void* self, SCallbackInfo& info, std::any param) {
if (m_vNotifications.size() == 0)
if (m_notifications.size() == 0)
return;
g_pHyprRenderer->damageBox(m_bLastDamage);
g_pHyprRenderer->damageBox(m_lastDamage);
});
m_pTexture = makeShared<CTexture>();
m_texture = makeShared<CTexture>();
}
CHyprNotificationOverlay::~CHyprNotificationOverlay() {
if (m_pCairo)
cairo_destroy(m_pCairo);
if (m_pCairoSurface)
cairo_surface_destroy(m_pCairoSurface);
if (m_cairo)
cairo_destroy(m_cairo);
if (m_cairoSurface)
cairo_surface_destroy(m_cairoSurface);
}
void CHyprNotificationOverlay::addNotification(const std::string& text, const CHyprColor& color, const float timeMs, const eIcons icon, const float fontSize) {
const auto PNOTIF = m_vNotifications.emplace_back(makeUnique<SNotification>()).get();
const auto PNOTIF = m_notifications.emplace_back(makeUnique<SNotification>()).get();
PNOTIF->text = icon != eIcons::ICON_NONE ? " " + text /* tiny bit of padding otherwise icon touches text */ : text;
PNOTIF->color = color == CHyprColor(0) ? ICONS_COLORS[icon] : color;
@@ -56,12 +56,12 @@ void CHyprNotificationOverlay::addNotification(const std::string& text, const CH
void CHyprNotificationOverlay::dismissNotifications(const int amount) {
if (amount == -1)
m_vNotifications.clear();
m_notifications.clear();
else {
const int AMT = std::min(amount, static_cast<int>(m_vNotifications.size()));
const int AMT = std::min(amount, static_cast<int>(m_notifications.size()));
for (int i = 0; i < AMT; ++i) {
m_vNotifications.erase(m_vNotifications.begin());
m_notifications.erase(m_notifications.begin());
}
}
}
@@ -82,7 +82,7 @@ CBox CHyprNotificationOverlay::drawNotifications(PHLMONITOR pMonitor) {
static auto fontFamily = CConfigValue<std::string>("misc:font_family");
PangoLayout* layout = pango_cairo_create_layout(m_pCairo);
PangoLayout* layout = pango_cairo_create_layout(m_cairo);
PangoFontDescription* pangoFD = pango_font_description_new();
pango_font_description_set_family(pangoFD, (*fontFamily).c_str());
@@ -92,7 +92,7 @@ CBox CHyprNotificationOverlay::drawNotifications(PHLMONITOR pMonitor) {
const auto iconBackendID = iconBackendFromLayout(layout);
const auto PBEZIER = g_pAnimationManager->getBezier("default");
for (auto const& notif : m_vNotifications) {
for (auto const& notif : m_notifications) {
const auto ICONPADFORNOTIF = notif->icon == ICON_NONE ? 0 : ICON_PAD;
const auto FONTSIZE = std::clamp((int)(notif->fontSize * ((pMonitor->vecPixelSize.x * SCALE) / 1920.f)), 8, 40);
@@ -139,17 +139,17 @@ CBox CHyprNotificationOverlay::drawNotifications(PHLMONITOR pMonitor) {
const auto NOTIFSIZE = Vector2D{textW + 20.0 + iconW + 2 * ICONPADFORNOTIF, textH + 10.0};
// draw rects
cairo_set_source_rgba(m_pCairo, notif->color.r, notif->color.g, notif->color.b, notif->color.a);
cairo_rectangle(m_pCairo, MONSIZE.x - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, offsetY, (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, NOTIFSIZE.y);
cairo_fill(m_pCairo);
cairo_set_source_rgba(m_cairo, notif->color.r, notif->color.g, notif->color.b, notif->color.a);
cairo_rectangle(m_cairo, MONSIZE.x - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, offsetY, (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, NOTIFSIZE.y);
cairo_fill(m_cairo);
cairo_set_source_rgb(m_pCairo, 0.f, 0.f, 0.f);
cairo_rectangle(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC, offsetY, NOTIFSIZE.x * SECONDRECTPERC, NOTIFSIZE.y);
cairo_fill(m_pCairo);
cairo_set_source_rgb(m_cairo, 0.f, 0.f, 0.f);
cairo_rectangle(m_cairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC, offsetY, NOTIFSIZE.x * SECONDRECTPERC, NOTIFSIZE.y);
cairo_fill(m_cairo);
cairo_set_source_rgba(m_pCairo, notif->color.r, notif->color.g, notif->color.b, notif->color.a);
cairo_rectangle(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + 3, offsetY + NOTIFSIZE.y - 4, THIRDRECTPERC * (NOTIFSIZE.x - 6), 2);
cairo_fill(m_pCairo);
cairo_set_source_rgba(m_cairo, notif->color.r, notif->color.g, notif->color.b, notif->color.a);
cairo_rectangle(m_cairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + 3, offsetY + NOTIFSIZE.y - 4, THIRDRECTPERC * (NOTIFSIZE.x - 6), 2);
cairo_fill(m_cairo);
// draw gradient
if (notif->icon != ICON_NONE) {
@@ -158,23 +158,23 @@ CBox CHyprNotificationOverlay::drawNotifications(PHLMONITOR pMonitor) {
MONSIZE.x - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC + GRADIENT_SIZE, offsetY);
cairo_pattern_add_color_stop_rgba(pattern, 0, ICONCOLOR.r, ICONCOLOR.g, ICONCOLOR.b, ICONCOLOR.a / 3.0);
cairo_pattern_add_color_stop_rgba(pattern, 1, ICONCOLOR.r, ICONCOLOR.g, ICONCOLOR.b, 0);
cairo_rectangle(m_pCairo, MONSIZE.x - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, offsetY, GRADIENT_SIZE, NOTIFSIZE.y);
cairo_set_source(m_pCairo, pattern);
cairo_fill(m_pCairo);
cairo_rectangle(m_cairo, MONSIZE.x - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, offsetY, GRADIENT_SIZE, NOTIFSIZE.y);
cairo_set_source(m_cairo, pattern);
cairo_fill(m_cairo);
cairo_pattern_destroy(pattern);
// draw icon
cairo_set_source_rgb(m_pCairo, 1.f, 1.f, 1.f);
cairo_move_to(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + NOTIF_LEFTBAR_SIZE + ICONPADFORNOTIF - 1, offsetY - 2 + std::round((NOTIFSIZE.y - iconH) / 2.0));
cairo_set_source_rgb(m_cairo, 1.f, 1.f, 1.f);
cairo_move_to(m_cairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + NOTIF_LEFTBAR_SIZE + ICONPADFORNOTIF - 1, offsetY - 2 + std::round((NOTIFSIZE.y - iconH) / 2.0));
pango_layout_set_text(layout, ICON.c_str(), -1);
pango_cairo_show_layout(m_pCairo, layout);
pango_cairo_show_layout(m_cairo, layout);
}
// draw text
cairo_set_source_rgb(m_pCairo, 1.f, 1.f, 1.f);
cairo_move_to(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + NOTIF_LEFTBAR_SIZE + iconW + 2 * ICONPADFORNOTIF, offsetY - 2 + std::round((NOTIFSIZE.y - textH) / 2.0));
cairo_set_source_rgb(m_cairo, 1.f, 1.f, 1.f);
cairo_move_to(m_cairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + NOTIF_LEFTBAR_SIZE + iconW + 2 * ICONPADFORNOTIF, offsetY - 2 + std::round((NOTIFSIZE.y - textH) / 2.0));
pango_layout_set_text(layout, notif->text.c_str(), -1);
pango_cairo_show_layout(m_pCairo, layout);
pango_cairo_show_layout(m_cairo, layout);
// adjust offset and move on
offsetY += NOTIFSIZE.y + 10;
@@ -187,7 +187,7 @@ CBox CHyprNotificationOverlay::drawNotifications(PHLMONITOR pMonitor) {
g_object_unref(layout);
// cleanup notifs
std::erase_if(m_vNotifications, [](const auto& notif) { return notif->started.getMillis() > notif->timeMs; });
std::erase_if(m_notifications, [](const auto& notif) { return notif->started.getMillis() > notif->timeMs; });
return CBox{(int)(pMonitor->vecPosition.x + pMonitor->vecSize.x - maxWidth - 20), (int)pMonitor->vecPosition.y, (int)maxWidth + 20, (int)offsetY + 10};
}
@@ -196,46 +196,46 @@ void CHyprNotificationOverlay::draw(PHLMONITOR pMonitor) {
const auto MONSIZE = pMonitor->vecTransformedSize;
if (m_pLastMonitor != pMonitor || m_vecLastSize != MONSIZE || !m_pCairo || !m_pCairoSurface) {
if (m_lastMonitor != pMonitor || m_lastSize != MONSIZE || !m_cairo || !m_cairoSurface) {
if (m_pCairo && m_pCairoSurface) {
cairo_destroy(m_pCairo);
cairo_surface_destroy(m_pCairoSurface);
if (m_cairo && m_cairoSurface) {
cairo_destroy(m_cairo);
cairo_surface_destroy(m_cairoSurface);
}
m_pCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, MONSIZE.x, MONSIZE.y);
m_pCairo = cairo_create(m_pCairoSurface);
m_pLastMonitor = pMonitor;
m_vecLastSize = MONSIZE;
m_cairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, MONSIZE.x, MONSIZE.y);
m_cairo = cairo_create(m_cairoSurface);
m_lastMonitor = pMonitor;
m_lastSize = MONSIZE;
}
// Draw the notifications
if (m_vNotifications.size() == 0)
if (m_notifications.size() == 0)
return;
// Render to the monitor
// clear the pixmap
cairo_save(m_pCairo);
cairo_set_operator(m_pCairo, CAIRO_OPERATOR_CLEAR);
cairo_paint(m_pCairo);
cairo_restore(m_pCairo);
cairo_save(m_cairo);
cairo_set_operator(m_cairo, CAIRO_OPERATOR_CLEAR);
cairo_paint(m_cairo);
cairo_restore(m_cairo);
cairo_surface_flush(m_pCairoSurface);
cairo_surface_flush(m_cairoSurface);
CBox damage = drawNotifications(pMonitor);
g_pHyprRenderer->damageBox(damage);
g_pHyprRenderer->damageBox(m_bLastDamage);
g_pHyprRenderer->damageBox(m_lastDamage);
g_pCompositor->scheduleFrameForMonitor(pMonitor);
m_bLastDamage = damage;
m_lastDamage = damage;
// copy the data to an OpenGL texture we have
const auto DATA = cairo_image_surface_get_data(m_pCairoSurface);
m_pTexture->allocate();
glBindTexture(GL_TEXTURE_2D, m_pTexture->m_iTexID);
const auto DATA = cairo_image_surface_get_data(m_cairoSurface);
m_texture->allocate();
glBindTexture(GL_TEXTURE_2D, m_texture->m_iTexID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -247,7 +247,7 @@ void CHyprNotificationOverlay::draw(PHLMONITOR pMonitor) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, MONSIZE.x, MONSIZE.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
CTexPassElement::SRenderData data;
data.tex = m_pTexture;
data.tex = m_texture;
data.box = {0, 0, MONSIZE.x, MONSIZE.y};
data.a = 1.F;
@@ -255,5 +255,5 @@ void CHyprNotificationOverlay::draw(PHLMONITOR pMonitor) {
}
bool CHyprNotificationOverlay::hasAny() {
return !m_vNotifications.empty();
return !m_notifications.empty();
}

View File

@@ -47,17 +47,17 @@ class CHyprNotificationOverlay {
private:
CBox drawNotifications(PHLMONITOR pMonitor);
CBox m_bLastDamage;
CBox m_lastDamage;
std::vector<UP<SNotification>> m_vNotifications;
std::vector<UP<SNotification>> m_notifications;
cairo_surface_t* m_pCairoSurface = nullptr;
cairo_t* m_pCairo = nullptr;
cairo_surface_t* m_cairoSurface = nullptr;
cairo_t* m_cairo = nullptr;
PHLMONITORREF m_pLastMonitor;
Vector2D m_vecLastSize = Vector2D(-1, -1);
PHLMONITORREF m_lastMonitor;
Vector2D m_lastSize = Vector2D(-1, -1);
SP<CTexture> m_pTexture;
SP<CTexture> m_texture;
};
inline UP<CHyprNotificationOverlay> g_pHyprNotificationOverlay;

View File

@@ -7,21 +7,21 @@
#include <fcntl.h>
void Debug::init(const std::string& IS) {
logFile = IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log");
logOfs.open(logFile, std::ios::out | std::ios::app);
auto handle = logOfs.native_handle();
m_logFile = IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log");
m_logOfs.open(m_logFile, std::ios::out | std::ios::app);
auto handle = m_logOfs.native_handle();
fcntl(handle, F_SETFD, FD_CLOEXEC);
}
void Debug::close() {
logOfs.close();
m_logOfs.close();
}
void Debug::log(eLogLevel level, std::string str) {
if (level == TRACE && !trace)
if (level == TRACE && !m_trace)
return;
if (shuttingDown)
if (m_shuttingDown)
return;
std::string coloredStr = str;
@@ -55,20 +55,20 @@ void Debug::log(eLogLevel level, std::string str) {
}
//NOLINTEND
rollingLog += str + "\n";
if (rollingLog.size() > ROLLING_LOG_SIZE)
rollingLog = rollingLog.substr(rollingLog.size() - ROLLING_LOG_SIZE);
m_rollingLog += str + "\n";
if (m_rollingLog.size() > ROLLING_LOG_SIZE)
m_rollingLog = m_rollingLog.substr(m_rollingLog.size() - ROLLING_LOG_SIZE);
if (SRollingLogFollow::get().isRunning())
SRollingLogFollow::get().addLog(str);
if (!disableLogs || !**disableLogs) {
if (!m_disableLogs || !**m_disableLogs) {
// log to a file
logOfs << str << "\n";
logOfs.flush();
m_logOfs << str << "\n";
m_logOfs.flush();
}
// log it to the stdout too.
if (!disableStdout)
std::println("{}", ((coloredLogs && !**coloredLogs) ? str : coloredStr));
if (!m_disableStdout)
std::println("{}", ((m_coloredLogs && !**m_coloredLogs) ? str : coloredStr));
}

View File

@@ -21,17 +21,17 @@ enum eLogLevel : int8_t {
// NOLINTNEXTLINE(readability-identifier-naming)
namespace Debug {
inline std::string logFile;
inline std::ofstream logOfs;
inline int64_t* const* disableLogs = nullptr;
inline int64_t* const* disableTime = nullptr;
inline bool disableStdout = false;
inline bool trace = false;
inline bool shuttingDown = false;
inline int64_t* const* coloredLogs = nullptr;
inline std::string m_logFile;
inline std::ofstream m_logOfs;
inline int64_t* const* m_disableLogs = nullptr;
inline int64_t* const* m_disableTime = nullptr;
inline bool m_disableStdout = false;
inline bool m_trace = false;
inline bool m_shuttingDown = false;
inline int64_t* const* m_coloredLogs = nullptr;
inline std::string rollingLog = ""; // rolling log contains the ROLLING_LOG_SIZE tail of the log
inline std::mutex logMutex;
inline std::string m_rollingLog = ""; // rolling log contains the ROLLING_LOG_SIZE tail of the log
inline std::mutex m_logMutex;
void init(const std::string& IS);
void close();
@@ -42,18 +42,18 @@ namespace Debug {
template <typename... Args>
//NOLINTNEXTLINE
void log(eLogLevel level, std::format_string<Args...> fmt, Args&&... args) {
std::lock_guard<std::mutex> guard(logMutex);
std::lock_guard<std::mutex> guard(m_logMutex);
if (level == TRACE && !trace)
if (level == TRACE && !m_trace)
return;
if (shuttingDown)
if (m_shuttingDown)
return;
std::string logMsg = "";
// print date and time to the ofs
if (disableTime && !**disableTime) {
if (m_disableTime && !**m_disableTime) {
#ifndef _LIBCPP_VERSION
static auto current_zone = std::chrono::current_zone();
const auto zt = std::chrono::zoned_time{current_zone, std::chrono::system_clock::now()};

View File

@@ -5,55 +5,55 @@
// NOLINTNEXTLINE(readability-identifier-naming)
namespace Debug {
struct SRollingLogFollow {
std::unordered_map<int, std::string> socketToRollingLogFollowQueue;
std::shared_mutex m;
bool running = false;
std::unordered_map<int, std::string> m_socketToRollingLogFollowQueue;
std::shared_mutex m_mutex;
bool m_running = false;
static constexpr size_t ROLLING_LOG_FOLLOW_TOO_BIG = 8192;
// Returns true if the queue is empty for the given socket
bool isEmpty(int socket) {
std::shared_lock<std::shared_mutex> r(m);
return socketToRollingLogFollowQueue[socket].empty();
std::shared_lock<std::shared_mutex> r(m_mutex);
return m_socketToRollingLogFollowQueue[socket].empty();
}
std::string debugInfo() {
std::shared_lock<std::shared_mutex> r(m);
return std::format("RollingLogFollow, got {} connections", socketToRollingLogFollowQueue.size());
std::shared_lock<std::shared_mutex> r(m_mutex);
return std::format("RollingLogFollow, got {} connections", m_socketToRollingLogFollowQueue.size());
}
std::string getLog(int socket) {
std::unique_lock<std::shared_mutex> w(m);
std::unique_lock<std::shared_mutex> w(m_mutex);
const std::string ret = socketToRollingLogFollowQueue[socket];
socketToRollingLogFollowQueue[socket] = "";
const std::string ret = m_socketToRollingLogFollowQueue[socket];
m_socketToRollingLogFollowQueue[socket] = "";
return ret;
};
void addLog(const std::string& log) {
std::unique_lock<std::shared_mutex> w(m);
running = true;
std::unique_lock<std::shared_mutex> w(m_mutex);
m_running = true;
std::vector<int> to_erase;
for (const auto& p : socketToRollingLogFollowQueue)
socketToRollingLogFollowQueue[p.first] += log + "\n";
for (const auto& p : m_socketToRollingLogFollowQueue)
m_socketToRollingLogFollowQueue[p.first] += log + "\n";
}
bool isRunning() {
std::shared_lock<std::shared_mutex> r(m);
return running;
std::shared_lock<std::shared_mutex> r(m_mutex);
return m_running;
}
void stopFor(int socket) {
std::unique_lock<std::shared_mutex> w(m);
socketToRollingLogFollowQueue.erase(socket);
if (socketToRollingLogFollowQueue.empty())
running = false;
std::unique_lock<std::shared_mutex> w(m_mutex);
m_socketToRollingLogFollowQueue.erase(socket);
if (m_socketToRollingLogFollowQueue.empty())
m_running = false;
}
void startFor(int socket) {
std::unique_lock<std::shared_mutex> w(m);
socketToRollingLogFollowQueue[socket] = std::format("[LOG] Following log to socket: {} started\n", socket);
running = true;
std::unique_lock<std::shared_mutex> w(m_mutex);
m_socketToRollingLogFollowQueue[socket] = std::format("[LOG] Following log to socket: {} started\n", socket);
m_running = true;
}
static SRollingLogFollow& get() {

View File

@@ -567,7 +567,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
drmFormat = DRM_FORMAT_XRGB8888;
output->state->resetExplicitFences();
if (Debug::trace) {
if (Debug::m_trace) {
Debug::log(TRACE, "Monitor {} requested modes:", szName);
if (requestedModes.empty())
Debug::log(TRACE, "| None");

View File

@@ -2063,19 +2063,19 @@ bool CHyprRenderer::shouldRenderCursor() {
}
std::tuple<float, float, float> CHyprRenderer::getRenderTimes(PHLMONITOR pMonitor) {
const auto POVERLAY = &g_pDebugOverlay->m_mMonitorOverlays[pMonitor];
const auto POVERLAY = &g_pDebugOverlay->m_monitorOverlays[pMonitor];
float avgRenderTime = 0;
float maxRenderTime = 0;
float minRenderTime = 9999;
for (auto const& rt : POVERLAY->m_dLastRenderTimes) {
for (auto const& rt : POVERLAY->m_lastRenderTimes) {
if (rt > maxRenderTime)
maxRenderTime = rt;
if (rt < minRenderTime)
minRenderTime = rt;
avgRenderTime += rt;
}
avgRenderTime /= POVERLAY->m_dLastRenderTimes.size() == 0 ? 1 : POVERLAY->m_dLastRenderTimes.size();
avgRenderTime /= POVERLAY->m_lastRenderTimes.size() == 0 ? 1 : POVERLAY->m_lastRenderTimes.size();
return std::make_tuple<>(avgRenderTime, maxRenderTime, minRenderTime);
}

View File

@@ -194,7 +194,7 @@ std::string CXWM::getAtomName(uint32_t atom) {
void CXWM::readProp(SP<CXWaylandSurface> XSURF, uint32_t atom, xcb_get_property_reply_t* reply) {
std::string propName;
if (Debug::trace)
if (Debug::m_trace)
propName = getAtomName(atom);
if (atom == XCB_ATOM_WM_CLASS) {