windowrules: Make min/maxsize rules dynamic (#4775)
* rebase * simplify and remove prop * Stuff - add back win prop - change minsize defaults - change request formatting for setprop * style fix * remove empty line * change defaults * redo string to vec * remove redundant parsing * change to vec * support commas * remove static rules * take out garbage * format * don't allow commas and resize on setprop * use isNumber
This commit is contained in:
parent
ceecdd0fd5
commit
e52d3fa852
7 changed files with 87 additions and 55 deletions
|
|
@ -722,6 +722,32 @@ int64_t configStringToInt(const std::string& VALUE) {
|
|||
return std::stoll(VALUE);
|
||||
}
|
||||
|
||||
Vector2D configStringToVector2D(const std::string& VALUE) {
|
||||
std::istringstream iss(VALUE);
|
||||
std::string token;
|
||||
|
||||
if (!std::getline(iss, token, ' ') && !std::getline(iss, token, ','))
|
||||
throw std::invalid_argument("Invalid string format");
|
||||
|
||||
if (!isNumber(token))
|
||||
throw std::invalid_argument("Invalid x value");
|
||||
|
||||
long long x = std::stoll(token);
|
||||
|
||||
if (!std::getline(iss, token))
|
||||
throw std::invalid_argument("Invalid string format");
|
||||
|
||||
if (!isNumber(token))
|
||||
throw std::invalid_argument("Invalid y value");
|
||||
|
||||
long long y = std::stoll(token);
|
||||
|
||||
if (std::getline(iss, token))
|
||||
throw std::invalid_argument("Invalid string format");
|
||||
|
||||
return Vector2D(x, y);
|
||||
}
|
||||
|
||||
double normalizeAngleRad(double ang) {
|
||||
if (ang > M_PI * 2) {
|
||||
while (ang > M_PI * 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue