mirror of
https://github.com/hyprwm/hyprcursor.git
synced 2024-12-22 10:19:48 +01:00
meta: clamp nominalSize
This commit is contained in:
parent
84203d8126
commit
abc1c60eb5
1 changed files with 5 additions and 4 deletions
|
@ -4,6 +4,7 @@
|
||||||
#include <toml++/toml.hpp>
|
#include <toml++/toml.hpp>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "VarList.hpp"
|
#include "VarList.hpp"
|
||||||
|
|
||||||
|
@ -154,7 +155,7 @@ std::optional<std::string> CMeta::parseHL() {
|
||||||
|
|
||||||
parsedData.hotspotX = std::any_cast<Hyprlang::FLOAT>(meta->getConfigValue("hotspot_x"));
|
parsedData.hotspotX = std::any_cast<Hyprlang::FLOAT>(meta->getConfigValue("hotspot_x"));
|
||||||
parsedData.hotspotY = std::any_cast<Hyprlang::FLOAT>(meta->getConfigValue("hotspot_y"));
|
parsedData.hotspotY = std::any_cast<Hyprlang::FLOAT>(meta->getConfigValue("hotspot_y"));
|
||||||
parsedData.nominalSize = std::any_cast<Hyprlang::FLOAT>(meta->getConfigValue("nominal_size"));
|
parsedData.nominalSize = std::clamp(std::any_cast<Hyprlang::FLOAT>(meta->getConfigValue("nominal_size")), 0.1F, 2.F);
|
||||||
parsedData.resizeAlgo = std::any_cast<Hyprlang::STRING>(meta->getConfigValue("resize_algorithm"));
|
parsedData.resizeAlgo = std::any_cast<Hyprlang::STRING>(meta->getConfigValue("resize_algorithm"));
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
@ -164,9 +165,9 @@ std::optional<std::string> CMeta::parseTOML() {
|
||||||
try {
|
try {
|
||||||
auto MANIFEST = dataPath ? toml::parse_file(rawdata) : toml::parse(rawdata);
|
auto MANIFEST = dataPath ? toml::parse_file(rawdata) : toml::parse(rawdata);
|
||||||
|
|
||||||
parsedData.hotspotX = MANIFEST["General"]["hotspot_x"].value_or(0.f);
|
parsedData.hotspotX = MANIFEST["General"]["hotspot_x"].value_or(0.f);
|
||||||
parsedData.hotspotY = MANIFEST["General"]["hotspot_y"].value_or(0.f);
|
parsedData.hotspotY = MANIFEST["General"]["hotspot_y"].value_or(0.f);
|
||||||
parsedData.hotspotY = MANIFEST["General"]["nominal_size"].value_or(1.f);
|
parsedData.nominalSize = std::clamp(MANIFEST["General"]["nominal_size"].value_or(1.F), 0.1F, 2.F);
|
||||||
|
|
||||||
const std::string OVERRIDES = MANIFEST["General"]["define_override"].value_or("");
|
const std::string OVERRIDES = MANIFEST["General"]["define_override"].value_or("");
|
||||||
const std::string SIZES = MANIFEST["General"]["define_size"].value_or("");
|
const std::string SIZES = MANIFEST["General"]["define_size"].value_or("");
|
||||||
|
|
Loading…
Reference in a new issue