libqt5-qtbase/fix-drag-and-drop-regression.patch
Dominique Leuenberger 42a9b4e863 Accepting request 283929 from KDE:Qt5
- Fixed qt_instdate generation, so the Qt5Core library doesn't have
  DATE embedded
- Drop fdupes usage as it provides unpredictable results, and fools
  build-compare
- Add libqt5-qtbase-rpmlintrc due to duplicates waste warnings: we
  rather have a few bytes more than to republish same binaries due
  to fdupes
- Added make-qdbusxml2cpp-output-reproducible.patch: don't include
  date/time in the generated include guards; prevents unnecessary
  rebuilds
- Added fix-drag-and-drop-regression.patch from upstream,
  fixes QTBUG-43436

OBS-URL: https://build.opensuse.org/request/show/283929
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=36
2015-02-06 09:19:34 +00:00

125 lines
3.5 KiB
Diff

From: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
Date: Wed, 07 Jan 2015 12:51:38 +0000
Subject: Fix drag and drop regression
X-Git-Url: http://quickgit.kde.org/?p=qt%2Fqtbase.git&a=commitdiff&h=3c21c4581dbd957d9f660dd52d0298ecef1001cb
---
Fix drag and drop regression
Fix regression introduced by e4becdc3d310a0dd1a6d34d0796a52b21dedeb2d
Add QPlatformDrag::ownsDragObject() function, QDragManager can use the
return value of this function to decide if it should take care of deleting
QDrag object or platform plugin will take care of deleting QDrag.
XCB platform plugins uses async dnd data delivery mechanism. It allows
user to drop something and then continue working with the assurance that
the target will get the data regardless of how slow the network connections
are, which means that a source window should preserve QDrag data until
dnd has finished.
Change-Id: I1fbad7380cddec98b756698993dd397409833150
Task-number: QTBUG-43436
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
---
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -134,7 +134,8 @@
QGuiApplicationPrivate::instance()->notifyDragStarted(o);
const Qt::DropAction result = m_platformDrag->drag(m_object);
m_object = 0;
- o->deleteLater();
+ if (!m_platformDrag->ownsDragObject())
+ o->deleteLater();
return result;
}
--- a/src/gui/kernel/qplatformdrag.cpp
+++ b/src/gui/kernel/qplatformdrag.cpp
@@ -241,6 +241,18 @@
return *qt_drag_default_pixmap();
}
+/*!
+ \since 5.4
+ \brief Returns bool indicating whether QPlatformDrag takes ownership
+ and therefore responsibility of deleting the QDrag object passed in
+ from QPlatformDrag::drag. This can be useful on platforms where QDrag
+ object has to be kept around.
+ */
+bool QPlatformDrag::ownsDragObject() const
+{
+ return false;
+}
+
#endif // QT_NO_DRAGANDDROP
QT_END_NAMESPACE
--- a/src/gui/kernel/qplatformdrag.h
+++ b/src/gui/kernel/qplatformdrag.h
@@ -98,6 +98,8 @@
static QPixmap defaultPixmap();
+ virtual bool ownsDragObject() const;
+
private:
QPlatformDragPrivate *d_ptr;
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -999,6 +999,8 @@
if (at != -1) {
Transaction t = transactions.takeAt(at);
+ if (t.drag)
+ t.drag->deleteLater();
// QDragManager *manager = QDragManager::self();
// Window target = current_target;
@@ -1186,6 +1188,11 @@
}
}
+bool QXcbDrag::ownsDragObject() const
+{
+ return true;
+}
+
QXcbDropData::QXcbDropData(QXcbDrag *d)
: QXcbMime(),
drag(d)
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -70,12 +70,11 @@
virtual QMimeData *platformDropData();
-
- void startDrag();
- void cancel();
- void move(const QMouseEvent *me);
- void drop(const QMouseEvent *me);
- void endDrag();
+ void startDrag() Q_DECL_OVERRIDE;
+ void cancel() Q_DECL_OVERRIDE;
+ void move(const QMouseEvent *me) Q_DECL_OVERRIDE;
+ void drop(const QMouseEvent *me) Q_DECL_OVERRIDE;
+ void endDrag() Q_DECL_OVERRIDE;
void handleEnter(QWindow *window, const xcb_client_message_event_t *event);
void handlePosition(QWindow *w, const xcb_client_message_event_t *event);
@@ -87,6 +86,7 @@
void handleFinished(const xcb_client_message_event_t *event);
bool dndEnable(QXcbWindow *win, bool on);
+ bool ownsDragObject() const Q_DECL_OVERRIDE;
void updatePixmap();
xcb_timestamp_t targetTime() { return target_time; }