From 02d3c37f939d3e36489407571be6bbbccc0ff60b Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sun, 22 May 2022 17:20:19 +0300 Subject: [PATCH] view:drop contextmenu class --use ContextMenuLayer internal quickitem that is responsible for applets and containments context menus from now on. --- app/view/settings/canvasconfigview.cpp | 12 ------------ app/view/settings/canvasconfigview.h | 1 - app/view/view.cpp | 19 ------------------- app/view/view.h | 6 ------ .../configuration/CanvasConfiguration.qml | 7 +++++++ 5 files changed, 7 insertions(+), 38 deletions(-) diff --git a/app/view/settings/canvasconfigview.cpp b/app/view/settings/canvasconfigview.cpp index 104d55cc7..cc228da98 100644 --- a/app/view/settings/canvasconfigview.cpp +++ b/app/view/settings/canvasconfigview.cpp @@ -102,18 +102,6 @@ void CanvasConfigView::syncGeometry() } } -void CanvasConfigView::mousePressEvent(QMouseEvent *event) -{ - if (!m_latteView) { - return; - } - - bool result = m_latteView->contextMenu()->mousePressEventForContainmentMenu(this, event); - - QQuickView::mousePressEvent(event); - -} - bool CanvasConfigView::event(QEvent *e) { bool result = SubConfigView::event(e); diff --git a/app/view/settings/canvasconfigview.h b/app/view/settings/canvasconfigview.h index 8aadcc2c8..f73c3855d 100644 --- a/app/view/settings/canvasconfigview.h +++ b/app/view/settings/canvasconfigview.h @@ -68,7 +68,6 @@ protected: void showEvent(QShowEvent *ev) override; void focusOutEvent(QFocusEvent *ev) override; bool event(QEvent *ev) override; - void mousePressEvent(QMouseEvent *event) override; void init() override; void initParentView(Latte::View *view) override; diff --git a/app/view/view.cpp b/app/view/view.cpp index 43c5f7647..7f7bcdf64 100644 --- a/app/view/view.cpp +++ b/app/view/view.cpp @@ -8,7 +8,6 @@ #include "view.h" // local -#include "contextmenu.h" #include "effects.h" #include "positioner.h" #include "visibilitymanager.h" @@ -67,7 +66,6 @@ namespace Latte { //! are needed in order for window flags to be set correctly View::View(Plasma::Corona *corona, QScreen *targetScreen, bool byPassX11WM) : PlasmaQuick::ContainmentView(corona), - m_contextMenu(new ViewPart::ContextMenu(this)), m_effects(new ViewPart::Effects(this)), m_interface(new ViewPart::ContainmentInterface(this)), m_parabolic(new ViewPart::Parabolic(this)), @@ -120,7 +118,6 @@ View::View(Plasma::Corona *corona, QScreen *targetScreen, bool byPassX11WM) m_releaseGrabTimer.setSingleShot(true); connect(&m_releaseGrabTimer, &QTimer::timeout, this, &View::releaseGrab); - connect(m_contextMenu, &ViewPart::ContextMenu::menuChanged, this, &View::updateTransientWindowsTracking); connect(m_interface, &ViewPart::ContainmentInterface::hasExpandedAppletChanged, this, &View::updateTransientWindowsTracking); connect(this, &View::containmentChanged, this, &View::groupIdChanged); @@ -251,10 +248,6 @@ View::~View() delete m_appletConfigView; } - if (m_contextMenu) { - delete m_contextMenu; - } - //needs to be deleted before Effects because it catches some of its signals if (m_positioner) { delete m_positioner; @@ -1443,11 +1436,6 @@ ViewPart::Indicator *View::indicator() const return m_indicator; } -ViewPart::ContextMenu *View::contextMenu() const -{ - return m_contextMenu; -} - ViewPart::ContainmentInterface *View::extendedInterface() const { return m_interface; @@ -1721,13 +1709,6 @@ void View::verticalUnityViewHasFocus() //!BEGIN overriding context menus behavior void View::mousePressEvent(QMouseEvent *event) { - //bool result = m_contextMenu->mousePressEvent(event); - - //if (result) { - // PlasmaQuick::ContainmentView::mousePressEvent(event); - //updateTransientWindowsTracking(); - //} - PlasmaQuick::ContainmentView::mousePressEvent(event); verticalUnityViewHasFocus(); } diff --git a/app/view/view.h b/app/view/view.h index 5ab7b7a9a..0151a4d84 100644 --- a/app/view/view.h +++ b/app/view/view.h @@ -58,10 +58,6 @@ namespace Latte { class Corona; class Interfaces; class GenericLayout; - -namespace ViewPart { -class ContextMenu; -} } namespace Latte { @@ -241,7 +237,6 @@ public: virtual Latte::Data::View data() const; ViewPart::Effects *effects() const; - ViewPart::ContextMenu *contextMenu() const; ViewPart::ContainmentInterface *extendedInterface() const; virtual ViewPart::Indicator *indicator() const; ViewPart::Parabolic *parabolic() const; @@ -448,7 +443,6 @@ private: QPointer m_appletConfigView; QPointer m_primaryConfigView; - QPointer m_contextMenu; QPointer m_effects; QPointer m_indicator; QPointer m_interface; diff --git a/shell/package/contents/configuration/CanvasConfiguration.qml b/shell/package/contents/configuration/CanvasConfiguration.qml index 2d66fce94..4643bab77 100644 --- a/shell/package/contents/configuration/CanvasConfiguration.qml +++ b/shell/package/contents/configuration/CanvasConfiguration.qml @@ -9,6 +9,7 @@ import QtGraphicalEffects 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.latte.private.app 0.1 as LatteApp import org.kde.latte.core 0.2 as LatteCore import org.kde.latte.private.containment 0.1 as LatteContainment @@ -82,6 +83,12 @@ Loader { } } + LatteApp.ContextMenuLayer { + id: contextMenuLayer + anchors.fill: parent + view: latteView + } + MouseArea { id: editBackMouseArea anchors.fill: imageTiler