]> git.eshelyaron.com Git - emacs.git/commitdiff
* xselect.c (x_fill_property_data): Handle negative XCDR when data
authorJan Djärv <jan.h.d@swipnet.se>
Sun, 7 Sep 2014 17:31:39 +0000 (19:31 +0200)
committerJan Djärv <jan.h.d@swipnet.se>
Sun, 7 Sep 2014 17:31:39 +0000 (19:31 +0200)
is CONSP.

Fixes: debbugs:18303
src/ChangeLog
src/xselect.c

index acb8eed47227849f6a124b0de2b5232385782ac1..ef130f8217ef6b10e3f62a7874e6d55644d40954 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-07  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xselect.c (x_fill_property_data): Handle negative XCDR when data
+       is CONSP (Bug#18303).
+
 2014-09-07  Eli Zaretskii  <eliz@gnu.org>
 
        * callproc.c (child_setup) [WINDOWSNT]: Don't call exec_failed if
index 23310b0f86713b5e81bb556fd21546bf0d7136ac..ed359849be41ab38353d188c17a402aa897bb441 100644 (file)
@@ -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 ();