diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp index 14ae4f91a7..e155925ba7 100644 --- a/decorations/decoratedclient.cpp +++ b/decorations/decoratedclient.cpp @@ -86,6 +86,11 @@ DecoratedClientImpl::DecoratedClientImpl(Client *client, KDecoration2::Decorated decoration->update(); } ); + connect(client, &Client::quickTileModeChanged, decoratedClient, + [this, decoratedClient]() { + emit decoratedClient->borderingScreenEdgesChanged(borderingScreenEdges()); + } + ); } DecoratedClientImpl::~DecoratedClientImpl() = default; @@ -188,6 +193,33 @@ bool DecoratedClientImpl::isMaximizedHorizontally() const return m_client->maximizeMode() & KDecorationDefines::MaximizeHorizontal; } +Qt::Edges DecoratedClientImpl::borderingScreenEdges() const +{ + Qt::Edges edges; + const KDecorationDefines::QuickTileMode mode = m_client->quickTileMode(); + if (mode.testFlag(KDecorationDefines::QuickTileLeft)) { + edges |= Qt::LeftEdge; + if (!mode.testFlag(KDecorationDefines::QuickTileTop) && !mode.testFlag(KDecorationDefines::QuickTileBottom)) { + // using complete side + edges |= Qt::TopEdge | Qt::BottomEdge; + } + } + if (mode.testFlag(KDecorationDefines::QuickTileTop)) { + edges |= Qt::TopEdge; + } + if (mode.testFlag(KDecorationDefines::QuickTileRight)) { + edges |= Qt::RightEdge; + if (!mode.testFlag(KDecorationDefines::QuickTileTop) && !mode.testFlag(KDecorationDefines::QuickTileBottom)) { + // using complete side + edges |= Qt::TopEdge | Qt::BottomEdge; + } + } + if (mode.testFlag(KDecorationDefines::QuickTileBottom)) { + edges |= Qt::BottomEdge; + } + return edges; +} + void DecoratedClientImpl::createRenderer() { if (Compositor::self()->hasScene()) { diff --git a/decorations/decoratedclient.h b/decorations/decoratedclient.h index 100b9c3290..65951a0e16 100644 --- a/decorations/decoratedclient.h +++ b/decorations/decoratedclient.h @@ -65,6 +65,8 @@ public: int width() const override; WId windowId() const override; + Qt::Edges borderingScreenEdges() const override; + void requestClose() override; void requestContextHelp() override; void requestMaximize(Qt::MouseButtons buttons) override;