[Spice-devel] [PATCH spice 2/2] spicec-x11: Work around a bug in xsel

Hans de Goede hdegoede at redhat.com
Wed Mar 23 09:18:51 PDT 2011


Although ICCCM 2.2. Responsibilities of the Selection Owner:
http://tronche.com/gui/x/icccm/sec-2.html#s-2.2

Clearly states (about selection notify events):
The owner should set the specified selection, target, time, and property
arguments to the values received in the SelectionRequest event.

xsel sets the selection notify event target member to the incr atom when it
is going to send the clipboard data incremental, rather then setting it to
the UTF8_STRING atom (which was the target of the SelectionRequest).

Work around this (esp as it is likely other programs may get this wrong too)
and accept the incr atom as a valid target in a selection notify event.

This fixes Alon's test with running:
python -c "print list(range(1000))" | xsel -i -b
on the client.
---
 client/x11/platform.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 9fff947..dbd2b6a 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -2676,7 +2676,9 @@ static void handle_selection_notify(XEvent& event, bool incr)
 
     if (clipboard_request_target == None)
         LOG_INFO("SelectionNotify received without a target");
-    else if (!incr && event.xselection.target != clipboard_request_target)
+    else if (!incr &&
+             event.xselection.target != clipboard_request_target &&
+             event.xselection.target != incr_atom)
         LOG_WARN("Requested %s target got %s",
                  atom_name(clipboard_request_target),
                  atom_name(event.xselection.target));
-- 
1.7.3.2



More information about the Spice-devel mailing list