cursor: move to a hyprland impl
This moves wlr_cursor to a completely new impl mostly under CPointerManager Also adds beginSimple to OpenGL for simple render passes (e.g. cursor)
This commit is contained in:
parent
e4e84064f2
commit
ed411f53bd
51 changed files with 1550 additions and 496 deletions
|
|
@ -121,7 +121,7 @@ CBox& CBox::noNegativeSize() {
|
|||
return *this;
|
||||
}
|
||||
|
||||
CBox CBox::intersection(const CBox other) const {
|
||||
CBox CBox::intersection(const CBox& other) const {
|
||||
const float newX = std::max(x, other.x);
|
||||
const float newY = std::max(y, other.y);
|
||||
const float newBottom = std::min(y + h, other.y + other.h);
|
||||
|
|
@ -137,6 +137,14 @@ CBox CBox::intersection(const CBox other) const {
|
|||
return {newX, newY, newW, newH};
|
||||
}
|
||||
|
||||
bool CBox::overlaps(const CBox& other) const {
|
||||
return (other.x + other.w >= x) && (x + w >= other.x) && (other.y + other.h >= y) && (y + h >= other.y);
|
||||
}
|
||||
|
||||
bool CBox::inside(const CBox& bound) const {
|
||||
return bound.x < x && bound.y < y && x + w < bound.x + bound.w && y + h < bound.y + bound.h;
|
||||
}
|
||||
|
||||
CBox CBox::roundInternal() {
|
||||
float newW = x + w - std::floor(x);
|
||||
float newH = y + h - std::floor(y);
|
||||
|
|
@ -156,6 +164,16 @@ Vector2D CBox::size() const {
|
|||
return {w, h};
|
||||
}
|
||||
|
||||
Vector2D CBox::closestPoint(const Vector2D& vec) const {
|
||||
if (containsPoint(vec))
|
||||
return vec;
|
||||
|
||||
Vector2D nv = vec;
|
||||
nv.x = std::clamp(nv.x, x, x + w);
|
||||
nv.y = std::clamp(nv.y, y, y + h);
|
||||
return nv;
|
||||
}
|
||||
|
||||
SWindowDecorationExtents CBox::extentsFrom(const CBox& small) {
|
||||
return {{small.x - x, small.y - y}, {w - small.w - (small.x - x), h - small.h - (small.y - y)}};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue