From 8f104815e8c2e99f9c16e4cc815f37df6372039a Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Sun, 22 Nov 2020 21:47:31 +0000 Subject: [PATCH] Add a QRect to showWindowMenu This is so we don't have to rely on the cursor position for the popup BUG: 393163 --- decorations/decoratedclient.cpp | 5 ++--- decorations/decoratedclient.h | 2 +- kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp | 3 ++- kcmkwin/kwindecoration/declarative-plugin/previewclient.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp index d9072ca5e6..f8782be60a 100644 --- a/decorations/decoratedclient.cpp +++ b/decorations/decoratedclient.cpp @@ -226,10 +226,9 @@ void DecoratedClientImpl::requestHideToolTip() m_toolTipShowing = false; } -void DecoratedClientImpl::requestShowWindowMenu() +void DecoratedClientImpl::requestShowWindowMenu(const QRect &rect) { - // TODO: add rect to requestShowWindowMenu - Workspace::self()->showWindowMenu(QRect(Cursors::self()->mouse()->pos(), Cursors::self()->mouse()->pos()), m_client); + Workspace::self()->showWindowMenu(QRect(m_client->pos() + rect.topLeft(), m_client->pos() + rect.bottomRight()), m_client); } void DecoratedClientImpl::requestShowApplicationMenu(const QRect &rect, int actionId) diff --git a/decorations/decoratedclient.h b/decorations/decoratedclient.h index be818e742d..49f8be515f 100644 --- a/decorations/decoratedclient.h +++ b/decorations/decoratedclient.h @@ -70,7 +70,7 @@ public: void requestContextHelp() override; void requestToggleMaximization(Qt::MouseButtons buttons) override; void requestMinimize() override; - void requestShowWindowMenu() override; + void requestShowWindowMenu(const QRect &rect) override; void requestShowApplicationMenu(const QRect &rect, int actionId) override; void requestToggleKeepAbove() override; void requestToggleKeepBelow() override; diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp index 005c051df9..05d105cd8b 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp +++ b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp @@ -391,8 +391,9 @@ void PreviewClient::requestToggleKeepBelow() setKeepBelow(!isKeepBelow()); } -void PreviewClient::requestShowWindowMenu() +void PreviewClient::requestShowWindowMenu(const QRect &rect) { + Q_UNUSED(rect) emit showWindowMenuRequested(); } diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewclient.h b/kcmkwin/kwindecoration/declarative-plugin/previewclient.h index e515a9fd6f..fbd88a32f4 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewclient.h +++ b/kcmkwin/kwindecoration/declarative-plugin/previewclient.h @@ -93,7 +93,7 @@ public: void requestToggleKeepAbove() override; void requestToggleKeepBelow() override; void requestToggleShade() override; - void requestShowWindowMenu() override; + void requestShowWindowMenu(const QRect &rect) override; void requestShowApplicationMenu(const QRect &rect, int actionId) override; void requestToggleOnAllDesktops() override;