changeset 95313:42018959645c

(x_reply_selection_request): Properly handle format == 32. Always send multiples of format size.
author Andreas Schwab <schwab@suse.de>
date Mon, 26 May 2008 12:03:03 +0000
parents a9b4031fa99f
children 325b3c8ac762
files src/ChangeLog src/xselect.c
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon May 26 11:37:42 2008 +0000
+++ b/src/ChangeLog	Mon May 26 12:03:03 2008 +0000
@@ -1,5 +1,8 @@
 2008-05-26  Andreas Schwab  <schwab@suse.de>
 
+	* xselect.c (x_reply_selection_request): Properly handle format ==
+	32.  Always send multiples of format size.
+
 	* xterm.c (x_set_frame_alpha): Fix type mismatch.
 
 2008-05-26  Jason Rumney  <jasonr@gnu.org>
--- a/src/xselect.c	Mon May 26 11:37:42 2008 +0000
+++ b/src/xselect.c	Mon May 26 12:03:03 2008 +0000
@@ -808,7 +808,7 @@
 	{
           int i = ((bytes_remaining < max_bytes)
                    ? bytes_remaining
-                   : max_bytes);
+                   : max_bytes) / format_bytes;
 
 	  BLOCK_INPUT;
 
@@ -816,15 +816,18 @@
 	    = expect_property_change (display, window, reply.property,
 				      PropertyDelete);
 
-	  TRACE1 ("Sending increment of %d bytes", i);
+	  TRACE1 ("Sending increment of %d elements", i);
 	  TRACE1 ("Set %s to increment data",
 		  XGetAtomName (display, reply.property));
 
 	  /* Append the next chunk of data to the property.  */
 	  XChangeProperty (display, window, reply.property, type, format,
-			   PropModeAppend, data, i / format_bytes);
-	  bytes_remaining -= i;
-	  data += i;
+			   PropModeAppend, data, i);
+	  bytes_remaining -= i * format_bytes;
+	  if (format == 32)
+	    data += i * sizeof (long);
+	  else
+	    data += i * format_bytes;
 	  XFlush (display);
 	  had_errors = x_had_errors_p (display);
 	  UNBLOCK_INPUT;