Allow pterm to receive selections in compound text format. Doesn't
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 13 May 2003 18:43:30 +0000 (18:43 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 13 May 2003 18:43:30 +0000 (18:43 +0000)
actually _understand_ compound text yet - anything with
non-ASCII-or-8859-1 characters will fail miserably - but it will at
least successfully receive plain text if the pasting application
doesn't see fit to give it out in any other format.

git-svn-id: svn://svn.tartarus.org/sgt/putty@3192 cda61777-01e9-0310-a592-d414129be87e

unix/pterm.c

index 8b6cd22..284b5a7 100644 (file)
@@ -1453,7 +1453,17 @@ void selection_received(GtkWidget *widget, GtkSelectionData *seldata,
 
     if (seldata->target == utf8_string_atom && seldata->length <= 0) {
        /*
-        * Failed to get a UTF-8 selection string. Try an ordinary
+        * Failed to get a UTF-8 selection string. Try compound
+        * text next.
+        */
+       gtk_selection_convert(inst->area, GDK_SELECTION_PRIMARY,
+                             compound_text_atom, GDK_CURRENT_TIME);
+       return;
+    }
+
+    if (seldata->target == compound_text_atom && seldata->length <= 0) {
+       /*
+        * Failed to get UTF-8 or compound text. Try an ordinary
         * string.
         */
        gtk_selection_convert(inst->area, GDK_SELECTION_PRIMARY,
@@ -1466,6 +1476,7 @@ void selection_received(GtkWidget *widget, GtkSelectionData *seldata,
      */
     if (seldata->length <= 0 ||
        (seldata->type != GDK_SELECTION_TYPE_STRING &&
+        seldata->type != compound_text_atom &&
         seldata->type != utf8_string_atom))
        return;                        /* Nothing happens. */