wayland/layershell: support opposite-to-exclusion edge margins

This commit is contained in:
outfoxxed 2025-07-13 17:08:12 -07:00
parent 3b4ebc5f16
commit 479ff58f84
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -21,11 +21,16 @@ WlrLayershell::WlrLayershell(QObject* parent): ProxyWindowBase(parent) {
case ExclusionMode::Ignore: return -1;
case ExclusionMode::Normal: return this->bExclusiveZone;
case ExclusionMode::Auto:
const auto edge = this->bcExclusionEdge.value();
const auto margins = this->bMargins.value();
if (edge == Qt::TopEdge || edge == Qt::BottomEdge) return this->bImplicitHeight;
else if (edge == Qt::LeftEdge || edge == Qt::RightEdge) return this->bImplicitWidth;
else return 0;
// add reverse edge margins which are ignored by wlr-layer-shell
switch (this->bcExclusionEdge.value()) {
case Qt::TopEdge: return this->bImplicitHeight + margins.bottom;
case Qt::BottomEdge: return this->bImplicitHeight + margins.top;
case Qt::LeftEdge: return this->bImplicitHeight + margins.right;
case Qt::RightEdge: return this->bImplicitHeight + margins.left;
default: return 0;
}
}
});