summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-09-28 14:27:10 +0200
committerCarlos Garnacho <carlosg@gnome.org>2015-09-28 16:22:43 +0200
commitebeca983c7f9a847e3041db18e011e5cbe4fa44e (patch)
tree14bd4799264726d3de100e9a2c07a98e970a13c8
parentcf88675807f15586cdc5544710fdea7067a85fad (diff)
downloadmutter-ebeca983c7f9a847e3041db18e011e5cbe4fa44e.tar.gz
wayland: Improve transformation of the UTF8_STRING atom to mimetype
We try to translate the atom with its corresponding mimetype both back and forth, which actually breaks if the X11 client chose to announce the mimetype atom. To do the translation properly, keep track on whether the source announced the UTF8_STRING atom, and reply back with this only if that happened.
-rw-r--r--src/wayland/meta-xwayland-selection.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/wayland/meta-xwayland-selection.c b/src/wayland/meta-xwayland-selection.c
index 1728a58ad..efc450b45 100644
--- a/src/wayland/meta-xwayland-selection.c
+++ b/src/wayland/meta-xwayland-selection.c
@@ -86,6 +86,7 @@ struct _MetaWaylandDataSourceXWayland
MetaWaylandDataSource parent;
MetaSelectionBridge *selection;
+ guint has_utf8_string_atom : 1;
};
struct _MetaXWaylandSelection {
@@ -704,7 +705,8 @@ meta_x11_source_send (MetaWaylandDataSource *source,
MetaSelectionBridge *selection = source_xwayland->selection;
Atom type_atom;
- if (strcmp (mime_type, "text/plain;charset=utf-8") == 0)
+ if (source_xwayland->has_utf8_string_atom &&
+ strcmp (mime_type, "text/plain;charset=utf-8") == 0)
type_atom = gdk_x11_get_xatom_by_name ("UTF8_STRING");
else
type_atom = gdk_x11_get_xatom_by_name (mime_type);
@@ -847,6 +849,8 @@ meta_xwayland_data_source_fetch_mimetype_list (MetaWaylandDataSource *source,
Window window,
Atom prop)
{
+ MetaWaylandDataSourceXWayland *source_xwayland =
+ META_WAYLAND_DATA_SOURCE_XWAYLAND (source);
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
gulong nitems_ret, bytes_after_ret, i;
Atom *atoms, type_ret, utf8_string;
@@ -880,10 +884,13 @@ meta_xwayland_data_source_fetch_mimetype_list (MetaWaylandDataSource *source,
const gchar *mime_type;
if (atoms[i] == utf8_string)
- mime_type = "text/plain;charset=utf-8";
- else
- mime_type = gdk_x11_get_xatom_name (atoms[i]);
+ {
+ meta_wayland_data_source_add_mime_type (source,
+ "text/plain;charset=utf-8");
+ source_xwayland->has_utf8_string_atom = TRUE;
+ }
+ mime_type = gdk_x11_get_xatom_name (atoms[i]);
meta_wayland_data_source_add_mime_type (source, mime_type);
}