From 42178a4570849bf808e44b1902c6f86221acc57f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 24 Sep 2022 08:56:50 +0530 Subject: [PATCH] X11: Fix a regression in the previous release that caused pasting from GTK based applications to have extra newlines Fixes #5528 And let me just re-iterate, GNOME/GTK is developed by morons. --- docs/changelog.rst | 5 +++++ glfw/x11_window.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index f9eff9573..26dd10a65 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -35,6 +35,11 @@ mouse anywhere in the current command to move the cursor there. See Detailed list of changes ------------------------------------- +0.26.4 [future] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- X11: Fix a regression in the previous release that caused pasting from GTK based applications to have extra newlines (:iss:`5528`) + 0.26.3 [2022-09-22] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/glfw/x11_window.c b/glfw/x11_window.c index b59455775..6ce1090e8 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -2945,10 +2945,16 @@ _glfwPlatformGetClipboard(GLFWClipboardType clipboard_type, const char* mime_typ return; } size_t count = 0; - atoms[count++] = atom_for_mime(mime_type).atom; if (strcmp(mime_type, "text/plain") == 0) { + // we need to do this because GTK/GNOME is developed by morons + // they convert text/plain to DOS line endings + // https://gitlab.gnome.org/GNOME/gtk/-/issues/2307 + atoms[count++] = atom_for_mime("text/plain;charset=utf-8").atom; atoms[count++] = _glfw.x11.UTF8_STRING; + atoms[count++] = atom_for_mime("text/plain").atom; atoms[count++] = XA_STRING; + } else { + atoms[count++] = atom_for_mime(mime_type).atom; } getSelectionString(which, atoms, count, write_data, object, true); }