[mutter] wayland: Improve transformation of the UTF8_STRING atom to mimetype
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Improve transformation of the UTF8_STRING atom to mimetype
- Date: Mon, 28 Sep 2015 14:30:48 +0000 (UTC)
commit ebeca983c7f9a847e3041db18e011e5cbe4fa44e
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Sep 28 14:27:10 2015 +0200
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.
src/wayland/meta-xwayland-selection.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/wayland/meta-xwayland-selection.c b/src/wayland/meta-xwayland-selection.c
index 1728a58..efc450b 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]