lib: set size to 0 for svg images

ref #13
This commit is contained in:
Vaxry 2024-03-23 01:04:46 +00:00
parent 6a92473237
commit 7bd0d55aa2
1 changed files with 10 additions and 7 deletions

View File

@ -491,12 +491,15 @@ static Hyprlang::CParseResult parseDefineSize(const char* C, const char* V) {
image.filename = RHS; image.filename = RHS;
if (!image.filename.ends_with(".svg")) {
try { try {
image.size = std::stoull(LHS); image.size = std::stoull(LHS);
} catch (std::exception& e) { } catch (std::exception& e) {
result.setError(e.what()); result.setError(e.what());
return result; return result;
} }
} else
image.size = 0;
currentTheme->shapes.back()->images.push_back(image); currentTheme->shapes.back()->images.push_back(image);
@ -633,7 +636,7 @@ std::optional<std::string> CHyprcursorImplementation::loadTheme() {
// load image // load image
Debug::log(TRACE, "Loading {} for shape {}", i.filename, cursor.path().stem().string()); Debug::log(TRACE, "Loading {} for shape {}", i.filename, cursor.path().stem().string());
auto* IMAGE = LOADEDSHAPE.images.emplace_back(std::make_unique<SLoadedCursorImage>()).get(); auto* IMAGE = LOADEDSHAPE.images.emplace_back(std::make_unique<SLoadedCursorImage>()).get();
IMAGE->side = i.size; IMAGE->side = SHAPE->shapeType == SHAPE_SVG ? 0 : i.size;
IMAGE->delay = i.delay; IMAGE->delay = i.delay;
IMAGE->isSVG = SHAPE->shapeType == SHAPE_SVG; IMAGE->isSVG = SHAPE->shapeType == SHAPE_SVG;