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:
parent
8f35a9ea8d
commit
a9377db1a9
1 changed files with 8 additions and 4 deletions
|
@ -7,10 +7,14 @@ import QtQuick
|
||||||
import org.kde.kwin.decoration
|
import org.kde.kwin.decoration
|
||||||
import org.kde.kirigami 2.20 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
|
|
||||||
DecorationButton {
|
Item {
|
||||||
property bool closeOnDoubleClick: decorationSettings.closeOnDoubleClickOnMenu
|
|
||||||
id: menuButton
|
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 {
|
Kirigami.Icon {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: decoration.client.icon
|
source: decoration.client.icon
|
||||||
|
@ -53,7 +57,7 @@ DecorationButton {
|
||||||
}
|
}
|
||||||
parent.pressed = false;
|
parent.pressed = false;
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: (mouse) => {
|
||||||
// for right clicks we show the menu instantly
|
// for right clicks we show the menu instantly
|
||||||
// and if the option is disabled we always show menu directly
|
// and if the option is disabled we always show menu directly
|
||||||
if (!menuButton.closeOnDoubleClick || mouse.button == Qt.RightButton) {
|
if (!menuButton.closeOnDoubleClick || mouse.button == Qt.RightButton) {
|
||||||
|
|
Loading…
Reference in a new issue