Fix fallback cairo rect size and ramove do while

This commit is contained in:
outfoxxed 2023-08-15 20:16:23 -07:00
parent 377a2e441b
commit 284b90c75f
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E

View file

@ -1723,19 +1723,15 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
texName += "2K.png"; texName += "2K.png";
} }
// goto is banned? ok have a do while. std::string texPath;
std::string texPath = "/usr/share/hyprland/" + texName; auto paths = {"/usr/share/hyprland/", "/usr/local/share/hyprland/", "assets/"};
do {
if (std::filesystem::exists(texPath)) for (auto& path : paths) {
break; texPath = path + texName;
texPath = "/usr/local/share/hyprland/" + texName;
if (std::filesystem::exists(texPath))
break;
texPath = "assets/" + texName;
if (std::filesystem::exists(texPath)) if (std::filesystem::exists(texPath))
break; break;
texPath = ""; texPath = "";
} while (false); }
PTEX->m_vSize = textureSize; PTEX->m_vSize = textureSize;
@ -1771,7 +1767,7 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
if (texPath.empty()) { if (texPath.empty()) {
cairo_set_source_rgba(CAIRO, 0.106, 0.106, 0.106, 1.0); cairo_set_source_rgba(CAIRO, 0.106, 0.106, 0.106, 1.0);
cairo_rectangle(CAIRO, 0, 0, box.width, box.height); cairo_rectangle(CAIRO, 0, 0, textureSize.x, textureSize.y);
cairo_fill(CAIRO); cairo_fill(CAIRO);
} }