From a9377db1a903616f021fe5424a403600be25b545 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 27 Jun 2024 16:05:17 +0300 Subject: [PATCH] plugins/kdecoration: Fix MenuButton not accepting button press events If two mouse areas are stacked on top of each other and a button press event is sent so one of them accepts it, QMouseEvent::isAccepted() will still return false. It's a QtQuick bug, see the associated upstream bug report https://bugreports.qt.io/browse/QTBUG-126733. On the other hand, given that the MenuButton implements its own input handling, we can port it away from DecorationButton to mitigate the issue. BUG: 488993 --- .../kdecorations/aurorae/src/qml/MenuButton.qml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/kdecorations/aurorae/src/qml/MenuButton.qml b/src/plugins/kdecorations/aurorae/src/qml/MenuButton.qml index 4b59757ffe..f1bd7eb8b2 100644 --- a/src/plugins/kdecorations/aurorae/src/qml/MenuButton.qml +++ b/src/plugins/kdecorations/aurorae/src/qml/MenuButton.qml @@ -7,10 +7,14 @@ import QtQuick import org.kde.kwin.decoration import org.kde.kirigami 2.20 as Kirigami -DecorationButton { - property bool closeOnDoubleClick: decorationSettings.closeOnDoubleClickOnMenu +Item { id: menuButton - buttonType: DecorationOptions.DecorationButtonMenu + property int buttonType: DecorationOptions.DecorationButtonMenu + property bool hovered: false + property bool pressed: false + property bool toggled: false + property bool closeOnDoubleClick: decorationSettings.closeOnDoubleClickOnMenu + Kirigami.Icon { anchors.fill: parent source: decoration.client.icon @@ -53,7 +57,7 @@ DecorationButton { } parent.pressed = false; } - onClicked: { + onClicked: (mouse) => { // for right clicks we show the menu instantly // and if the option is disabled we always show menu directly if (!menuButton.closeOnDoubleClick || mouse.button == Qt.RightButton) {