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
This commit is contained in:
Vlad Zahorodnii 2024-06-27 16:05:17 +03:00
parent 8f35a9ea8d
commit a9377db1a9

View file

@ -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) {