summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbdrag.cpp
Commit message (Collapse)AuthorAgeFilesLines
* xcb: QXcbDrag - avoid excessive calls to currentDrag()Tim Blechmann2025-10-061-4/+6
| | | | | | | | | | The code is easier to read/debug when the result of currentDragObject is stored in a local variable. This also avoids going through the singleton initialization code more often than necessary. Pick-to: 6.10 Change-Id: I1bfd31fd0f777ff5fa63b1baef7183495c6f2b81 Reviewed-by: Liang Qi <[email protected]>
* Prefer using namespace Qt::StringLiteralsMarc Mutz2025-10-041-1/+1
| | | | | | | | | | | | | | | | | ... over Qt::Literals::StringLiterals. The latter works, but is needlessly verbose. Since such code is copy'n'pasted, use the preferred form everywhere, to avoid proliferation. The docs have been fixed to suggest the shortcut in a separate commit. As a drive-by, move them to their preferred location, after the QT_BEGIN_NAMESPACE, but only if they were far away to begin with. Pick-to: 6.10 6.8 6.5 Change-Id: I0325f749f3b5a331d9c6af458a9bd3bb70d4aa3b Reviewed-by: Paul Wicking <[email protected]>
* Remove Qt::WindowType::Desktop in QXcbDragAxel Spoerl2025-09-261-45/+7
| | | | | | | | | Qt::WindowType::Desktop is no longer a valid window type in Qt6. Remove its occurence in QXcbDrag. Task-number: QTBUG-140514 Change-Id: I3f2398a1e91cbf77bed6d02e5b4f648975dbdcd5 Reviewed-by: Liang Qi <[email protected]>
* CRA review: plugins/platforms/xcb/*Liang Qi2025-09-251-0/+1
| | | | | | | | | | We trust the OS, so none of this code is security critical. QUIP: 23 Fixes: QTBUG-134565 Pick-to: 6.10 6.8 Change-Id: Ia88b99937b7bf496c703e28d095b8e8b028e2a5a Reviewed-by: Tor Arne Vestbø <[email protected]>
* xcb: mark parameters as unused with QT_NO_CLIPBOARD in QXcbDrag::setActionListMitch Curtis2025-09-031-0/+3
| | | | | | | | | | | | | | | | | | | The build was failing with this error: [...]/qxcbdrag.cpp: In member function ‘void QXcbDrag::setActionList(Qt::DropAction, Qt::DropActions)’: [...]/qxcbdrag.cpp:575:45: error: unused parameter ‘requestedAction’ [-Werror=unused-parameter] 575 | void QXcbDrag::setActionList(Qt::DropAction requestedAction, Qt::DropActions supportedActions) | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ [...]/qxcbdrag.cpp:575:78: error: unused parameter ‘supportedActions’ [-Werror=unused-parameter] 575 | void QXcbDrag::setActionList(Qt::DropAction requestedAction, Qt::DropActions supportedActions) | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors Amends cc1d891b8ed1c4f23183e4b06f46e5840a993e35. Pick-to: 6.5 6.8 6.9 6.10 Change-Id: Ie4c8b425a1f07d062db242f962be3055a0e9db61 Reviewed-by: Liang Qi <[email protected]>
* QXcbDrag: Fix UB (unaligned load) in handleFinished()Marc Mutz2025-03-281-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the XDND spec¹, the window-ID of an XcbFinished message is in xclient.l[0]. That's Xlib terms, though. In xcb terms, it's in xcb_client_message_event_t's data.data32[0]. This is how all QXcbDrag functions handle it (e.g. move()), except handleFinished(), which casts the uint32_t array to a (misaligned) ulong one. ¹ https://www.freedesktop.org/wiki/Specifications/XDND/#index29h3 (the fragment doesn't look like it's stable, it's the section titled "XdndFinished (new in version 2)") Says UBSan: qxcbdrag.cpp:1051:12: runtime error: load of misaligned address 0x60400078ba9c for type 'const long unsigned int', which requires 8 byte alignment 0x60400078ba9c: note: pointer points here c0 01 00 00 28 02 e0 08 01 00 00 00 c8 01 00 00 00 00 00 00 00 00 00 00 93 23 00 00 00 00 00 00 ^ #0 0x7fa3ea3a957c in QXcbDrag::handleFinished(xcb_client_message_event_t const*) qxcbdrag.cpp:1051 #1 0x7fa3e9e20dec in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) qxcbconnection.cpp:607 [...] I have a hard time seeing how it could have worked in big-endian systems. In LE ones, it only works because the high bits of l[0], which come from data32[1], are stripped again when the value is narrowed for passing to findTransactionByWindow(). But the 'if' before _could_ mis-detect a zero xcb_window_t for a non-zero one if data32[1] wasn't empty... To summarize: this is a mess (that's a technical term). Fix by removing the pointless cast, and just read data32[0], like elsewhere in the file. Amends c3f9de62966d32d8e33d62eb374fe2657a4cfebe(!). Pick-to: 6.9 6.8 6.5 5.15 Fixes: QTBUG-127517 Change-Id: Ie7c3718bada52ff82c16f814eee8ec57248fbfbf Reviewed-by: Liang Qi <[email protected]>
* XCB platform plugin: use QBasicTimer instead of storing a timer idAhmad Samir2024-08-311-9/+5
| | | | | Change-Id: Ibd329e17acda73bd892533836b3048c664336fc7 Reviewed-by: Thiago Macieira <[email protected]>
* Remove redundant qtimer.h includesAhmad Samir2024-06-111-1/+0
| | | | | | | | | | | | | | If QTimer isn't used in the file where it's included, remove the include. Fix files that depended on transitive includes. QMacPanGestureRecognizer: drive by change: classes inheriting from QObject should have Q_OBJECT macro in the definition. Change-Id: Ia8d71f4195a1ca643c9fcb14db41877413348d98 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Thiago Macieira <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* xcb: Correctly report whether QInternalMimeData::retrieveData_sys() failsVlad Zahorodnii2024-05-281-9/+10
| | | | | | | | | | | | | | QMimeData::retrieveData() checks whether the returned QVariant value is valid, i.e. the variant contains some data. If the variant contains an empty QByteArray, it will be considered valid. So retrieveData_sys() should return QVariant() in case data with the specified mime type cannot be retrieved. Fixes: QTBUG-125531 Pick-to: 6.7 6.5 6.2 5.15 Change-Id: I0a668ca7ad5b2c5430335e8554cc597747287173 Reviewed-by: Liang Qi <[email protected]>
* xcb: make QXcbWindow inherit QObjectLiang Qi2023-11-161-1/+1
| | | | | | Pick-to: 6.6 6.5 Change-Id: I418305f1e66bdf90b8bda724976916e320012961 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Implement XCB key mapper in terms of QPlatformKeyMapperTor Arne Vestbø2023-10-091-2/+3
| | | | | Change-Id: I81af1200b7b1113062d66a76a185a6d15eab0ba9 Reviewed-by: Liang Qi <[email protected]>
* platform plugins: use string view types moreAnton Kudryavtsev2023-10-081-1/+3
| | | | | | | Change-Id: I793cfff1afca6b98a672615e33a19f8210e429dd Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Liang Qi <[email protected]> Reviewed-by: Mårten Nordheim <[email protected]>
* QObject: implement startTimer(int) in terms of startTimer(chrono)Ahmad Samir2023-03-111-1/+1
| | | | | | | | | | I.e. use chrono first, this means the API isn't limited by the size of int, but by the size of whatever chrono::milliseconds uses (typically int64_t), and chrono units are much more readable as well. Task-number: QTBUG-110059 Change-Id: Ie7f2d90864782361a89866693011803be6f8545e Reviewed-by: Thiago Macieira <[email protected]>
* XCB: do not use reserved identifiersGiuseppe D'Angelo2023-02-071-34/+34
| | | | | | | | | | | Any identifier starting with underscore followed by a capital letter is reserved for the implementation in C++, so don't use them. Rename the entries in the Atom enumeration by adding an "Atom" prefix to them. Pick-to: 6.2 6.4 6.5 Change-Id: I059e2093149f39cc9324cd1159c0d9e076eda93a Reviewed-by: JiDe Zhang <[email protected]> Reviewed-by: Liang Qi <[email protected]>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* xcb: fix D&D in same xembed clientLiang Qi2022-09-011-9/+24
| | | | | | | | | This is kind of porting missing parts QX11Data::xdndHandleDrop() in src/gui/kernel/qdnd_x11.cpp in Qt 4. Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I3a9d657c63dbca43e33262f49484861e60f59b58 Reviewed-by: Liang Qi <[email protected]>
* xcb: use global coordinates for position of D&D for xembed clientLiang Qi2022-09-011-1/+1
| | | | | | Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I4805b764b11b86e2b0975ca45f7182f2719fda74 Reviewed-by: Liang Qi <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: Jörg Bornemann <[email protected]>
* Plugins: replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-05-041-4/+4
| | | | | | | Task-number: QTBUG-98434 Change-Id: If64c294033c114ae46dfc327c40da7f3c7a598f5 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Marc Mutz <[email protected]>
* xcb: remove confusing indirections for qt selection ownerGatis Paeglis2021-10-221-40/+13
| | | | | | | | | | | | | | | | | | | | This makes it more obvious that clipboard and DnD use the same selection owner (QXcbConnection::qtSelectionOwner()). This way we can also drop some QT_NO_CLIPBOARD defines. These defines actually are broken, but that is out-of-scope for this patch. And renamed the functions according to Qt guidelines: getSelectionOwner() -> selectionOwner() getQtSelectionOwner() -> qtSelectionOwner() The previous naming probably was influenced by underlying C API - xcb_get_selection_owner(). Change-Id: I467f1a3dbe75b4e8fd41c7e66ca9b0e25ef1039c Reviewed-by: Liang Qi <[email protected]>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-3/+3
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Friedemann Kleint <[email protected]>
* Cleanup API of QMimeDataLars Knoll2020-09-211-5/+5
| | | | | | | | | | | | | Do not use QVariant::Type anymore, instead use QMetaType For some reason, this pushed the qvariant autotest over the limit where MSVC requires the /bigobj flag, so add that one. [ChangeLog][QtCore][QMimeData] The signature of the virtual retrieveData() function has changed and now takes a QMetaType instead of a QVariant::Type. Change-Id: Ib46773bd731ee2177b1ef74d8162d744be7017ef Reviewed-by: Mårten Nordheim <[email protected]>
* Fix memory sanitizer complaint about uninitialized valueLiang Qi2020-09-041-1/+1
| | | | | | | Fixes: QTBUG-86383 Pick-to: 5.15 Change-Id: Ib2bbe5d8e11574456fdc8b5c5fb07f5e41b538b3 Reviewed-by: Volker Hilsheimer <[email protected]>
* xcb: avoid a usage of invalid reply in qxcbdragLiang Qi2020-08-061-4/+5
| | | | | | | Fixes: QTBUG-83446 Pick-to: 5.15 Change-Id: I1f148c611dcab6cad951ddd934072933fef75452 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Use QList instead of QVector in pluginsJarek Kobus2020-07-061-4/+4
| | | | | | Task-number: QTBUG-84469 Change-Id: Ic86f4a3000592a1c9ae62e4a83f4fe39832a6b24 Reviewed-by: Friedemann Kleint <[email protected]>
* Remove the QTextCodec dependency from the xcb pluginLars Knoll2020-04-241-3/+3
| | | | | Change-Id: Ic9f4cec4aa7270b8d9e16c345d060d7d820319d3 Reviewed-by: Simon Hausmann <[email protected]>
* Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2020-03-241-6/+102
|\ | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbdrag.cpp Change-Id: I0b47324b70b0b4894e54b21aa3e7a5041f9bd5e3
| * xcb: Add support for XdndActionList propertyAlexander Volkov2020-03-231-6/+102
| | | | | | | | | | | | | | | | | | | | This allows to pass and receive possible drop actions from other processes, including GTK applications. Fixes: QTBUG-75744 Change-Id: I944edc6fa00f8801a25912e70eb104a647a9fc0e Reviewed-by: JiDe Zhang <[email protected]> Reviewed-by: Liang Qi <[email protected]>
* | Replace most use of QVariant::type and occurrences of QVariant::TypeOlivier Goffart2020-01-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll <[email protected]>
* | Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-10/+10
| | | | | | | | | | | | | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* | Deprecate constructing QFlags from a pointerAllan Sandfeld Jensen2019-11-201-1/+1
|/ | | | | | | | | This was used to support QFlags f = 0 initialization, but with 0 used as a pointer literal now considered bad form, it had been changed many places to QFlags f = nullptr, which is meaningless and confusing. Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8 Reviewed-by: Thiago Macieira <[email protected]>
* Drag'n'Drop: fix attached Drag object deleted when DnD is progressingYulong Bai2019-10-271-1/+7
| | | | | | | | | | The attached Drag object's owner, i.e. its parent, is also the dragged item. So the attached Drag object will also be destroyed as the dragged item is deleted. Fixes: QTBUG-65701 Change-Id: I39b0a3180f205c427deed5c70cd1912524f9324e Reviewed-by: Shawn Rutledge <[email protected]>
* QHighDpi: Remove fromNativePixels()/toNativePixels() overloadsMorten Johan Sørvig2019-05-221-1/+1
| | | | | | | | | | | | Replace QWindow / QScreen / QPlatformScreen overloads with template functions that take a generic context argument. The API now no longer supports implicit conversions from QPointer<QWindow> to QWindow *, add explicit data() call to usage in qxcbdrag.cpp. Change-Id: I63d7f16f6356873280df58f4e7c924bf0b0eca5b Reviewed-by: Friedemann Kleint <[email protected]>
* xcb: lock-free event processingGatis Paeglis2018-10-141-2/+2
| | | | | | | | | | | | | | | | | For details how this works refer to the documentation in the patch. The follow-up patches will switch to calling processXcbEvents() on every event loop iteration. With the existing code that would mean frequent locking of shared data (event queue). Acquiring a lock is fast, but lock contention isn't. To avoid potential problems, reimplement xcb event processing to be lock-free. Besides theoretical performance benefits, this definitally improves code readability in qxcbconnection.cpp. Thanks to Mikhail Svetkin for questioning the design of the existing code. Done-with: Mikhail Svetkin <[email protected]> Change-Id: I935f2b6ca802580f5c80205aef7b2f9afc172d26 Reviewed-by: Mikhail Svetkin <[email protected]> Reviewed-by: Thiago Macieira <[email protected]>
* xcb: Use functors in QXcbConnection::checkEvent()Gatis Paeglis2018-08-161-8/+6
| | | | | | | | | | | | | | | | | ... to check for buffered events. This makes the code less verbose and easier to read. Changed the filter signature to pass an event type in addition to the actual event, for the convenience of API user. And do not pass worthless nullptr-s to the filter. The only reason why KeyChecker from qxcbkeyboard.cpp was not converted to lambda expression is that the code looks suspicious - KeyChecker::m_release default value is 'true' and I don't see where it would ever be assigned 'false' (ref. QTBUG-69679) and the code is known to be buggy (ref. QTBUG-57335). Those issues are out-of-scope for this patch. Change-Id: If2fdd60fbb93eb983f3c9ad616aaf04834fede9f Reviewed-by: Shawn Rutledge <[email protected]> Reviewed-by: Mikhail Svetkin <[email protected]>
* xcb: Refactor align of xcb eventsMikhail Svetkin2018-07-051-2/+1
| | | | | | | | | Use C++11 alignas instead of a union to pad the xcb_*_event. It allows using the struct directly without accessing a union member. Change-Id: I221a6708ef7af844bd6b71a57dcbab75e1319c72 Reviewed-by: Jesus Fernandez <[email protected]>
* dnd: send DragEnter and DragMove on DnD startGatis Paeglis2018-06-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | This was a regression from Qt4 and also is the documented behavior. In addition this patch fixes various issues with cursor shape updating that were discovered along the way and that are necessary for testing the new changes. The code in QGuiApplicationPrivate::processDrag() also needed a fixup, particularly the resetting of QGuiApplicationPrivate::currentDragWindow. Without this fix we would get DragMove (the one that immediately follows the DragEnter) only for the first DragEnter event. For example when dnd starts on mouse press then for mouse click we would get: <click> DragEnter->DragMove->DragLeave <click> DragEnter->DragLeave but the expected is: <click> DragEnter->DragMove->DragLeave <click> DragEnter->DragMove->DragLeave Task-number: QTBUG-34331 Change-Id: I3cc96c87d1fd5d1342c7f6c9438802ab30076e9e Reviewed-by: Shawn Rutledge <[email protected]>
* xcb: account for misbehaving Unity DnD ManagerGatis Paeglis2018-06-221-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... which may cause dnd data to be lost. As soon as Unity sees that dnd operation has started (it monitors for changes on XdndSelection) it creates an invisible window named XdndCollectionWindowImp that fill entire screen and starts to act as DnD target. Once it has fetched the mime data it moves XdndCollectionWindowImp away without sending any DnD termination events. XdndCollectionWindowImp does not respect the XDnD protocol. Only when its gone we can start a normal dnd operation - looking for real DnD target. We ask windows if they are XdndAware on the initial mouse press and subsequent mouse move events. This patch sets a cursor to Qt::ForbiddenCursor while DnD is interfered by XdndCollectionWindowImp. A user will see the real DnD action (reflected by cursor) only after the next mouse move when XdndCollectionWindowImp has stopped interfering. We also setCanDrop(false) while DnD target is XdndCollectionWindowImp. Temporary seeing ForbiddenCursor is better than losing DnD data. Dropping in this state means that drop will simply be ignored. It is unclear what Unity developers expected DnD source window to do when user releases mouse while XdndCollectionWindowImp is stealing the data. Looking at Unity code, it appears that they were hoping to be quick enough that it would never happen. Task-number: QTBUG-49464 Change-Id: I10880073f6d843572be44fe9a3c4f78194466299 Reviewed-by: Shawn Rutledge <[email protected]>
* xcb: qxcbdrag.cpp cleanupsGatis Paeglis2018-06-221-154/+114
| | | | | | | | | | | | | | | | | | | | | | | | | - moved finding of XdndAware target logic in its own function to reduce size of QXcbDrag::move(). - switched to use categorized logging with more consistent logging messages - added more comments to avoid constatly looking at the specification for the meanings of Xdnd* actions and who sends/receives the action. - removed dead code (findXdndAwareParent), which should have been removed in 269fdbdd2bedda5f5eacb751224d3a3fc3eed5bc when reimplementing this logic in XCB. - removed needless reseting of state variables in various places as this is handled in QXcbDrag::init() on DnD start. - renamed variable in QXcbDrag::dndEnable(): xdnd_widget -> window - and other minor cleanups Change-Id: Ib667f80ceb4c07b7409a90c041044c98665877f3 Reviewed-by: Shawn Rutledge <[email protected]>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-06-071-4/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/kernel/qeventdispatcher_cf.mm src/gui/kernel/qguiapplication_p.h src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/qioseventdispatcher.mm src/plugins/platforms/windows/qwindowsdrag.h src/plugins/platforms/windows/qwindowsinternalmimedata.h src/plugins/platforms/windows/qwindowsmime.cpp src/plugins/platforms/winrt/qwinrtscreen.cpp Change-Id: Ic817f265c2386e83839d2bb9ef7419cb29705246
| * Make sure we can build with -no-feature-draganddropJoerg Bornemann2018-05-291-4/+0
| | | | | | | | | | | | | | | | | | We move QInternalMimeData to a separate file, because this class is used, even if draganddrop is disabled. From now on, include qinternalmimedata_p.h instead of qdnd_p.h for QInternalMimeData. Change-Id: I594e08e2e90d574dc445119091686b4b69e4731b Reviewed-by: Gatis Paeglis <[email protected]>
* | qpa: improve API to support DnDs from other processesGatis Paeglis2018-05-041-14/+23
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... instead of using a hack of directly accessing QGuiApplication members. The current QPA API was bad for two reasons: 1) It expects platform plugin authors to know about internals of Qt Gui, particularly that QGuiApplication uses QGuiApplication::{mouseButtons,keyboardModifiers} to construct QDragMoveEvent and QDropEvent events. Which results in the second reason why this is bad. 2) Platform plugins should not directly access member variables of QGuiApplication, just to make sure that QDragMoveEvent and QDropEvent events contain correct state. Platform plugins should instead use QWindowSystemInterface to communicate with Qt Gui (which is also the solution here). The solution is to extend QWindowSystemInterface::handle{Drag,Drop} to require mouse/keyboard state. We already do this for some of the other methods, so it is nothing extraordinary. This type of interface is also _required_ to support drag-n-drops from other processes. We can't use QGuiApplication::{mouseButtons,keyboardModifiers} when the drag originates from another process, instead we need to query mouse/keyboard state from the system. This patch fixes drag-n-drops from others processes on XCB platform plugin. Task-number: QTBUG-57168 Change-Id: I3f8b0d2f76e9a32ae157622fef801829d629921d Reviewed-by: Mikhail Svetkin <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: Friedemann Kleint <[email protected]>
* Merge remote-tracking branch 'origin/5.10' into devLars Knoll2018-01-021-0/+11
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-12-051-0/+11
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/ios/quiview.mm Change-Id: I88384c70047391c75d9ff166c8d9881ff6751dbf
| | * xcb: Set executed drop action when drop is outside the applicationBłażej Szczygieł2017-11-291-0/+11
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-62815 Change-Id: I13ee1a3a7e9515d827d29ada38bc0d396f4800d7 Reviewed-by: Shawn Rutledge <[email protected]>
* | | Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-3/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: Olivier Goffart (Woboq GmbH) <[email protected]>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-201-1/+1
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qfilesystemengine_win.cpp src/gui/text/qdistancefield.cpp src/plugins/platforms/xcb/qxcbconnection.h Change-Id: I1be4a6f440ccb7599991159e3cb9de60990e4b1e
| * xcb: fix misuse of xcb_send_eventGatis Paeglis2017-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following Valgrind warning: "Syscall param writev(vector[...]) points to uninitialised byte(s) Uninitialised value was created by a stack allocation" The xcb_send_event() requires all events to have 32 bytes. It calls memcpy() on the passed in event. If the passed in event is less than 32 bytes, memcpy() reaches into unrelated memory. And as it turns out, this behavior is actually described in the xcb_send_event function's documentation. This patch adds a macro that declares an event for safe usage with xcb_send_event. Change-Id: Ifcaab5e9a3b52b7f64ac930b423e0c7798bbfedb Done-with: Uli Schlachter Task-number: QTBUG-56518 Reviewed-by: Marc Mutz <[email protected]>
* | Remove QPlatformDrag::platformDropDataAlbert Astals Cid2017-03-131-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: Paul Olav Tvete <[email protected]>
* | xcb: remove code and macros related to Q_XCB_DEBUGGatis Paeglis2017-03-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... early spring-cleaning, leaving one block of virtual root debug code that was inappropriately conditioned on Q_XCB_DEBUG; it now gets its own define. Removed Q_XCB_CALL: 1) I don't know anyone who actually uses it. 2) Enabling this feature (via Q_XCB_DEBUG) fails to build (and has been like that for about 1 year). 3) There are better ways to debug X11 client message exchange (see xtrace for example). 4) Using Q_XCB_CALL is a very fragile approach. Grep for example for xcb_change_property and you will see that half of the calls are not wrapped with the Q_XCB_CALL macro. This patch also removes the Q_XCB_NOOP macro. It's unclear what its purpose was. There was a TODO comment in qxcbeglcontext.h suggesting removal of this macro as well. Its evaluation of its parameter, even without Q_XCB_DEBUG, had no side-effects, so its removal should be harmless. Change-Id: I9fa48af454061d8b38f69f308131647cd18f85f4 Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Alexander Volkov <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>