mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-02-23 03:33:57 +11:00
wayland/layershell: support auto exclusive zone without constraint
This commit is contained in:
parent
bb206e3a19
commit
3b4ebc5f16
3 changed files with 24 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue