x11: Map mimetypes back to selection atoms

This may be seen as the missing half of
https://gitlab.gnome.org/GNOME/mutter/merge_requests/842. Now that we
translate some atoms to better known mimetypes, we should also translate
those mimetypes to the underlying atoms if we might have added them.

Fixes c&p from certain X11 clients.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/854
This commit is contained in:
Carlos Garnacho 2019-10-12 19:15:11 +02:00
parent e1751ad9ee
commit 5c1be2233d

View File

@ -82,6 +82,15 @@ meta_selection_source_x11_read_async (MetaSelectionSource *source,
task = g_task_new (source, cancellable, callback, user_data);
g_task_set_source_tag (task, meta_selection_source_x11_read_async);
if (strcmp (mimetype, "text/plain") == 0 &&
g_list_find_custom (source_x11->mimetypes, "STRING",
(GCompareFunc) g_strcmp0))
mimetype = "STRING";
else if (strcmp (mimetype, "text/plain;charset=utf-8") == 0 &&
g_list_find_custom (source_x11->mimetypes, "UTF8_STRING",
(GCompareFunc) g_strcmp0))
mimetype = "UTF8_STRING";
meta_x11_selection_input_stream_new_async (source_x11->x11_display,
source_x11->x11_display->selection.xwindow,
gdk_x11_get_xatom_name (source_x11->xselection),