File 0001-Correct-the-accept-flag-of-the-event-object-on-DragM.patch of Package kdeclarative
From 4220a1258b8287fc85758aafa05ccac9a610e9ca Mon Sep 17 00:00:00 2001
From: Tranter Madi <trmdi@yandex.com>
Date: Tue, 5 Feb 2019 19:43:48 +0100
Subject: [PATCH] Correct the accept flag of the event object on DragMove
Summary:
- `m_enabled` or `m_temporaryInhibition` could change while DragMove, so we should place `setAccepted()` on top of the function body. Otherwise, the accept flag of `event` could be wrong in the case `m_enabled` or `m_temporaryInhibition` changes while DragMove.
- Don't call `setAccepted(false)` wrongly if `event->pos() == m_oldDragMovePo`
BUG: 396011
Test Plan:
- Drag a file from Dolphin -> Desktop (Desktop containment layout) -> too difficult -> fixed
- Drag an icon on Desktop (Folder view layout) from one place to another one -> too difficult -> fixed
- Add widgets to the Plasma panel -> too difficult -> fixed
- Drag a file from Dolphin -> Desktop (Folder view layout) -> still easy
Reviewers: mart, broulik, #plasma, hein, bruns
Reviewed By: mart, #plasma
Subscribers: fvogt, aacid, bruns, dkorth, ngraham, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D16643
---
src/qmlcontrols/draganddrop/DeclarativeDropArea.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/qmlcontrols/draganddrop/DeclarativeDropArea.cpp b/src/qmlcontrols/draganddrop/DeclarativeDropArea.cpp
index 540d112..2f4a773 100644
--- a/src/qmlcontrols/draganddrop/DeclarativeDropArea.cpp
+++ b/src/qmlcontrols/draganddrop/DeclarativeDropArea.cpp
@@ -89,18 +89,17 @@ void DeclarativeDropArea::dragLeaveEvent(QDragLeaveEvent *event)
void DeclarativeDropArea::dragMoveEvent(QDragMoveEvent *event)
{
if (!m_enabled || m_temporaryInhibition) {
+ event->ignore();
return;
}
-
+ event->accept();
//if the position we export didn't change, don't generate the move event
if (event->pos() == m_oldDragMovePos) {
- event->setAccepted(false);
return;
}
m_oldDragMovePos = event->pos();
DeclarativeDragDropEvent dde(event, this);
- event->accept();
emit dragMove(&dde);
}
--
2.20.1