plasma5-workspace/0001-Fix-left-click-on-item-in-panel-being-ignored.patch

73 lines
2.9 KiB
Diff

From 1390b40b399770e7a67da714c74d172eee1bb433 Mon Sep 17 00:00:00 2001
From: Anthony Fieroni <bvbfan@abv.bg>
Date: Tue, 15 Dec 2015 12:49:39 +0000
Subject: [PATCH 1/2] Fix left click on item in panel being ignored
Last patch has a reggression due to QtQuick issue (only on Xcb):
QEvent::Leave is triggered after QEvent::MouseButtonPress Qt::LeftButton
BUG: 354651
REVIEW: 126331
---
shell/panelview.cpp | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/shell/panelview.cpp b/shell/panelview.cpp
index 28faac44350ccc0ab6a4246045795ba99c7a6ea8..893def0ced7297271d03dd27f40f8f6599a2354f 100644
--- a/shell/panelview.cpp
+++ b/shell/panelview.cpp
@@ -748,7 +748,6 @@ bool PanelView::event(QEvent *e)
* on the mouse edge, forward the click in the containment boundaries
*/
switch (e->type()) {
- case QEvent::Enter:
case QEvent::MouseMove:
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease: {
@@ -756,7 +755,7 @@ bool PanelView::event(QEvent *e)
//first, don't mess with position if the cursor is actually outside the view:
//somebody is doing a click and drag that must not break when the cursor i outside
- if (geometry().contains(me->screenPos().toPoint())) {
+ if (geometry().contains(QCursor::pos())) {
if (!containmentContainsPosition(me->windowPos())) {
auto me2 = new QMouseEvent(me->type(),
positionAdjustedForContainment(me->windowPos()),
@@ -767,25 +766,19 @@ bool PanelView::event(QEvent *e)
QCoreApplication::postEvent(this, me2);
return true;
}
- }
- break;
- }
- case QEvent::Leave: {
- QMouseEvent *me = static_cast<QMouseEvent *>(e);
- // don't forget to trigger QEvent::Leave if current mouse position is outside the panel
- if (!geometry().contains(me->screenPos().toPoint())) {
- auto me2 = new QMouseEvent(QEvent::Leave,
- positionAdjustedForContainment(me->windowPos()),
- positionAdjustedForContainment(me->windowPos()),
- positionAdjustedForContainment(me->windowPos()) + position(),
- me->button(), me->buttons(), me->modifiers());
-
- QCoreApplication::postEvent(this, me2);
+ } else {
+ // discard event if current mouse position is outside the panel
return true;
}
break;
}
+ case QEvent::Enter:
+ case QEvent::Leave:
+ // QtQuick < 5.6 issue:
+ // QEvent::Leave is triggered on MouseButtonPress Qt::LeftButton
+ break;
+
case QEvent::Wheel: {
QWheelEvent *we = static_cast<QWheelEvent *>(e);
--
2.6.2