mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 07:45:59 +01:00
guard monitor settings
This commit is contained in:
parent
9540106959
commit
5a96142cf8
1 changed files with 11 additions and 1 deletions
|
@ -449,17 +449,27 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
|
||||||
|
|
||||||
if (curitem.contains("@"))
|
if (curitem.contains("@"))
|
||||||
newrule.refreshRate = stof(curitem.substr(curitem.find_first_of('@') + 1));
|
newrule.refreshRate = stof(curitem.substr(curitem.find_first_of('@') + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
nextItem();
|
nextItem();
|
||||||
|
|
||||||
newrule.offset.x = stoi(curitem.substr(0, curitem.find_first_of('x')));
|
newrule.offset.x = stoi(curitem.substr(0, curitem.find_first_of('x')));
|
||||||
newrule.offset.y = stoi(curitem.substr(curitem.find_first_of('x') + 1));
|
newrule.offset.y = stoi(curitem.substr(curitem.find_first_of('x') + 1));
|
||||||
|
|
||||||
|
if (newrule.offset.x < 0 || newrule.offset.y < 0) {
|
||||||
|
parseError = "invalid offset. Offset cannot be negative.";
|
||||||
|
newrule.offset = Vector2D();
|
||||||
|
}
|
||||||
|
|
||||||
nextItem();
|
nextItem();
|
||||||
|
|
||||||
newrule.scale = stof(curitem);
|
newrule.scale = stof(curitem);
|
||||||
|
|
||||||
|
if (newrule.scale < 0.25f) {
|
||||||
|
parseError = "not a valid scale.";
|
||||||
|
newrule.scale = 1;
|
||||||
|
}
|
||||||
|
|
||||||
nextItem();
|
nextItem();
|
||||||
|
|
||||||
if (curitem != "") {
|
if (curitem != "") {
|
||||||
|
|
Loading…
Reference in a new issue