From: simon Date: Tue, 2 Dec 2008 18:15:49 +0000 (+0000) Subject: Deal correctly (according to the ICCCM) with receiving None as the X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/utils/commitdiff_plain/b06414b887ec63516e7534e1999e2e1c0f4e2d86 Deal correctly (according to the ICCCM) with receiving None as the property atom, where permitted. git-svn-id: svn://svn.tartarus.org/sgt/utils@8369 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/xcopy/xcopy.c b/xcopy/xcopy.c index 90f4ca8..b8e241a 100644 --- a/xcopy/xcopy.c +++ b/xcopy/xcopy.c @@ -426,6 +426,9 @@ Atom convert_sel_outer(Window requestor, Atom target, Atom property) { unsigned char *data; Atom *adata; + if (property == (Atom)None) + return None; /* ICCCM says this isn't allowed */ + /* * Fetch the requestor's window property giving a list of * selection requests. @@ -447,7 +450,9 @@ Atom convert_sel_outer(Window requestor, Atom target, Atom property) { adata = (Atom *)data; for (i = 0; i+1 < nitems; i += 2) { - adata[i+1] = convert_sel_inner(requestor, adata[i], adata[i+1]); + if (adata[i+1] != (Atom)None) /* ICCCM says this isn't allowed */ + adata[i+1] = convert_sel_inner(requestor, adata[i], + adata[i+1]); } XChangeProperty (disp, requestor, property, @@ -458,6 +463,8 @@ Atom convert_sel_outer(Window requestor, Atom target, Atom property) { return property; } else { + if (property == (Atom)None) + property = target; /* ICCCM says this is a sensible default */ return convert_sel_inner(requestor, target, property); } }