dwindle: move to CBox for expressing nodes
This commit is contained in:
parent
74cf2281dd
commit
931927de29
4 changed files with 94 additions and 89 deletions
|
|
@ -101,4 +101,12 @@ CBox CBox::roundInternal() {
|
|||
float newH = y + h - std::floor(y);
|
||||
|
||||
return CBox{std::floor(x), std::floor(y), std::floor(newW), std::floor(newH)};
|
||||
}
|
||||
}
|
||||
|
||||
Vector2D CBox::pos() const {
|
||||
return {x, y};
|
||||
}
|
||||
|
||||
Vector2D CBox::size() const {
|
||||
return {w, h};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,13 @@ class CBox {
|
|||
h = d;
|
||||
}
|
||||
|
||||
CBox(const Vector2D& pos, const Vector2D& size) {
|
||||
x = pos.x;
|
||||
y = pos.y;
|
||||
w = size.x;
|
||||
h = size.y;
|
||||
}
|
||||
|
||||
wlr_box wlr();
|
||||
wlr_box* pWlr();
|
||||
|
||||
|
|
@ -45,6 +52,8 @@ class CBox {
|
|||
CBox& addExtents(const SWindowDecorationExtents& e);
|
||||
|
||||
Vector2D middle() const;
|
||||
Vector2D pos() const;
|
||||
Vector2D size() const;
|
||||
|
||||
bool containsPoint(const Vector2D& vec) const;
|
||||
bool empty() const;
|
||||
|
|
@ -59,6 +68,11 @@ class CBox {
|
|||
double height;
|
||||
};
|
||||
|
||||
//
|
||||
bool operator==(const CBox& rhs) const {
|
||||
return x == rhs.x && y == rhs.y && w == rhs.w && h == rhs.h;
|
||||
}
|
||||
|
||||
private:
|
||||
CBox roundInternal();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue