wayland/layershell: support auto exclusive zone without constraint

This commit is contained in:
outfoxxed 2025-07-13 17:02:18 -07:00
parent bb206e3a19
commit 3b4ebc5f16
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
3 changed files with 24 additions and 3 deletions

View file

@ -1,5 +1,6 @@
#pragma once
#include <qnamespace.h>
#include <qqmlintegration.h>
#include <qtmetamacros.h>
#include <qtypes.h>
@ -21,6 +22,21 @@ public:
[[nodiscard]] bool horizontalConstraint() const noexcept { return this->mLeft && this->mRight; }
[[nodiscard]] bool verticalConstraint() const noexcept { return this->mTop && this->mBottom; }
[[nodiscard]] Qt::Edge exclusionEdge() const noexcept {
auto hasHEdge = this->mLeft ^ this->mRight;
auto hasVEdge = this->mTop ^ this->mBottom;
if (hasVEdge && !hasHEdge) {
if (this->mTop) return Qt::TopEdge;
if (this->mBottom) return Qt::BottomEdge;
} else if (hasHEdge && !hasVEdge) {
if (this->mLeft) return Qt::LeftEdge;
if (this->mRight) return Qt::RightEdge;
}
return static_cast<Qt::Edge>(0);
}
[[nodiscard]] bool operator==(const Anchors& other) const noexcept {
// clang-format off
return this->mLeft == other.mLeft