summaryrefslogtreecommitdiff
path: root/src/xselect.c
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2014-09-07 19:31:39 +0200
committerJan Djärv <jan.h.d@swipnet.se>2014-09-07 19:31:39 +0200
commiteee8ec84426af080d82f37ab0280bd96ae6091bd (patch)
tree14fa3172984bd3c441eb68c156ceb1c6c94cd4e8 /src/xselect.c
parent970d21e8e6aa7e5bafd3f025f66d694b5ae06ba5 (diff)
downloademacs-eee8ec84426af080d82f37ab0280bd96ae6091bd.tar.gz
* xselect.c (x_fill_property_data): Handle negative XCDR when data
is CONSP. Fixes: debbugs:18303
Diffstat (limited to 'src/xselect.c')
-rw-r--r--src/xselect.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/xselect.c b/src/xselect.c
index 23310b0f867..ed359849be4 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2299,7 +2299,24 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format)
Lisp_Object o = XCAR (iter);
if (INTEGERP (o) || FLOATP (o) || CONSP (o))
- val = cons_to_signed (o, LONG_MIN, LONG_MAX);
+ {
+ if (CONSP (o) && INTEGERP (XCAR (o)) && INTEGERP (XCDR (o)))
+ {
+ intmax_t v1 = XINT (XCAR (o));
+ intmax_t v2 = XINT (XCDR (o));
+ /* cons_to_signed does not handle negative values for v2.
+ For XDnd, v2 might be y of a window, and can be negative.
+ The XDnd spec. is not explicit about negative values,
+ but lets do what it says.
+ */
+ if (v1 < 0 || v2 < 0)
+ val = (v1 << 16) | v2;
+ else
+ val = cons_to_signed (o, LONG_MIN, LONG_MAX);
+ }
+ else
+ val = cons_to_signed (o, LONG_MIN, LONG_MAX);
+ }
else if (STRINGP (o))
{
block_input ();