From 430af62f311bff3a56143ef0973d5d420f7fd0b4 Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Thu, 14 Nov 2024 11:05:17 +0100 Subject: [PATCH] xcursors: store themes in a std:set to order it using a unordered_set means its store based on a hash_value meaning currently it can end up loading inherited themes before the actual theme itself depending on the hash of the theme name used, reason for using set at all over vector is to keep unique members and not foreverever looping broken inherit themeing. --- src/managers/XCursorManager.cpp | 8 ++++---- src/managers/XCursorManager.hpp | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/managers/XCursorManager.cpp b/src/managers/XCursorManager.cpp index 93ee7965..5c3053c7 100644 --- a/src/managers/XCursorManager.cpp +++ b/src/managers/XCursorManager.cpp @@ -197,7 +197,7 @@ SP CXCursorManager::createCursor(std::string const& shape, XcursorIma return xcursor; } -std::unordered_set CXCursorManager::themePaths(std::string const& theme) { +std::set CXCursorManager::themePaths(std::string const& theme) { auto const* path = XcursorLibraryPath(); auto expandTilde = [](std::string const& path) { @@ -276,10 +276,10 @@ std::unordered_set CXCursorManager::themePaths(std::string const& t return themes; }; - std::unordered_set paths; - std::unordered_set inherits; + std::set paths; + std::set inherits; - auto scanTheme = [&path, &paths, &expandTilde, &inherits, &getInheritThemes](auto const& t) { + auto scanTheme = [&path, &paths, &expandTilde, &inherits, &getInheritThemes](auto const& t) { std::stringstream ss(path); std::string line; diff --git a/src/managers/XCursorManager.hpp b/src/managers/XCursorManager.hpp index 1f3c24db..2517e85e 100644 --- a/src/managers/XCursorManager.hpp +++ b/src/managers/XCursorManager.hpp @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include #include #include #include @@ -34,16 +34,16 @@ class CXCursorManager { void syncGsettings(); private: - SP createCursor(std::string const& shape, XcursorImages* xImages); - std::unordered_set themePaths(std::string const& theme); - std::string getLegacyShapeName(std::string const& shape); - std::vector> loadStandardCursors(std::string const& name, int size); - std::vector> loadAllFromDir(std::string const& path, int size); + SP createCursor(std::string const& shape, XcursorImages* xImages); + std::set themePaths(std::string const& theme); + std::string getLegacyShapeName(std::string const& shape); + std::vector> loadStandardCursors(std::string const& name, int size); + std::vector> loadAllFromDir(std::string const& path, int size); - int lastLoadSize = 0; - float lastLoadScale = 0; - std::string themeName = ""; - SP defaultCursor; - SP hyprCursor; - std::vector> cursors; + int lastLoadSize = 0; + float lastLoadScale = 0; + std::string themeName = ""; + SP defaultCursor; + SP hyprCursor; + std::vector> cursors; };