mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 02:25:58 +01:00
Properly formatted Compositor.cpp
This commit is contained in:
parent
570757fd6f
commit
dc00eb7d87
1 changed files with 11 additions and 11 deletions
|
@ -2125,9 +2125,9 @@ SLayerSurface* CCompositor::getLayerSurfaceFromSurface(wlr_surface* pSurface) {
|
||||||
Vector2D CCompositor::parseWindowVectorArgsRelative(const std::string& args, const Vector2D& relativeTo) {
|
Vector2D CCompositor::parseWindowVectorArgsRelative(const std::string& args, const Vector2D& relativeTo) {
|
||||||
const auto PMONITOR = m_pLastMonitor; // TODO: It's unclear if this will always return correct monitor
|
const auto PMONITOR = m_pLastMonitor; // TODO: It's unclear if this will always return correct monitor
|
||||||
|
|
||||||
bool xIsPercent = false;
|
bool xIsPercent = false;
|
||||||
bool yIsPercent = false;
|
bool yIsPercent = false;
|
||||||
bool isExact = false;
|
bool isExact = false;
|
||||||
|
|
||||||
if (!args.contains(' '))
|
if (!args.contains(' '))
|
||||||
return relativeTo;
|
return relativeTo;
|
||||||
|
@ -2136,18 +2136,18 @@ Vector2D CCompositor::parseWindowVectorArgsRelative(const std::string& args, con
|
||||||
std::string y = args.substr(args.find_first_of(' ') + 1);
|
std::string y = args.substr(args.find_first_of(' ') + 1);
|
||||||
|
|
||||||
if (x == "exact") {
|
if (x == "exact") {
|
||||||
x = y.substr(0, y.find_first_of(' '));
|
x = y.substr(0, y.find_first_of(' '));
|
||||||
y = y.substr(y.find_first_of(' ') + 1);
|
y = y.substr(y.find_first_of(' ') + 1);
|
||||||
isExact = true;
|
isExact = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x.contains('%')){
|
if (x.contains('%')) {
|
||||||
xIsPercent = true;
|
xIsPercent = true;
|
||||||
x = x.substr(0, x.length()-1);
|
x = x.substr(0, x.length() - 1);
|
||||||
}
|
}
|
||||||
if (y.contains('%')){
|
if (y.contains('%')) {
|
||||||
yIsPercent = true;
|
yIsPercent = true;
|
||||||
y = y.substr(0, y.length()-1);
|
y = y.substr(0, y.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isNumber(x) || !isNumber(y)) {
|
if (!isNumber(x) || !isNumber(y)) {
|
||||||
|
@ -2162,8 +2162,8 @@ Vector2D CCompositor::parseWindowVectorArgsRelative(const std::string& args, con
|
||||||
X = xIsPercent ? std::stof(x) * 0.01 * PMONITOR->vecSize.x : std::stoi(x);
|
X = xIsPercent ? std::stof(x) * 0.01 * PMONITOR->vecSize.x : std::stoi(x);
|
||||||
Y = yIsPercent ? std::stof(y) * 0.01 * PMONITOR->vecSize.y : std::stoi(y);
|
Y = yIsPercent ? std::stof(y) * 0.01 * PMONITOR->vecSize.y : std::stoi(y);
|
||||||
} else {
|
} else {
|
||||||
X = xIsPercent ? std::stof(x) * 0.01 * relativeTo.x + relativeTo.x: std::stoi(x) + relativeTo.x;
|
X = xIsPercent ? std::stof(x) * 0.01 * relativeTo.x + relativeTo.x : std::stoi(x) + relativeTo.x;
|
||||||
Y = yIsPercent ? std::stof(y) * 0.01 * relativeTo.y + relativeTo.y: std::stoi(y) + relativeTo.y;
|
Y = yIsPercent ? std::stof(y) * 0.01 * relativeTo.y + relativeTo.y : std::stoi(y) + relativeTo.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (X < 0 || Y < 0) {
|
if (X < 0 || Y < 0) {
|
||||||
|
|
Loading…
Reference in a new issue