9fcb0f8
--- gtk+-1.2.10/gdk/gdkselection.c.ctext	Thu Jul  5 12:41:42 2001
9fcb0f8
+++ gtk+-1.2.10/gdk/gdkselection.c	Thu Jul  5 12:45:25 2001
9fcb0f8
@@ -191,73 +191,6 @@
9fcb0f8
   gdk_send_xevent (requestor, False, NoEventMask, (XEvent*) &xevent);
9fcb0f8
 }
9fcb0f8
 
9fcb0f8
-
9fcb0f8
-/* The output of XmbTextPropertyToTextList may include stuff not valid
9fcb0f8
- * for COMPOUND_TEXT. This routine tries to correct this by:
9fcb0f8
- *
9fcb0f8
- * a) Canonicalizing CR LF and CR to LF
9fcb0f8
- * b) Stripping out all other non-allowed control characters
9fcb0f8
- *
9fcb0f8
- * See the COMPOUND_TEXT spec distributed with X for explanations
9fcb0f8
- * what is allowed.
9fcb0f8
- */
9fcb0f8
-static gchar *
9fcb0f8
-sanitize_ctext (const char *str,
9fcb0f8
-		gint       *length)
9fcb0f8
-{
9fcb0f8
-  gchar *result = g_malloc (*length + 1);
9fcb0f8
-  gint out_length = 0;
9fcb0f8
-  gint i;
9fcb0f8
-  const guchar *ustr = (const guchar *)str;
9fcb0f8
-
9fcb0f8
-  for (i=0; i < *length; i++)
9fcb0f8
-    {
9fcb0f8
-      guchar c = ustr[i];
9fcb0f8
-      
9fcb0f8
-      if (c == '\r')
9fcb0f8
-	{
9fcb0f8
-	  result[out_length++] = '\n';
9fcb0f8
-	  if (i + 1 < *length && ustr[i + 1] == '\n')
9fcb0f8
-	    i++;
9fcb0f8
-	}
9fcb0f8
-      else if (c == 27 /* ESC */)
9fcb0f8
-	{
9fcb0f8
-	  /* Check for "extended segments, which can contain arbitrary
9fcb0f8
-	   * octets. See CTEXT spec, section 6.
9fcb0f8
-	   */
9fcb0f8
-
9fcb0f8
-	  if (i + 5 < *length &&
9fcb0f8
-	      ustr[i + 1] == '%' &&
9fcb0f8
-	      ustr[i + 2] == '/' &&
9fcb0f8
-	      (ustr[i + 3] >= 48 && ustr[i + 3] <= 52) &&
9fcb0f8
-	      ustr[i + 4] >= 128 &&
9fcb0f8
-	      ustr[i + 5] >= 128)
9fcb0f8
-	    {
9fcb0f8
-	      int extra_len = 6 + (ustr[i + 4] - 128) * 128 + ustr[i + 5] - 128;
9fcb0f8
-	      extra_len = MAX (extra_len, *length - i);
9fcb0f8
-
9fcb0f8
-	      memcpy (result + out_length, ustr + i, extra_len);
9fcb0f8
-	      out_length += extra_len;
9fcb0f8
-	      i += extra_len - 1;
9fcb0f8
-	    }
9fcb0f8
-	  else
9fcb0f8
-	    result[out_length++] = c;	    
9fcb0f8
-	}
9fcb0f8
-      else if (c == '\n' || c == '\t' || c == 27 /* ESC */ ||
9fcb0f8
-	       (c >= 32 && c <= 127) ||	/* GL */
9fcb0f8
-	       c == 155 /* CONTROL SEQUENCE INTRODUCER */ ||	
9fcb0f8
-	       (c >= 160 && c <= 255)) /* GR */
9fcb0f8
-	{
9fcb0f8
-	  result[out_length++] = c;
9fcb0f8
-	}
9fcb0f8
-    }
9fcb0f8
-
9fcb0f8
-  result[out_length] = '\0';
9fcb0f8
-  *length = out_length;
9fcb0f8
-  
9fcb0f8
-  return result;
9fcb0f8
-}
9fcb0f8
-
9fcb0f8
 gint
9fcb0f8
 gdk_text_property_to_text_list (GdkAtom encoding, gint format, 
9fcb0f8
 				guchar *text, gint length,
9fcb0f8
@@ -266,32 +199,16 @@
9fcb0f8
   XTextProperty property;
9fcb0f8
   gint count = 0;
9fcb0f8
   gint res;
9fcb0f8
-  gchar *sanitized_text = NULL;
9fcb0f8
 
9fcb0f8
   if (!list) 
9fcb0f8
     return 0;
9fcb0f8
 
9fcb0f8
   property.encoding = encoding;
9fcb0f8
   property.format = format;
9fcb0f8
-
9fcb0f8
-  if (encoding == gdk_atom_intern ("COMPOUND_TEXT", FALSE) && format == 8)
9fcb0f8
-    {
9fcb0f8
-      gint sanitized_text_length = length;
9fcb0f8
-      
9fcb0f8
-      property.value = sanitized_text = sanitize_ctext (text, &sanitized_text_length);
9fcb0f8
-      property.nitems = sanitized_text_length;
9fcb0f8
-    }
9fcb0f8
-  else
9fcb0f8
-    {
9fcb0f8
-      property.value = text;
9fcb0f8
-      property.nitems = length;
9fcb0f8
-    }
9fcb0f8
-  
9fcb0f8
+  property.value = text;
9fcb0f8
+  property.nitems = length;
9fcb0f8
   res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count);
9fcb0f8
 
9fcb0f8
-  if (sanitized_text)
9fcb0f8
-    g_free (sanitized_text);
9fcb0f8
-
9fcb0f8
   if (res == XNoMemory || res == XLocaleNotSupported || 
9fcb0f8
       res == XConverterNotFound)
9fcb0f8
     return 0;
9fcb0f8
@@ -314,8 +231,6 @@
9fcb0f8
 {
9fcb0f8
   gint res;
9fcb0f8
   XTextProperty property;
9fcb0f8
-  gint sanitized_text_length;
9fcb0f8
-  gchar *sanitized_text;
9fcb0f8
 
9fcb0f8
   res = XmbTextListToTextProperty (GDK_DISPLAY(), 
9fcb0f8
 				   (char **)&str, 1, XCompoundTextStyle,
9fcb0f8
@@ -334,17 +249,10 @@
9fcb0f8
     *encoding = property.encoding;
9fcb0f8
   if (format)
9fcb0f8
     *format = property.format;
9fcb0f8
-
9fcb0f8
-  sanitized_text_length = property.nitems;
9fcb0f8
-  sanitized_text = sanitize_ctext (property.value, &sanitized_text_length);
9fcb0f8
-
9fcb0f8
   if (ctext)
9fcb0f8
-    *ctext = sanitized_text;
9fcb0f8
-  else
9fcb0f8
-    g_free (sanitized_text);
9fcb0f8
-  
9fcb0f8
+    *ctext = g_strdup (property.value);
9fcb0f8
   if (length)
9fcb0f8
-    *length = sanitized_text_length;
9fcb0f8
+    *length = property.nitems;
9fcb0f8
 
9fcb0f8
   if (property.value)
9fcb0f8
     XFree (property.value);