clipboard: Try the mimetype first
authorMatthias Clasen <mclasen@redhat.com>
Wed, 3 May 2017 21:08:29 +0000 (17:08 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 3 May 2017 22:49:45 +0000 (18:49 -0400)
Try text/plain;charset=utf-8 first, before falling back to
X11-isms like UTF8_TEXT. This makes things work on Wayland
compositors that don't carry a heavy X11 legacy around.

https://bugzilla.gnome.org/show_bug.cgi?id=781814

gtk/gtkclipboard.c

index 06a8a39f93dc826e91818c932694b8fcd1e1f0fa..7de4f600994b5023d01908cd65da4983a7df1db0 100644 (file)
@@ -1042,7 +1042,14 @@ request_text_received_func (GtkClipboard     *clipboard,
        */
       GdkAtom target = gtk_selection_data_get_target (selection_data);
 
-      if (target == gdk_atom_intern_static_string ("UTF8_STRING"))
+      if (target == gdk_atom_intern_static_string ("text/plain;charset=utf-8"))
+        {
+          gtk_clipboard_request_contents (clipboard,
+                                          gdk_atom_intern_static_string ("UTF8_TEXT"),
+                                          request_text_received_func, info);
+          return;
+        }
+      else if (target == gdk_atom_intern_static_string ("UTF8_STRING"))
        {
          gtk_clipboard_request_contents (clipboard,
                                          gdk_atom_intern_static_string ("COMPOUND_TEXT"), 
@@ -1093,7 +1100,7 @@ gtk_clipboard_request_text (GtkClipboard                *clipboard,
   info->callback = callback;
   info->user_data = user_data;
 
-  gtk_clipboard_request_contents (clipboard, gdk_atom_intern_static_string ("UTF8_STRING"),
+  gtk_clipboard_request_contents (clipboard, gdk_atom_intern_static_string ("text/plain;charset=utf-8"),
                                  request_text_received_func,
                                  info);
 }