aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/render/OpenGL.cpp
diff options
context:
space:
mode:
authorDaniD3v <[email protected]>2023-10-07 15:08:38 +0200
committerGitHub <[email protected]>2023-10-07 14:08:38 +0100
commit7d7565e7ecb65463d68ebe0d2654ad346d61acd8 (patch)
treee84d5e2e14c2066e7afa5cf8879397a0caa25bcb /src/render/OpenGL.cpp
parent38e242953df06b7b90a09fd7a1480a9cfcdd6ba8 (diff)
downloadHyprland-7d7565e7ecb65463d68ebe0d2654ad346d61acd8.tar.gz
Hyprland-7d7565e7ecb65463d68ebe0d2654ad346d61acd8.zip
renderer: add force_wallpaper instead of no_hypr_chan (#3459)
Diffstat (limited to 'src/render/OpenGL.cpp')
-rw-r--r--src/render/OpenGL.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 5d513f31..64703205 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -1762,34 +1762,37 @@ void CHyprOpenGLImpl::renderSplash(cairo_t* const CAIRO, cairo_surface_t* const
void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
RASSERT(m_RenderData.pMonitor, "Tried to createBGTex without begin()!");
- static auto* const PNOSPLASH = &g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering")->intValue;
- static auto* const PDISABLEHYPRCHAN = &g_pConfigManager->getConfigValuePtr("misc:disable_hypr_chan")->intValue;
- static auto* const PFORCEHYPRCHAN = &g_pConfigManager->getConfigValuePtr("misc:force_hypr_chan")->intValue;
+ static auto* const PNOSPLASH = &g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering")->intValue;
+ static auto* const PFORCEHYPRCHAN = &g_pConfigManager->getConfigValuePtr("misc:force_hypr_chan")->intValue;
+ static auto* const PFORCEWALLPAPER = &g_pConfigManager->getConfigValuePtr("misc:force_default_wallpaper")->intValue;
- std::random_device dev;
- std::mt19937 engine(dev());
- std::uniform_int_distribution<> distribution(0, 2);
- std::uniform_int_distribution<> distribution2(0, 1);
-
- const bool USEANIME = *PFORCEHYPRCHAN || distribution(engine) == 0; // 66% for anime
+ const auto FORCEWALLPAPER = std::clamp(*PFORCEWALLPAPER, -1L, 2L);
// release the last tex if exists
const auto PTEX = &m_mMonitorBGTextures[pMonitor];
PTEX->destroyTexture();
PTEX->allocate();
-
Debug::log(LOG, "Allocated texture for BGTex");
// TODO: use relative paths to the installation
// or configure the paths at build time
+ std::string texPath = "/usr/share/hyprland/wall_";
+ std::string prefixes[] = {"", "anime_", "anime2_"};
// get the adequate tex
- std::string texPath = "/usr/share/hyprland/wall_";
- if (!*PDISABLEHYPRCHAN)
- texPath += std::string(USEANIME ? (distribution2(engine) == 0 ? "anime_" : "anime2_") : "");
-
- // check if wallpapers exist
+ if (FORCEWALLPAPER == -1) {
+ std::random_device dev;
+ std::mt19937 engine(dev());
+ std::uniform_int_distribution<> distribution(0, 2);
+ std::uniform_int_distribution<> distribution_anime(1, 2);
+
+ if (PFORCEHYPRCHAN)
+ texPath += prefixes[distribution_anime(engine)];
+ else
+ texPath += prefixes[distribution(engine)];
+ } else
+ texPath += prefixes[FORCEWALLPAPER];
Vector2D textureSize;
if (pMonitor->vecTransformedSize.x > 3850) {
@@ -1803,6 +1806,7 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
texPath += "2K.png";
}
+ // check if wallpapers exist
if (!std::filesystem::exists(texPath)) {
// try local
texPath = texPath.substr(0, 5) + "local/" + texPath.substr(5);