summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbclipboard.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace most use of QVariant::type and occurrences of QVariant::TypeOlivier Goffart2020-01-231-1/+2
| | | | | | | | | | | | | | | | | | | | | 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 <lars.knoll@qt.io>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-11/+11
| | | | | | | | | | | 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 <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* xcb: respect big-request encoding in max request sizeGatis Paeglis2019-02-061-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From big-request specification: "This extension defines a mechanism for extending the length field beyond 16 bits. If the normal 16-bit length field of the protocol request is zero, then an additional 32-bit field containing the actual length (in 4-byte units) is inserted into the request, immediately following the 16-bit length field." Meaning that the request requires 4 additional bytes. This patch provides a convenience API for calculating maximum request data size. Besides fixing QTBUG-73044, it was also discovered that calculations for xcb_image_put (in QXcbBackingStoreImage::flushPixmap) were wrong. The code assumed that xcb_get_maximum_request_length() returns bytes, but what it actually returns is length which is measured in four-byte units. This means that we were sending 4x less bytes than allowed by the protocol. Furthermore, use the actual 'stride' (bytes per line) value when calculating rows_per_put. The new stride value was introduced by 760b2929a3b268e2edf14a561329bdb78fbdc26e, but was not updated in rows_per_put calculations. Fixes: QTBUG-73044 Done-with: JiDe Zhang <zccrs@live.com> Done-with: Mikhail Svetkin <mikhail.svetkin@qt.io> Change-Id: I06beb6082da3e8bc78225a87603914e796fe5878 Reviewed-by: Błażej Szczygieł <spaz16@wp.pl> Reviewed-by: JiDe Zhang <zccrs@live.com> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* xcb: Avoid repaint lags with DnDAlexander Volkov2019-01-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | The lags can be seen when dragged data is requested for a MIME type. This leads to calling QXcbClipboard::waitForClipboardEvent() which runs a loop in the GUI thread and processes events from QXcbEventQueue. The loop ends when a corresponding event is received, otherwise it makes a delay of 50 ms before the next iteration. Sync with QXcbEventQueue thread by QWaitCondition instead of using the delay. This way the loop will end as soon as possible and Expose events will be processed with minimal delay. Task-number: QTBUG-44849 Fixes: QTBUG-55442 Fixes: QTBUG-62344 Fixes: QTBUG-73253 Change-Id: Ie18d63b51a7260c83d53ffe1169b25e5135dd73b Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: free leaking clipboard eventsKirill Burtsev2018-11-281-3/+4
| | | | | | | The leak has been there since the beginnings of Qt 5.0. Change-Id: I238181dcc63cb4cf8a60b5c565b184d8278d0315 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: move clipboard code out of QXcbConnection::processXcbEventsGatis Paeglis2018-10-311-115/+75
| | | | | | | | | | ... to QXcbConnection::handleXcbEvent(), which is where it belongs. This patch amends bc6f5b3ff61f4b1dea14084349702f2895feda66 (Sep, 2013). And some other design cleanups. Change-Id: Iefa0793c58de16a59d2294f38311e1e8dfa3035b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* xcb: lock-free event processingGatis Paeglis2018-10-141-7/+7
| | | | | | | | | | | | | | | | | 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 <mikhail.svetkin@qt.io> Change-Id: I935f2b6ca802580f5c80205aef7b2f9afc172d26 Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* xcb: avoid unnecessary InternAtom requestsGatis Paeglis2018-08-171-1/+1
| | | | | | | | | | | | | QXcbConnection::internAtom() creates the atom if it does not exist. The lifetime of an atom is not tied to the interning client. Atoms remain defined until server reset (lost connection, restart). So create the atom once via QXcbConnection::initializeAllAtoms(), and later fetch the atom value from local array, instead of repeating InternAtom requests. Change-Id: I3cae21895febad6e5daf8c32e72612202baaad64 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: remove unused xcb_icccm.h include from qxcbclipboard.cppGatis Paeglis2018-08-161-4/+0
| | | | | Change-Id: I7afe3bece5f143f6040cf1009d6345c1fe430367 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: remove redudant timeout arg from QXcbClipboard::waitForClipboardEventGatis Paeglis2018-08-161-5/+5
| | | | | | | | ... clipboard_timeout is QXcbClipboard class member, accessible directly from QXcbClipboard::waitForClipboardEvent(). Change-Id: Ibc241d1da4baedc0eaf84063251a1359b1cf4162 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* xcb: Use functors in QXcbConnection::checkEvent()Gatis Paeglis2018-08-161-54/+25
| | | | | | | | | | | | | | | | | ... 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 <shawn.rutledge@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
* Make local symbols of some leaked namesThiago Macieira2018-08-031-0/+2
| | | | | | | | | Unnamed namespaces and static are great tools. Use them. Change-Id: Ie01831ddac5446fdbdeefffd15468b3acb3ced79 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* xcb: Refactor align of xcb eventsMikhail Svetkin2018-07-051-1/+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 <Jesus.Fernandez@qt.io>
* xcb: add static overload for setting window nameGatis Paeglis2018-06-221-23/+4
| | | | | Change-Id: Ib581a582059e196567514f40b1964696ceaf3a88 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Cleanup: Use QThread::msleep to sleep instead of selectMilian Wolff2017-12-191-4/+1
| | | | | | | | | | The old code used select with all-zero parameters and a timeval struct configured to wait for 50ms. This can be drastically simplified by just calling QThread::msleep which makes the intention much more clear. Change-Id: I115b56ae67ae2c2cd03354e16a7bfdf56f8c15b8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* 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
| * Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-131-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/network.pro mkspecs/features/mac/default_post.prf src/corelib/io/qfilesystemengine_win.cpp src/corelib/io/qprocess.cpp src/corelib/io/qprocess.h src/corelib/io/qprocess_p.h src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/corelib/thread/qmutex.cpp src/platformsupport/fontdatabases/windows/windows.pri src/plugins/platforms/eglfs/eglfsdeviceintegration.pro tests/auto/corelib/io/io.pro Change-Id: I8a27e0e141454818bba9c433200a4e84a88d147e
| | * 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 <marc.mutz@kdab.com>
* | | xcb: remove code and macros related to Q_XCB_DEBUGGatis Paeglis2017-03-101-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... 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 <edward.welbourne@qt.io> Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | xcb: Wrap xcb callings in macrosAlexander Volkov2017-02-231-21/+9
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... to improve readability and reliability. This change introduces macros Q_XCB_REPLY and Q_XCB_REPLY_UNCHECKED that allow to replace couples of xcb cookie/reply callings by a single "calling" of a macro. The macros wrap the reply in std::unique_ptr thus preventing the need to free it manually. The following C++11 features are used: - variadic macros - std::unique_ptr - auto type deduction Change-Id: Icf9b93353404a39bf5f4a4562b9234db18cac696 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* / XCB: Use member initializationFriedemann Kleint2017-01-271-5/+0
|/ | | | | | | Shorten or remove constructors accordingly. Change-Id: I9c8bcf512c922c3c72be8a965d9557589bc9874f Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: Replace Q_DECL_OVERRIDE by overrideAlexander Volkov2016-12-011-4/+4
| | | | | | | | We can use 'override' directly since Qt 5.7. Also remove redundant 'virtual' keywords. Change-Id: Ia40be0e1e60e51f9d043ab575fd6b9305ea620b0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-151-2/+4
|\ | | | | | | | | | | | | | | | | Conflicts: configure src/plugins/platforms/eglfs/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp Change-Id: Id2da7c775439adb62646d5b741ee7c638042b34b
| * QClipboard: Fix emitting changed() in XCBPalo Kisa2016-11-141-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In XCB environment the QClipboard::changed() was not delivered if the QClipboard::clear() was issued by other Qt app/process. If the QClipboard::clear() is used, then the owner in xcb_xfixes_selection_notify_event_t is XCB_NONE, so we need make the decission to handle this event by the selection_timestamp and our m_timestamp[mode]. Task-number: QTBUG-56972 Change-Id: If4c486ac02223eac506465cac7ff1a07bd02a187 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-051-5/+7
|\| | | | | | | Change-Id: I34b5e290233d0869fbafac094a939aec2bf83fd5
| * Plug QMimeData leaks in QXcbClipboardMarc Mutz2016-10-021-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QXcbClipboard failed to delete the various QMimeData instances it owns. For m_xClipboard, where the two QXcbClipboardMime instances are never the same, fix the leak by using a scoped instead of a naked pointer. For m_clientClipboard, where the two QMimeData could be identical objects, keep the naked pointers, but delete the objects manually in the QXcbClipboard destructor, paying attention to the case where they're the same object. Change-Id: I5ce0e3e8fcec068aeb344ca806cdf2667378e946 Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* xcb: Use XShape for DnD when a compositing manager is not runningAlexander Volkov2015-10-141-22/+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>
* Handle SelectionWindowDestroy in QXcbClipboardMartin Gräßlin2015-03-271-1/+2
| | | | | | | | | | | | | | This change is related to 6a7ee92b3958e3a3ebc16be15f8bd34217ec7bd2 which added handling for SelectionClientClose. Further testing showed that with e.g. Qt 4 applications the SelectionClientClose is not emitted, but the selection window seems to be destroyed before the client is destroyed. Fur a destroyed selection window the same applies: the clipboard content is no longer valid and we should emit the changed signal. Change-Id: I173e272dbe912084deed5342d7a4adb55ea1974f Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
* QPA plugins: Fix const correctness in old style castsThiago Macieira2015-03-091-2/+2
| | | | | | | | Found with GCC's -Wcast-qual. Change-Id: Ia0aac2f09e9245339951ffff13c946899b4ba15b Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.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>
* QXcbClipboard: don't hold on to the screen pointerSandro Mani2015-02-041-6/+13
| | | | | | | | | | | | Remove the QXcbClipboard::m_screen member variable and make it use connection()->primaryScreen() instead. The clipboard is created in the QXcbConnection constructor, and QXcbClipboard::m_screen was set to the primary screen at the time of construction. If the primary screen later gets disconnected, m_screen ends up pointing to a non-existing screen. Change-Id: I2d23106673d0ba013056d4dbb7078acdf6f9bc7c Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2014-12-181-1/+2
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.h src/platformsupport/platformcompositor/qopenglcompositor.cpp src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I5422868500be695584a496dbbbc719d146bc572d
| * Handle SelectionClientClose in QXcbClipboardMartin Gräßlin2014-12-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | QXcbClipboard listens for subtype SelectionClientClose of Xfixes SelectionNotify event, but doesn't handle it. When the client holding the clipboard selection closes the Clipboard becomes empty and thus the change should be emitted. This fixes downstream KDE Bug #329174. Change-Id: I19fb8cfd7bd3b249c0bc6ca2a724a9aeeb05ac7e Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com> Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
* | Add Q_DECL_OVERRIDE in the src subdirectoryOlivier Goffart2014-12-031-4/+4
|/ | | | | | | | | | Done automatically with clang-modernize on linux (But does not add Q_DECL_OVERRIDE to the function that are marked as inline because it a compilation error with MSVC2010) Change-Id: I2196ee26e3e6fe20816834ecea5ea389eeab3171 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* xcb: Fix getting the primary screen from QXcbConnection::screens()Alexander Volkov2014-10-291-1/+1
| | | | | | | | | | | | | | | | Currently getting QXcbScreen* for primary screen is too messy and it wrongly uses QXcbConnection::primaryScreen() as an index in QXcbConnection::screens() although QXcbConnection::screens() returns the primary screen as the first item in the list since 3c8eb404877df9c967d81fa9df7d718c538fb407. So to clear the API rename primaryScreen() to primaryScreenNumber(), add QXcbConnection::primaryScreen() that returns correct QXcbScreen* and use it directly. Change-Id: Icb7391aa3e82b32ca48f2bda764dcf7ffd89cc47 Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Gabriel de Dietrich2014-09-291-0/+3
|\ | | | | | | | | | | | | | | Conflicts: src/network/socket/qnativesocketengine_unix.cpp src/widgets/kernel/qwidget_qpa.cpp Change-Id: I6f1aa320d5ca66cd92d601a95885aeaab0abb191
| * XCB: fix a possible array overflow leading to a crashGiuseppe D'Angelo2014-09-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The QClipboard::Mode returned from modeForAtom should be checked everywhere because values greater than Selection (i.e. FindBuffer) aren't supported on X and should mean error conditions. The lack of such a check did an out-of-bounds array access, which could lead to a crash. Change-Id: I70f70b5f713ab2f892e258d4df2f7afeb434f0c1 Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.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>
* | xcb: replace inefficient uses of QList with QVectorMarc Mutz2014-02-261-2/+3
|/ | | | | | | | | | xcb atoms are uint32s, so a QList of them wastes 50% memory on 64-bit platforms. Other parts of the code already store xcb_atom_t's in QVector, so use QVector everywhere (also leads to less code expansion). Change-Id: Ib4afb35e499577a7509d04a18b830d9b31f6abd0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* xcb: every window should have a title in debug modeShawn Rutledge2013-10-091-0/+22
| | | | | | | | | | | | Qt creates various invisible windows for internal purposes. Giving them all titles makes the output of tools like xprop and xwininfo more readable, which makes solving certain bugs (like transient-window bugs) easier. Task-number: QTBUG-33644 Change-Id: I9d37b40d3339fb0f81ffeae64949b88ecb655474 Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Fix timing issue in incremental data retrieval mechanismGatis Paeglis2013-09-191-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure that we are not reading wrong PropertyNotify events. From icccm: Requestors may receive a property of type INCR in response to any target that results in selection data. This indicates that the owner will send the actual data incrementally. The selection requestor: - Waits for the SelectionNotify event. - Loops: + Retrieving data using GetProperty with the delete argument True. + Waiting for a PropertyNotify with the state argument NewValue. - Waits until the property named by the PropertyNotify event is zero-length. - Deletes the zero-length property. The issue with the current approach was that after receiving INCR we simply fetched the first PropertyNotify event from the queue, where timestamp indicates that it was generated before INCR, which is not what need. We need PropertyNotify events with a timestamp older than the one on INCR. Task-number: QTBUG-32045 Change-Id: I3b9a006f7d346f67c51e1a296d67a9dc89efadb1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Implement INCR property mechanism for large data transfers [XCB]Gatis Paeglis2013-09-191-4/+126
| | | | | | | Implement INCR property mechanism according to the icccm specification. Change-Id: Ic8f85b71cab825d70ee1b61f29acd09fa4c3e642 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make sure timestamp is initialized before using it for seting selection owner.Gatis Paeglis2012-10-131-0/+3
| | | | | | | | | | | | | | | | | | | | | Convention from icccm: Clients attempting to acquire a selection must set the time value of the xcb_set_selection_owner request to the timestamp of the event triggering the acquisition attempt, not to XCB_CURRENT_TIME. In some cases it happened that timestamp was set to XCB_CURRENT_TIME. A zero-length append to a property is a way to obtain a timestamp for this purpose; the timestamp is in the corresponding XCB_PROPERTY_NOTIFY event. We used to have this mechanism in 4.8, it was achieved by XWindowEvent. AFAIK there isn't an equivalent for XWindowEvent in XCB. Therefore i had to introduce a new mechanism in QXcbConnection - getTimestamp. This function blocks until it receives the requested event. Change-Id: Ide46a4fdd44cf026fdd17a79d3c4b17741d1b7d4 Task-number: QTBUG-26783 Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Retrieve drop data with a proper timestampGatis Paeglis2012-10-021-2/+4
| | | | | | | | | | | Occasionally drag-and-drop was returning empty mimedata due to using wrong value for timestamp. Accoring to the xdnd specification we must use timestamp from XdndPosition or XdndDroptime for retrieving the data. Task-number: QTBUG-27367 Change-Id: Iadb6b6989cfc4e8ab241e2fd0ded59355108f22f Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Don't let mimeData return 0.Gatis Paeglis2012-10-021-12/+25
| | | | | | | | | Fixes bug introduced in SHA e247e2810 (QTBUG-26709). Change-Id: I9aa80239675b2d564d08a019ca267a9aa814074e Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fix mimedata updating and signal emision issues in xcb clipboard.Gatis Paeglis2012-08-021-26/+38
| | | | | | | | | | | | | Clipboard should reacquire the clipboard whenever the content or metadata (e.g the list of supported targets) changes. Patch enables us to monitor changes to the clipboard through help of XFixes extension. Cleanup xlib xa_* naming conventions Task-number: QTBUG-26709 Change-Id: I9d47766ad9859b5628b0358b1c47e8af8fecef73 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Fix badAtom issues introduced by behavior changes between Xlib and xcb.Gatis Paeglis2012-08-021-22/+7
| | | | | | | | | | | | In Xlib, the 'length' variable gets updated with the the actual number of 8-bit, 16-bit, or 32-bit items stored in the returned data, but xcb returns the actual number of bytes read through xcb_get_property_value_length, therefore the logic of calculating offset was broken. Task-number: QTBUG-26709 Change-Id: I04de3b5c5631cfaf9b3c2c3d4513be73c569f61f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>