summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbclipboard.cpp
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@digia.com>2012-10-03 14:53:33 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-13 05:51:19 +0200
commitce81da52ea1fffa67188e19eb9dbba66501dd82f (patch)
tree579c8ba02a35252b69b39296cfe79c283e5c1953 /src/plugins/platforms/xcb/qxcbclipboard.cpp
parentbefea1d93285bdf2ea8134718fb9c74a89bc551e (diff)
Make sure timestamp is initialized before using it for seting selection owner.
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>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbclipboard.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index f021ab8b4a..142a8dfcde 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -300,6 +300,9 @@ void QXcbClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
m_timestamp[mode] = XCB_CURRENT_TIME;
}
+ if (connection()->time() == XCB_CURRENT_TIME)
+ connection()->setTime(connection()->getTimestamp());
+
if (data) {
newOwner = owner();