mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-22 13:35:57 +01:00
fix eating to the left
This commit is contained in:
parent
13745c7636
commit
8c62013ed1
1 changed files with 4 additions and 4 deletions
|
@ -287,13 +287,13 @@ bool canEatWindow(CWindow* a, CWindow* toEat) {
|
||||||
|
|
||||||
void eatWindow(CWindow* a, CWindow* toEat) {
|
void eatWindow(CWindow* a, CWindow* toEat) {
|
||||||
|
|
||||||
// Pos is min of both.
|
|
||||||
a->setPosition(Vector2D(std::min(a->getPosition().x, toEat->getPosition().x), std::min(a->getPosition().y, toEat->getPosition().y)));
|
|
||||||
|
|
||||||
// Size is pos + size max - pos
|
// Size is pos + size max - pos
|
||||||
const auto OPPCORNERA = a->getPosition() + a->getSize();
|
const auto OPPCORNERA = a->getPosition() + a->getSize();
|
||||||
const auto OPPCORNERB = toEat->getPosition() + toEat->getSize();
|
const auto OPPCORNERB = toEat->getPosition() + toEat->getSize();
|
||||||
|
|
||||||
|
// Pos is min of both.
|
||||||
|
a->setPosition(Vector2D(std::min(a->getPosition().x, toEat->getPosition().x), std::min(a->getPosition().y, toEat->getPosition().y)));
|
||||||
|
|
||||||
a->setSize(Vector2D(std::max(OPPCORNERA.x, OPPCORNERB.x), std::max(OPPCORNERA.y, OPPCORNERB.y)) - a->getPosition());
|
a->setSize(Vector2D(std::max(OPPCORNERA.x, OPPCORNERB.x), std::max(OPPCORNERA.y, OPPCORNERB.y)) - a->getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue