[Spice-commits] Branch '0.8' - 2 commits - client/x11
Hans de Goede
jwrdegoede at kemper.freedesktop.org
Wed Mar 23 09:47:17 PDT 2011
client/x11/platform.cpp | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
New commits:
commit 6696914bd91c9e76335af14cd30edbe134088da2
Author: Hans de Goede <hdegoede at redhat.com>
Date: Wed Mar 23 17:16:21 2011 +0100
spicec-x11: Work around a bug in xsel
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.
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));
commit 69067b14e06e2b3043360f7234051e3ad8940f44
Author: Hans de Goede <hdegoede at redhat.com>
Date: Wed Mar 23 17:07:54 2011 +0100
spicec-x11: Don't crash on apps sending bad atoms as TARGETS
Some apps (bad xsel, bad!) send invalid Atoms in their TARGETS property,
causing spicec to exit because of an XError. This patch makes spicec survive
this scenario.
For more info on the xsel bug, see:
https://bugzilla.redhat.com/show_bug.cgi?id=690214
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 48d5a52..9fff947 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -180,6 +180,18 @@ public:
static DefaultClipboardListener default_clipboard_listener;
static Platform::ClipboardListener* clipboard_listener = &default_clipboard_listener;
+static void handle_x_errors_start(void)
+{
+ handle_x_error = True;
+ x_error_code = 0;
+}
+
+static int handle_x_errors_stop(void)
+{
+ handle_x_error = False;
+ return x_error_code;
+}
+
static const char *atom_name(Atom atom)
{
const char *name;
@@ -188,7 +200,11 @@ static const char *atom_name(Atom atom)
return "None";
XLockDisplay(x_display);
+ handle_x_errors_start();
name = XGetAtomName(x_display, atom);
+ if (handle_x_errors_stop()) {
+ name = "Bad Atom";
+ }
XUnlockDisplay(x_display);
return name;
@@ -317,18 +333,6 @@ Display* XPlatform::get_display()
return x_display;
}
-static void handle_x_errors_start(void)
-{
- handle_x_error = True;
- x_error_code = 0;
-}
-
-static int handle_x_errors_stop(void)
-{
- handle_x_error = False;
- return x_error_code;
-}
-
bool XPlatform::is_x_shm_avail()
{
return x_shm_avail;
More information about the Spice-commits
mailing list