summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qsimpledrag.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-141-4/+26
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/animation/qvariantanimation.cpp src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/corelib/io/qprocess_win.cpp src/corelib/json/qjsonarray.cpp src/corelib/tools/qsimd_p.h src/corelib/tools/qtimezoneprivate_p.h src/corelib/xml/qxmlstream_p.h src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qsimpledrag_p.h src/plugins/generic/generic.pro src/plugins/platforms/cocoa/qcocoamenu.mm src/widgets/styles/qmacstyle_mac.mm tests/auto/concurrent/qtconcurrentmap/BLACKLIST tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qmessagebox/BLACKLIST Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e
| * QSimpleDrag: Fix mouse release coords for delayed event transmissionEike Hein2018-02-011-5/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On platforms such as XCB, the drag cursor pixmap is shown via a window (a QShapedPixmapWindow) under the cursor. The mouse button release event at the end of the drag is received in this QXcbWindow, but intercepted by an event filter that QSimpleDrag installs on the QApplication. It then resends it unmodified(!) after the drag has ended and the drag pixmap window destroyed, causing it to be delivered to the new top-level window. The local coordinates in the unmodified QMouseEvent are local to the drag pixmap window and don't match the window it is delayed-transmitted to. This ends up having fatal, user-visible effects particularly in Qt Quick: QQuickWindow synthesizes a hover event once per frame using the last received mouse coordinates, here: the release posted by QSimpleDrag. This is done to update the hover event state for items under the cursor when the mouse hasn't moved (e.g. QQuickMouseArea:: containsMouse). The bogus event coordinates in the release event then usually end up causing an item near the top-left of the QQuickWindow to assume it is hovered (because drag pixmap windows tend to be small), even when the mouse cursor is actually far away from it at the end of the drag. This shows up e.g. in the Plasma 5 desktop, where dragging an icon on the desktop will cause the icon at the top-left of the screen (if any) to switch to hovered state, as the release coordinates on the drag pixmap window (showing a dragged icon) fall into the geometry of the top-left icon. QSimpleDrag contains a topLevelAt() function to find the top-level window under the global cursor coordinates that is not the drag pixmap window. This is used by the drop event delivery code. This patch uses this function to find the relevant top-level window, then asks it to map the global cusor coordinates to its local coordinate system, then synthesizes a new QMouseEvent with local coordinates computed in this fashion. As a result the window now gets a release event with coordinates that make sense and are correct. Task-number: QTBUG-66103 Change-Id: I04ebe6ccd4a991fdd4b540ff0227973ea8896a9d Reviewed-by: Eike Hein <hein@kde.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-09-261-4/+4
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h src/plugins/platforms/cocoa/qcocoawindow.h src/testlib/qtestsystem.h Change-Id: I5975ffb3261c2dd82fe02ec4e57df7c0950226c5
| * | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-09-061-4/+4
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/qopenglwidget/main.cpp src/3rdparty/pcre2/src/pcre2_printint.c src/plugins/platforms/cocoa/qnsview.mm src/widgets/widgets/qcombobox.cpp Change-Id: I37ced9da1e8056f95851568bcc52cd5dc34f56af
| | * Pass m_drag_icon_window to getNativeMousePos instead of Event QObjectÀlex Fiestas2017-09-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QWindow passed to eventFilter is static so it might be in a different screen when we call getNativeMousePos, resulting in negative position and all sorts of glitches. Change-Id: Ibc848c6d85d8b6932ee379aa77851094212a0db2 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* / Remove QPlatformDrag::platformDropDataAlbert Astals Cid2017-03-131-7/+0
|/ | | | | | | | | | | | Its only uses were: * Call it to just store it in QDragManager::QDragManager * qnsview.mm calls it but since it knows it's a QCocoaDrag it can just call a function of that class directly * qxcbdrag.cpp calls it but since it basically was calling itself can just use the class member directly Change-Id: Ic7797c877d77f944a1212a7ea01173393bf903fe Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Make QSimpleDrag work with highDPI scalingPaul Olav Tvete2017-01-131-8/+29
| | | | | | | | Task-number: QTBUG-57863 Change-Id: I940179a694ce992245dabb77ef6e92e027427524 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-241-2/+3
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/plugins/platforms/windows/qwindowsfontengine.cpp src/plugins/platforms/windows/qwindowsnativeimage.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I649b32b260ce0ed2d6a5089021daa0d6a8db85f7
| * xcb: Fix drag and drop between xcb screensBłażej Szczygieł2016-02-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | Set the proper screen before creating a shaped pixmap window in QBasicDrag::startDrag(). Grab mouse again when D&D window is recreated. Task-number: QTBUG-51215 Change-Id: I5cb47d3b11672b56d17b32072d84a722bdcdcd9a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-231-1/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf configure src/corelib/global/qglobal.h src/tools/qdoc/node.cpp src/tools/qdoc/qdocdatabase.cpp tests/auto/corelib/io/qsettings/tst_qsettings.cpp tools/configure/configureapp.cpp Change-Id: I66028ae5e441a06b73ee85ba72a03a3af3e8593f
| * xcb: Use XShape for DnD when a compositing manager is not runningAlexander Volkov2015-10-141-1/+2
| | | | | | | | | | | | | | | | | | Otherwise transparent areas of the drag'n'drop pixmap are painted with the black color. Task-number: QTBUG-45193 Change-Id: I55b7c7caababe13584fa1c7a52835f112e20f920 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Implement canceling of Qt-initiated drags.Friedemann Kleint2015-10-231-0/+8
|/ | | | | | | | | | | | | | | - Add new virtual QPlatformDrag::cancelDrag() [avoiding a conflict with existing QBasicDrag::cancel()] - Implement on Windows by returning DRAGDROP_S_CANCEL from IOleDropSource::QueryContinueDrag() as suggested on report. - Implement in QBasicDrag by calling QBasicDrag::cancel() and quitting the event loop. - Add new API static void QDrag::cancel() for it. Task-number: QTBUG-47004 Change-Id: I4b4bb52e5fc226c8e04688ac1b0f9550daaf918e Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com> Reviewed-by: David Faure <david.faure@kdab.com>
* xcb: Fix DnD for separate X screensAlexander Volkov2015-10-091-13/+16
| | | | | | | | Recreate QShapedPixmapWindow when the cursor goes to another X screen. Change-Id: Ifd4c4281971b23abc45a9f6c0509832a45c31521 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Deliver mouse press and release events on X11 also when draggingUlf Hermann2015-09-241-3/+3
| | | | | | | | | | | | | | | We generally assume that for every mouse press we also get a mouse release eventually. The event filter installed by QBasicDrag broke this assumption as it didn't take care of filtering mouse press and mouse release events symmetrically. We cannot immediately pass on the release event as that would mean a release event is generated from a press event (via the blocking drag call), which breaks assumptions in other places. Change-Id: If7e48c7dc0ef5265bed4f9a9366a7606ec875d93 Task-number: QTBUG-46361 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
* Fix highdpi drag-n-drop for X11Paul Olav Tvete2015-07-301-15/+32
| | | | | | Task-number: QTBUG-46615 Change-Id: Iad548e62a580d6fbd15b7a826116a53ce23b4b8b Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QShapedPixmapWindow: ensure we set a valid geometryRichard Moe Gustavsen2015-05-061-3/+12
| | | | | | | | | | | | | | | | | | | | | On touch platforms, QCursor::pos() will only be 'valid' when a touch event has (at least once) been translated to a mouse event. Currently this never happens in QtQuick since QtQuick always accepts all touch events and performs its own translations. So rather than setting the geometry of QShapedPixmapWindow from QCursor directly, we instead base it on mouse events. This will ensure that we never try to set the geometry of the window to an 'invalid' value, which can cause a crash on platforms like iOS. Note that we currenly miss an API in Qt to get the current touch points. When that is in place, we can also set a correct start position for the window before the first mouse move event arrives. Task-number: QTBUG-45877 Change-Id: I320598e87d43f6e9e087c204a69b95465128f468 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Fix invocations of static methods of QGuiApplication/QApplication.Friedemann Kleint2015-02-251-4/+4
| | | | | | Change-Id: I99ba58763f6063fa2a6f511adbea0163cce7ea32 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Don't assume a QBasicDrag will start and end over a QWindowTor Arne Vestbø2014-03-041-3/+2
| | | | | | | | | | | | A QBasicDrag is started from QBasicDrag::drag() through the drag manager, which may happen from e.g a widget. The event filter needs to look at events to more than just QWindows, otherwise the filter will miss eg. mouse release events that are sent to QWidget and not to the QWindow handle, and the drag goes on forever, causing invalid internal state when a new drag is then started. Change-Id: I5cee250e2c7552817bda0895d4c5794e12d26592 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Fix crash in QSimpleDrag if drag wasn't started over a QWindowTor Arne Vestbø2014-03-041-2/+3
| | | | | | | | | The code in QSimpleDrag::startDrag() checks for the validity of the current window before passing it on to QWindowSystemInterface::handleDrag(), and so should QSimpleDrag::cancel(). Change-Id: I2228d86ede2a0b8379a55000a5c1d830cab44d45 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Move QBasicDrag and QSimpleDrag to QtGui.Samuel Rødal2013-05-301-0/+366
These are useful as default implementations of QPlatformIntegration::drag(), instead of having it return 0 which will lead to crashes in Qt Quick 2 and widgets applications that use drag and drop. Task-number: QTBUG-31288 Change-Id: I70efa139306ced5d879def0f74e3a72d3bcd64f7 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>