summaryrefslogtreecommitdiffstats
path: root/client/x11/platform.cpp
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-10-03 21:45:45 +0200
committerHans de Goede <hdegoede@redhat.com>2010-10-04 11:49:14 +0200
commitaabca2864d9439bc061feedd8d315b9aaac5c666 (patch)
tree96060fe068e9d46e8029fdb125d5a842badf82c7 /client/x11/platform.cpp
parenta2492d5ae347941b7a5bc13ad5a4de1c006b4ff0 (diff)
downloadspice-aabca2864d9439bc061feedd8d315b9aaac5c666.tar.gz
spice-aabca2864d9439bc061feedd8d315b9aaac5c666.tar.xz
spice-aabca2864d9439bc061feedd8d315b9aaac5c666.zip
spicec-x11: Force processing of ownerchange event when releasing the cb
Make sure we process the XFixesSetSelectionOwnerNotify event caused by us setting the clipboard owner to none, directly after setting the owner to none. Otherwise we may end up changing the clipboard owner to none, after it has already been re-owned because the XFixesSetSelectionOwnerNotify event to owner none is event is still pending when we set the new owner, and then changes the owner back to none once processed messing up our clipboard ownership state tracking. I saw this happening when doing copy twice in succession inside the guest.
Diffstat (limited to 'client/x11/platform.cpp')
-rw-r--r--client/x11/platform.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index ea2558d7..75b34c61 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -3342,5 +3342,18 @@ bool Platform::on_clipboard_request(uint32_t type)
void Platform::on_clipboard_release()
{
+ XEvent event;
+
XSetSelectionOwner(x_display, clipboard_prop, None, CurrentTime);
+ /* Make sure we process the XFixesSetSelectionOwnerNotify event caused
+ by this, so we don't end up changing the clipboard owner to none, after
+ it has already been re-owned because this event is still pending. */
+ XSync(x_display, False);
+ while (XCheckTypedEvent(x_display,
+ XFixesSelectionNotify + xfixes_event_base,
+ &event))
+ root_win_proc(event);
+
+ /* Note no need to do a set_clipboard_owner(owner_none) here, as that is
+ already done by processing the XFixesSetSelectionOwnerNotify event. */
}