From a367fc77bc1bf61f14b3cb29dbd86887b02d7636 Mon Sep 17 00:00:00 2001 From: the-snowwhite Date: Tue, 7 Nov 2023 07:40:39 +0100 Subject: [PATCH] Fix #851 Add text/plain;charset=utf-8 to TextTransfer() enables paste from KDE/QT apps in a wayland session. --- .../gtk/org/eclipse/swt/dnd/TextTransfer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java index 16b38fd6586..2e85db28897 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java @@ -42,9 +42,11 @@ public class TextTransfer extends ByteArrayTransfer { private static final String COMPOUND_TEXT = "COMPOUND_TEXT"; //$NON-NLS-1$ private static final String UTF8_STRING = "UTF8_STRING"; //$NON-NLS-1$ private static final String STRING = "STRING"; //$NON-NLS-1$ + private static final String TEXTPLAINUTF8 = "text/plain;charset=utf-8"; //RFC-1341 private static final int COMPOUND_TEXT_ID = GTK.GTK4 ? 0 : registerType(COMPOUND_TEXT); private static final int UTF8_STRING_ID = GTK.GTK4 ? 0 : registerType(UTF8_STRING); private static final int STRING_ID = GTK.GTK4 ? 0 : registerType(STRING); + private static final int TEXTPLAINUTF8_ID = GTK.GTK4 ? 0 : registerType(TEXTPLAINUTF8); private TextTransfer() {} @@ -145,7 +147,7 @@ protected int[] getTypeIds() { if(GTK.GTK4) { return new int[] {(int) OS.G_TYPE_STRING()}; } - return new int[] {UTF8_STRING_ID, STRING_ID}; + return new int[] {UTF8_STRING_ID, STRING_ID, TEXTPLAINUTF8_ID}; } @Override @@ -157,7 +159,7 @@ protected String[] getTypeNames() { return new String[] {"text/plain", STRING}; } - return new String[] {UTF8_STRING, STRING}; + return new String[] {UTF8_STRING, STRING, TEXTPLAINUTF8}; } boolean checkText(Object object) {