qt5-qtbase/0276-QClipboard-Fix-emittin...

41 lines
1.8 KiB
Diff

From 291eba6f8099a0fec8fbd9cf8a1fb67e5c9f4f8d Mon Sep 17 00:00:00 2001
From: Palo Kisa <palo.kisa@gmail.com>
Date: Mon, 7 Nov 2016 18:27:17 +0100
Subject: [PATCH 276/352] QClipboard: Fix emitting changed() in XCB
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>
---
src/plugins/platforms/xcb/qxcbclipboard.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index d44ebae..40abef4 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -723,8 +723,10 @@ void QXcbClipboard::handleXFixesSelectionRequest(xcb_xfixes_selection_notify_eve
if (mode > QClipboard::Selection)
return;
- // here we care only about the xfixes events that come from non Qt processes
- if (event->owner != XCB_NONE && event->owner != owner()) {
+ // Note1: Here we care only about the xfixes events that come from other processes.
+ // Note2: If the QClipboard::clear() is issued, event->owner is XCB_NONE,
+ // so we check selection_timestamp to not handle our own QClipboard::clear().
+ if (event->owner != owner() && event->selection_timestamp > m_timestamp[mode]) {
if (!m_xClipboard[mode]) {
m_xClipboard[mode].reset(new QXcbClipboardMime(mode, this));
} else {
--
2.9.3