summaryrefslogtreecommitdiff
path: root/src/render/Renderer.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-03-03 18:39:20 +0000
committerVaxry <vaxry@vaxry.net>2024-03-03 18:41:38 +0000
commit063708df26e8b930f492200e1907eb47950f50e6 (patch)
tree31648b7148213ecb9c6d469148ac1c5061835d5a /src/render/Renderer.cpp
parent8ccbd272cc5f3a98280d4e050f456d25aee47ee5 (diff)
config: improve config value infrastructure
Diffstat (limited to 'src/render/Renderer.cpp')
-rw-r--r--src/render/Renderer.cpp165
1 files changed, 83 insertions, 82 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index e8359601..303491d1 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -3,6 +3,7 @@
#include "linux-dmabuf-unstable-v1-protocol.h"
#include "../helpers/Region.hpp"
#include <algorithm>
+#include "../config/ConfigValue.hpp"
extern "C" {
#include <xf86drm.h>
@@ -48,12 +49,12 @@ CHyprRenderer::CHyprRenderer() {
}
static void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
- static auto* const PBLURPOPUPS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:popups");
- static auto* const PBLURPOPUPSIGNOREALPHA = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:popups_ignorealpha");
+ static auto PBLURPOPUPS = CConfigValue<Hyprlang::INT>("decoration:blur:popups");
+ static auto PBLURPOPUPSIGNOREALPHA = CConfigValue<Hyprlang::FLOAT>("decoration:blur:popups_ignorealpha");
- const auto TEXTURE = wlr_surface_get_texture(surface);
- const auto RDATA = (SRenderData*)data;
- const auto INTERACTIVERESIZEINPROGRESS = RDATA->pWindow && g_pInputManager->currentlyDraggedWindow == RDATA->pWindow && g_pInputManager->dragMode == MBIND_RESIZE;
+ const auto TEXTURE = wlr_surface_get_texture(surface);
+ const auto RDATA = (SRenderData*)data;
+ const auto INTERACTIVERESIZEINPROGRESS = RDATA->pWindow && g_pInputManager->currentlyDraggedWindow == RDATA->pWindow && g_pInputManager->dragMode == MBIND_RESIZE;
if (!TEXTURE)
return;
@@ -148,11 +149,11 @@ static void renderSurface(struct wlr_surface* surface, int x, int y, void* data)
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true);
}
} else {
- if (RDATA->blur && RDATA->popup && **PBLURPOPUPS) {
+ if (RDATA->blur && RDATA->popup && *PBLURPOPUPS) {
- if (**PBLURPOPUPSIGNOREALPHA != 1.f) {
+ if (*PBLURPOPUPSIGNOREALPHA != 1.f) {
g_pHyprOpenGL->m_RenderData.discardMode |= DISCARD_ALPHA;
- g_pHyprOpenGL->m_RenderData.discardOpacity = **PBLURPOPUPSIGNOREALPHA;
+ g_pHyprOpenGL->m_RenderData.discardOpacity = *PBLURPOPUPSIGNOREALPHA;
}
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, rounding, true);
@@ -407,13 +408,13 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
TRACY_GPU_ZONE("RenderWindow");
- const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
- const auto REALPOS = pWindow->m_vRealPosition.value() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.value());
- static auto* const PDIMAROUND = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:dim_around");
- static auto* const PBLUR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
+ const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
+ const auto REALPOS = pWindow->m_vRealPosition.value() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.value());
+ static auto PDIMAROUND = CConfigValue<Hyprlang::FLOAT>("decoration:dim_around");
+ static auto PBLUR = CConfigValue<Hyprlang::INT>("decoration:blur:enabled");
- SRenderData renderdata = {pMonitor, time};
- CBox textureBox = {REALPOS.x, REALPOS.y, std::max(pWindow->m_vRealSize.value().x, 5.0), std::max(pWindow->m_vRealSize.value().y, 5.0)};
+ SRenderData renderdata = {pMonitor, time};
+ CBox textureBox = {REALPOS.x, REALPOS.y, std::max(pWindow->m_vRealSize.value().x, 5.0), std::max(pWindow->m_vRealSize.value().y, 5.0)};
renderdata.x = textureBox.x;
renderdata.y = textureBox.y;
@@ -452,7 +453,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
if (*PDIMAROUND && pWindow->m_sAdditionalConfigData.dimAround && !m_bRenderingSnapshot && mode != RENDER_PASS_POPUP) {
CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.y};
- g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, **PDIMAROUND * renderdata.alpha * renderdata.fadeAlpha));
+ g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMAROUND * renderdata.alpha * renderdata.fadeAlpha));
}
// clip box for animated offsets
@@ -521,11 +522,11 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
}
}
- static auto* const PXWLUSENN = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("xwayland:use_nearest_neighbor");
- if ((pWindow->m_bIsX11 && **PXWLUSENN) || pWindow->m_sAdditionalConfigData.nearestNeighbor.toUnderlying())
+ static auto PXWLUSENN = CConfigValue<Hyprlang::INT>("xwayland:use_nearest_neighbor");
+ if ((pWindow->m_bIsX11 && *PXWLUSENN) || pWindow->m_sAdditionalConfigData.nearestNeighbor.toUnderlying())
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = true;
- if (!pWindow->m_sAdditionalConfigData.forceNoBlur && pWindow->m_pWLSurface.small() && !pWindow->m_pWLSurface.m_bFillIgnoreSmall && renderdata.blur && **PBLUR) {
+ if (!pWindow->m_sAdditionalConfigData.forceNoBlur && pWindow->m_pWLSurface.small() && !pWindow->m_pWLSurface.m_bFillIgnoreSmall && renderdata.blur && *PBLUR) {
CBox wb = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h};
wb.scale(pMonitor->scale).round();
g_pHyprOpenGL->renderRectWithBlur(&wb, CColor(0, 0, 0, 0), renderdata.dontRound ? 0 : renderdata.rounding - 1, renderdata.fadeAlpha,
@@ -663,13 +664,13 @@ void CHyprRenderer::renderSessionLockSurface(SSessionLockSurface* pSurface, CMon
}
void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time, const Vector2D& translate, const float& scale) {
- static auto* const PDIMSPECIAL = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:dim_special");
- static auto* const PBLURSPECIAL = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:special");
- static auto* const PBLUR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
- static auto* const PRENDERTEX = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo");
- static auto* const PBACKGROUNDCOLOR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:background_color");
+ static auto PDIMSPECIAL = CConfigValue<Hyprlang::FLOAT>("decoration:dim_special");
+ static auto PBLURSPECIAL = CConfigValue<Hyprlang::INT>("decoration:blur:special");
+ static auto PBLUR = CConfigValue<Hyprlang::INT>("decoration:blur:enabled");
+ static auto PRENDERTEX = CConfigValue<Hyprlang::INT>("misc:disable_hyprland_logo");
+ static auto PBACKGROUNDCOLOR = CConfigValue<Hyprlang::INT>("misc:background_color");
- SRenderModifData RENDERMODIFDATA;
+ SRenderModifData RENDERMODIFDATA;
if (translate != Vector2D{0, 0})
RENDERMODIFDATA.modifs.push_back({SRenderModifData::eRenderModifType::RMOD_TYPE_TRANSLATE, translate});
if (scale != 1.f)
@@ -705,8 +706,8 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
g_pHyprOpenGL->blend(false);
if (!canSkipBackBufferClear(pMonitor)) {
- if (**PRENDERTEX /* inverted cfg flag */)
- g_pHyprOpenGL->clear(CColor(**PBACKGROUNDCOLOR));
+ if (*PRENDERTEX /* inverted cfg flag */)
+ g_pHyprOpenGL->clear(CColor(*PBACKGROUNDCOLOR));
else
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
}
@@ -742,12 +743,12 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
const auto SPECIALANIMPROGRS = ws->m_vRenderOffset.isBeingAnimated() ? ws->m_vRenderOffset.getCurveValue() : ws->m_fAlpha.getCurveValue();
const bool ANIMOUT = !pMonitor->specialWorkspaceID;
- if (**PDIMSPECIAL != 0.f) {
+ if (*PDIMSPECIAL != 0.f) {
CBox monbox = {translate.x, translate.y, pMonitor->vecTransformedSize.x * scale, pMonitor->vecTransformedSize.y * scale};
- g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, **PDIMSPECIAL * (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS)));
+ g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMSPECIAL * (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS)));
}
- if (**PBLURSPECIAL && **PBLUR) {
+ if (*PBLURSPECIAL && *PBLUR) {
CBox monbox = {translate.x, translate.y, pMonitor->vecTransformedSize.x * scale, pMonitor->vecTransformedSize.y * scale};
g_pHyprOpenGL->renderRectWithBlur(&monbox, CColor(0, 0, 0, 0), 0, (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS));
}
@@ -949,23 +950,23 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
static std::chrono::high_resolution_clock::time_point renderStartOverlay = std::chrono::high_resolution_clock::now();
static std::chrono::high_resolution_clock::time_point endRenderOverlay = std::chrono::high_resolution_clock::now();
- static auto* const PDEBUGOVERLAY = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:overlay");
- static auto* const PDAMAGETRACKINGMODE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:damage_tracking");
- static auto* const PDAMAGEBLINK = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:damage_blink");
- static auto* const PNODIRECTSCANOUT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:no_direct_scanout");
- static auto* const PVFR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:vfr");
- static auto* const PZOOMFACTOR = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor");
- static auto* const PANIMENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("animations:enabled");
- static auto* const PFIRSTLAUNCHANIM = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("animations:first_launch_animation");
- static auto* const PTEARINGENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:allow_tearing");
+ static auto PDEBUGOVERLAY = CConfigValue<Hyprlang::INT>("debug:overlay");
+ static auto PDAMAGETRACKINGMODE = CConfigValue<Hyprlang::INT>("debug:damage_tracking");
+ static auto PDAMAGEBLINK = CConfigValue<Hyprlang::INT>("debug:damage_blink");
+ static auto PNODIRECTSCANOUT = CConfigValue<Hyprlang::INT>("misc:no_direct_scanout");
+ static auto PVFR = CConfigValue<Hyprlang::INT>("misc:vfr");
+ static auto PZOOMFACTOR = CConfigValue<Hyprlang::FLOAT>("misc:cursor_zoom_factor");
+ static auto PANIMENABLED = CConfigValue<Hyprlang::INT>("animations:enabled");
+ static auto PFIRSTLAUNCHANIM = CConfigValue<Hyprlang::INT>("animations:first_launch_animation");
+ static auto PTEARINGENABLED = CConfigValue<Hyprlang::INT>("general:allow_tearing");
static int damageBlinkCleanup = 0; // because double-buffered
- if (!**PDAMAGEBLINK)
+ if (!*PDAMAGEBLINK)
damageBlinkCleanup = 0;
static bool firstLaunch = true;
- static bool firstLaunchAnimActive = **PFIRSTLAUNCHANIM;
+ static bool firstLaunchAnimActive = *PFIRSTLAUNCHANIM;
float zoomInFactorFirstLaunch = 1.f;
@@ -975,7 +976,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
}
if (m_tRenderTimer.getSeconds() < 1.5f && firstLaunchAnimActive) { // TODO: make the animation system more damage-flexible so that this can be migrated to there
- if (!**PANIMENABLED) {
+ if (!*PANIMENABLED) {
zoomInFactorFirstLaunch = 1.f;
firstLaunchAnimActive = false;
} else {
@@ -988,7 +989,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
renderStart = std::chrono::high_resolution_clock::now();
- if (**PDEBUGOVERLAY == 1)
+ if (*PDEBUGOVERLAY == 1)
g_pDebugOverlay->frameData(pMonitor);
if (pMonitor->framesToSkip > 0) {
@@ -1008,7 +1009,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
// checks //
if (pMonitor->ID == m_pMostHzMonitor->ID ||
- **PVFR == 1) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
+ *PVFR == 1) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
g_pCompositor->sanityCheckWorkspaces();
g_pConfigManager->dispatchExecOnce(); // We exec-once when at least one monitor starts refreshing, meaning stuff has init'd
@@ -1049,7 +1050,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (pMonitor->tearingState.nextRenderTorn) {
pMonitor->tearingState.nextRenderTorn = false;
- if (!**PTEARINGENABLED) {
+ if (!*PTEARINGENABLED) {
Debug::log(WARN, "Tearing commit requested but the master switch general:allow_tearing is off, ignoring");
return;
}
@@ -1068,7 +1069,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
shouldTear = true;
}
- if (!**PNODIRECTSCANOUT && !shouldTear) {
+ if (!*PNODIRECTSCANOUT && !shouldTear) {
if (attemptDirectScanout(pMonitor)) {
return;
} else if (m_pLastScanout) {
@@ -1090,10 +1091,10 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
// check the damage
bool hasChanged = pMonitor->output->needs_frame || pixman_region32_not_empty(&pMonitor->damage.current);
- if (!hasChanged && **PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && pMonitor->forceFullFrames == 0 && damageBlinkCleanup == 0)
+ if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && pMonitor->forceFullFrames == 0 && damageBlinkCleanup == 0)
return;
- if (**PDAMAGETRACKINGMODE == -1) {
+ if (*PDAMAGETRACKINGMODE == -1) {
Debug::log(CRIT, "Damage tracking mode -1 ????");
return;
}
@@ -1115,7 +1116,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
TRACY_GPU_ZONE("Render");
if (pMonitor == g_pCompositor->getMonitorFromCursor())
- g_pHyprOpenGL->m_RenderData.mouseZoomFactor = std::clamp(**PZOOMFACTOR, 1.f, INFINITY);
+ g_pHyprOpenGL->m_RenderData.mouseZoomFactor = std::clamp(*PZOOMFACTOR, 1.f, INFINITY);
else
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = 1.f;
@@ -1139,22 +1140,22 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
}
// if we have no tracking or full tracking, invalidate the entire monitor
- if (**PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || **PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || pMonitor->forceFullFrames > 0 || damageBlinkCleanup > 0 ||
+ if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || pMonitor->forceFullFrames > 0 || damageBlinkCleanup > 0 ||
pMonitor->isMirror() /* why??? */) {
damage = {0, 0, (int)pMonitor->vecTransformedSize.x * 10, (int)pMonitor->vecTransformedSize.y * 10};
finalDamage = damage;
} else {
- static auto* const PBLURENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
+ static auto PBLURENABLED = CConfigValue<Hyprlang::INT>("decoration:blur:enabled");
// if we use blur we need to expand the damage for proper blurring
// if framebuffer was not offloaded we're not doing introspection aka not blurring so this is redundant and dumb
- if (**PBLURENABLED == 1 && g_pHyprOpenGL->m_bOffloadedFramebuffer) {
+ if (*PBLURENABLED == 1 && g_pHyprOpenGL->m_bOffloadedFramebuffer) {
// TODO: can this be optimized?
- static auto* const PBLURSIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:size");
- static auto* const PBLURPASSES = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:passes");
- const auto BLURRADIUS =
- **PBLURPASSES > 10 ? pow(2, 15) : std::clamp(**PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, **PBLURPASSES); // is this 2^pass? I don't know but it works... I think.
+ static auto PBLURSIZE = CConfigValue<Hyprlang::INT>("decoration:blur:size");
+ static auto PBLURPASSES = CConfigValue<Hyprlang::INT>("decoration:blur:passes");
+ const auto BLURRADIUS =
+ *PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, *PBLURPASSES); // is this 2^pass? I don't know but it works... I think.
// now, prep the damage, get the extended damage region
wlr_region_expand(damage.pixman(), damage.pixman(), BLURRADIUS); // expand for proper blurring
@@ -1198,17 +1199,17 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
}
// for drawing the debug overlay
- if (pMonitor == g_pCompositor->m_vMonitors.front().get() && **PDEBUGOVERLAY == 1) {
+ if (pMonitor == g_pCompositor->m_vMonitors.front().get() && *PDEBUGOVERLAY == 1) {
renderStartOverlay = std::chrono::high_resolution_clock::now();
g_pDebugOverlay->draw();
endRenderOverlay = std::chrono::high_resolution_clock::now();
}
- if (**PDAMAGEBLINK && damageBlinkCleanup == 0) {
+ if (*PDAMAGEBLINK && damageBlinkCleanup == 0) {
CBox monrect = {0, 0, pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y};
g_pHyprOpenGL->renderRect(&monrect, CColor(1.0, 0.0, 1.0, 100.0 / 255.0), 0);
damageBlinkCleanup = 1;
- } else if (**PDAMAGEBLINK) {
+ } else if (*PDAMAGEBLINK) {
damageBlinkCleanup++;
if (damageBlinkCleanup > 3)
damageBlinkCleanup = 0;
@@ -1223,7 +1224,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (renderCursor) {
TRACY_GPU_ZONE("RenderCursor");
- bool lockSoftware = pMonitor == g_pCompositor->getMonitorFromCursor() && **PZOOMFACTOR != 1.f;
+ bool lockSoftware = pMonitor == g_pCompositor->getMonitorFromCursor() && *PZOOMFACTOR != 1.f;
if (lockSoftware) {
wlr_output_lock_software_cursors(pMonitor->output, true);
@@ -1245,10 +1246,10 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
const auto TRANSFORM = wlr_output_transform_invert(pMonitor->output->transform);
wlr_region_transform(frameDamage.pixman(), finalDamage.pixman(), TRANSFORM, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y);
- if (**PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || **PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR)
+ if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR)
frameDamage.add(0, 0, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y);
- if (**PDAMAGEBLINK)
+ if (*PDAMAGEBLINK)
frameDamage.add(damage);
g_pHyprRenderer->damageMirrorsWith(pMonitor, frameDamage);
@@ -1276,7 +1277,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (UNLOCK_SC)
wlr_output_lock_software_cursors(pMonitor->output, false);
- if (**PDAMAGEBLINK || **PVFR == 0 || pMonitor->pendingFrame)
+ if (*PDAMAGEBLINK || *PVFR == 0 || pMonitor->pendingFrame)
g_pCompositor->scheduleFrameForMonitor(pMonitor);
pMonitor->pendingFrame = false;
@@ -1284,7 +1285,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
const float µs = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - renderStart).count() / 1000.f;
g_pDebugOverlay->renderData(pMonitor, µs);
- if (**PDEBUGOVERLAY == 1) {
+ if (*PDEBUGOVERLAY == 1) {
if (pMonitor == g_pCompositor->m_vMonitors.front().get()) {
const float µsNoOverlay = µs - std::chrono::duration_cast<std::chrono::nanoseconds>(endRenderOverlay - renderStartOverlay).count() / 1000.f;
g_pDebugOverlay->renderDataNoOverlay(pMonitor, µsNoOverlay);
@@ -1627,9 +1628,9 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y, dou
m->addDamage(&damageBoxForEach);
}
- static auto* const PLOGDAMAGE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:log_damage");
+ static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
- if (**PLOGDAMAGE)
+ if (*PLOGDAMAGE)
Debug::log(LOG, "Damage: Surface (extents): xy: {}, {} wh: {}, {}", damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y1,
damageBox.pixman()->extents.x2 - damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y2 - damageBox.pixman()->extents.y1);
}
@@ -1648,9 +1649,9 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) {
for (auto& wd : pWindow->m_dWindowDecorations)
wd->damageEntire();
- static auto* const PLOGDAMAGE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:log_damage");
+ static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
- if (**PLOGDAMAGE)
+ if (*PLOGDAMAGE)
Debug::log(LOG, "Damage: Window ({}): xy: {}, {} wh: {}, {}", pWindow->m_szTitle, damageBox.x, damageBox.y, damageBox.width, damageBox.height);
}
@@ -1661,9 +1662,9 @@ void CHyprRenderer::damageMonitor(CMonitor* pMonitor) {
CBox damageBox = {0, 0, INT16_MAX, INT16_MAX};
pMonitor->addDamage(&damageBox);
- static auto* const PLOGDAMAGE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:log_damage");
+ static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
- if (**PLOGDAMAGE)
+ if (*PLOGDAMAGE)
Debug::log(LOG, "Damage: Monitor {}", pMonitor->szName);
}
@@ -1680,9 +1681,9 @@ void CHyprRenderer::damageBox(CBox* pBox) {
m->addDamage(&damageBox);
}
- static auto* const PLOGDAMAGE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:log_damage");
+ static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
- if (**PLOGDAMAGE)
+ if (*PLOGDAMAGE)
Debug::log(LOG, "Damage: Box: xy: {}, {} wh: {}, {}", pBox->x, pBox->y, pBox->width, pBox->height);
}
@@ -1738,7 +1739,7 @@ DAMAGETRACKINGMODES CHyprRenderer::damageTrackingModeFromStr(const std::string&
bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorRule, bool force) {
- static auto* const PDISABLESCALECHECKS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:disable_scale_checks");
+ static auto PDISABLESCALECHECKS = CConfigValue<Hyprlang::INT>("debug:disable_scale_checks");
Debug::log(LOG, "Applying monitor rule for {}", pMonitor->szName);
@@ -2015,7 +2016,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->vecPixelSize = pMonitor->vecSize;
Vector2D logicalSize = pMonitor->vecPixelSize / pMonitor->scale;
- if (!**PDISABLESCALECHECKS && (logicalSize.x != std::round(logicalSize.x) || logicalSize.y != std::round(logicalSize.y))) {
+ if (!*PDISABLESCALECHECKS && (logicalSize.x != std::round(logicalSize.x) || logicalSize.y != std::round(logicalSize.y))) {
// invalid scale, will produce fractional pixels.
// find the nearest valid.
@@ -2189,13 +2190,13 @@ void CHyprRenderer::setCursorFromName(const std::string& name, bool force) {
}
void CHyprRenderer::ensureCursorRenderingMode() {
- static auto* const PCURSORTIMEOUT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:cursor_inactive_timeout");
- static auto* const PHIDEONTOUCH = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:hide_cursor_on_touch");
+ static auto PCURSORTIMEOUT = CConfigValue<Hyprlang::INT>("general:cursor_inactive_timeout");
+ static auto PHIDEONTOUCH = CConfigValue<Hyprlang::INT>("misc:hide_cursor_on_touch");
- const auto PASSEDCURSORSECONDS = g_pInputManager->m_tmrLastCursorMovement.getSeconds();
+ const auto PASSEDCURSORSECONDS = g_pInputManager->m_tmrLastCursorMovement.getSeconds();
- if (**PCURSORTIMEOUT > 0 || **PHIDEONTOUCH) {
- const bool HIDE = (**PCURSORTIMEOUT > 0 && **PCURSORTIMEOUT < PASSEDCURSORSECONDS) || (g_pInputManager->m_bLastInputTouch && **PHIDEONTOUCH);
+ if (*PCURSORTIMEOUT > 0 || *PHIDEONTOUCH) {
+ const bool HIDE = (*PCURSORTIMEOUT > 0 && *PCURSORTIMEOUT < PASSEDCURSORSECONDS) || (g_pInputManager->m_bLastInputTouch && *PHIDEONTOUCH);
if (HIDE && !m_bCursorHidden) {
Debug::log(LOG, "Hiding the cursor (timeout)");
@@ -2286,7 +2287,7 @@ void CHyprRenderer::initiateManualCrash() {
g_pHyprOpenGL->m_tGlobalTimer.reset();
- static auto* const PDT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:damage_tracking");
+ static auto PDT = (Hyprlang::INT* const*)(g_pConfigManager->getConfigValuePtr("debug:damage_tracking"));
**PDT = 0;
}
@@ -2514,8 +2515,8 @@ bool CHyprRenderer::beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode
}
void CHyprRenderer::endRender() {
- const auto PMONITOR = g_pHyprOpenGL->m_RenderData.pMonitor;
- static auto* const PNVIDIAANTIFLICKER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("opengl:nvidia_anti_flicker");
+ const auto PMONITOR = g_pHyprOpenGL->m_RenderData.pMonitor;
+ static auto PNVIDIAANTIFLICKER = CConfigValue<Hyprlang::INT>("opengl:nvidia_anti_flicker");
if (m_eRenderMode != RENDER_MODE_TO_BUFFER_READ_ONLY)
g_pHyprOpenGL->end();
@@ -2528,7 +2529,7 @@ void CHyprRenderer::endRender() {
if (m_eRenderMode == RENDER_MODE_FULL_FAKE)
return;
- if (isNvidia() && **PNVIDIAANTIFLICKER)
+ if (isNvidia() && *PNVIDIAANTIFLICKER)
glFinish();
else
glFlush();