mirror of
https://github.com/hyprwm/hyprcursor.git
synced 2024-12-22 02:09:48 +01:00
parent
70fb494aa6
commit
0264e69814
1 changed files with 42 additions and 34 deletions
|
@ -71,49 +71,53 @@ static Hyprlang::CParseResult parseDefineSize(const char* C, const char* V) {
|
||||||
Hyprlang::CParseResult result;
|
Hyprlang::CParseResult result;
|
||||||
const std::string VALUE = V;
|
const std::string VALUE = V;
|
||||||
|
|
||||||
if (!VALUE.contains(",")) {
|
CVarList sizes(VALUE, 0, ';');
|
||||||
result.setError("Invalid define_size");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto LHS = removeBeginEndSpacesTabs(VALUE.substr(0, VALUE.find_first_of(",")));
|
for (const auto& sizeStr : sizes) {
|
||||||
auto RHS = removeBeginEndSpacesTabs(VALUE.substr(VALUE.find_first_of(",") + 1));
|
if (!sizeStr.contains(",")) {
|
||||||
auto DELAY = 0;
|
result.setError("Invalid define_size");
|
||||||
|
|
||||||
CMeta::SDefinedSize size;
|
|
||||||
|
|
||||||
if (RHS.contains(",")) {
|
|
||||||
const auto LL = removeBeginEndSpacesTabs(RHS.substr(0, RHS.find(",")));
|
|
||||||
const auto RR = removeBeginEndSpacesTabs(RHS.substr(RHS.find(",") + 1));
|
|
||||||
|
|
||||||
try {
|
|
||||||
size.delayMs = std::stoull(RR);
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
result.setError(e.what());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
RHS = LL;
|
auto LHS = removeBeginEndSpacesTabs(sizeStr.substr(0, sizeStr.find_first_of(",")));
|
||||||
}
|
auto RHS = removeBeginEndSpacesTabs(sizeStr.substr(sizeStr.find_first_of(",") + 1));
|
||||||
|
auto DELAY = 0;
|
||||||
|
|
||||||
if (!std::regex_match(RHS, std::regex("^[A-Za-z0-9_\\-\\.]+$"))) {
|
CMeta::SDefinedSize size;
|
||||||
result.setError("Invalid cursor file name, characters must be within [A-Za-z0-9_\\-\\.] (if this seems like a mistake, check for invisible characters)");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
size.file = RHS;
|
if (RHS.contains(",")) {
|
||||||
|
const auto LL = removeBeginEndSpacesTabs(RHS.substr(0, RHS.find(",")));
|
||||||
|
const auto RR = removeBeginEndSpacesTabs(RHS.substr(RHS.find(",") + 1));
|
||||||
|
|
||||||
if (!size.file.ends_with(".svg")) {
|
try {
|
||||||
try {
|
size.delayMs = std::stoull(RR);
|
||||||
size.size = std::stoull(LHS);
|
} catch (std::exception& e) {
|
||||||
} catch (std::exception& e) {
|
result.setError(e.what());
|
||||||
result.setError(e.what());
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
RHS = LL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!std::regex_match(RHS, std::regex("^[A-Za-z0-9_\\-\\.]+$"))) {
|
||||||
|
result.setError("Invalid cursor file name, characters must be within [A-Za-z0-9_\\-\\.] (if this seems like a mistake, check for invisible characters)");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
size.size = 0;
|
|
||||||
|
|
||||||
currentMeta->parsedData.definedSizes.push_back(size);
|
size.file = RHS;
|
||||||
|
|
||||||
|
if (!size.file.ends_with(".svg")) {
|
||||||
|
try {
|
||||||
|
size.size = std::stoull(LHS);
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
result.setError(e.what());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
size.size = 0;
|
||||||
|
|
||||||
|
currentMeta->parsedData.definedSizes.push_back(size);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +126,11 @@ static Hyprlang::CParseResult parseOverride(const char* C, const char* V) {
|
||||||
Hyprlang::CParseResult result;
|
Hyprlang::CParseResult result;
|
||||||
const std::string VALUE = V;
|
const std::string VALUE = V;
|
||||||
|
|
||||||
currentMeta->parsedData.overrides.push_back(VALUE);
|
CVarList overrides(VALUE, 0, ';');
|
||||||
|
|
||||||
|
for (const auto& o : overrides) {
|
||||||
|
currentMeta->parsedData.overrides.push_back(VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue