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