From 113d3ad9f485661dcd2fd222ad6fee1b43d1c297 Mon Sep 17 00:00:00 2001 From: the-snowwhite Date: Sun, 12 Nov 2023 08:00:42 +0100 Subject: [PATCH 1/4] Enables building by emulating dependabot[bot] The idea is to enable a state that emulates a bugfix patch, after a release cycle ends. If confirmed to work It can be handed over to delivery by dependabot[bot] --- bundles/org.eclipse.swt/META-INF/MANIFEST.MF | 2 +- bundles/org.eclipse.swt/pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF index 10f89ee0b7d..af0d70829a1 100644 --- a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.swt; singleton:=true -Bundle-Version: 3.124.100.qualifier +Bundle-Version: 3.124.101.qualifier Bundle-ManifestVersion: 2 Bundle-Localization: plugin DynamicImport-Package: org.eclipse.swt.accessibility2 diff --git a/bundles/org.eclipse.swt/pom.xml b/bundles/org.eclipse.swt/pom.xml index 2c20a72be1f..def77fedd48 100644 --- a/bundles/org.eclipse.swt/pom.xml +++ b/bundles/org.eclipse.swt/pom.xml @@ -21,7 +21,7 @@ org.eclipse.swt org.eclipse.swt - 3.124.100-SNAPSHOT + 3.124.101-SNAPSHOT eclipse-plugin @@ -29,7 +29,7 @@ forceContextQualifier gets updated during build input process using ant script /bundles/org.eclipse.swt/buildInternal.xml --> - v20230825-1346 + v20231112-1315 Eclipse SWT Accessibility/cocoa,Eclipse SWT Accessibility/common,Eclipse SWT Accessibility/gtk,Eclipse SWT Accessibility/win32,Eclipse SWT AWT/cocoa,Eclipse SWT AWT/common,Eclipse SWT AWT/gtk,Eclipse SWT AWT/win32,Eclipse SWT Browser/cocoa,Eclipse SWT Browser/common,Eclipse SWT Browser/gtk,Eclipse SWT Browser/win32,Eclipse SWT Custom Widgets/common,Eclipse SWT Drag and Drop/cocoa,Eclipse SWT Drag and Drop/common,Eclipse SWT Drag and Drop/gtk,Eclipse SWT Drag and Drop/win32,Eclipse SWT OLE Win32/win32,Eclipse SWT OpenGL/cocoa,Eclipse SWT OpenGL/common,Eclipse SWT OpenGL/glx,Eclipse SWT OpenGL/gtk,Eclipse SWT OpenGL/win32,Eclipse SWT PI/cairo,Eclipse SWT PI/cocoa,Eclipse SWT PI/common,Eclipse SWT PI/gtk,Eclipse SWT PI/win32,Eclipse SWT Printing/cocoa,Eclipse SWT Printing/common,Eclipse SWT Printing/gtk,Eclipse SWT Printing/win32,Eclipse SWT Program/cocoa,Eclipse SWT Program/common,Eclipse SWT Program/gtk,Eclipse SWT Program/win32,Eclipse SWT WebKit/cocoa,Eclipse SWT WebKit/gtk,Eclipse SWT/cairo,Eclipse SWT/cocoa,Eclipse SWT/common,Eclipse SWT/emulated/bidi,Eclipse SWT/emulated/coolbar,Eclipse SWT/emulated/expand,Eclipse SWT/emulated/taskbar,Eclipse SWT/emulated/tooltip,Eclipse SWT/gtk,Eclipse SWT/win32 From 84ee045aaa1eafaa169e7e098a1dbd5bba06eb39 Mon Sep 17 00:00:00 2001 From: the-snowwhite Date: Mon, 6 Nov 2023 01:41:42 +0100 Subject: [PATCH 2/4] Fix #851 and #421 Add text/plain;charset=utf-8 to TextTransfer(). This makes it possible to paste into eclipse from a KDE/QT app in a wayland session with gtkv3.24.33 and higher(ubuntu 22.04-LTS). --- .../gtk/org/eclipse/swt/dnd/TextTransfer.java | 7 +++++-- 1 file changed, 5 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..1122ae611d0 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 @@ -35,6 +35,7 @@ *

* * @see Transfer + * @since 3.124 */ public class TextTransfer extends ByteArrayTransfer { @@ -42,9 +43,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 TEXT_PLAIN_UTF8 = "text/plain;charset=utf-8"; 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 TEXT_PLAIN_UTF8_ID = GTK.GTK4 ? 0 : registerType(TEXT_PLAIN_UTF8); private TextTransfer() {} @@ -145,7 +148,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, TEXT_PLAIN_UTF8_ID}; } @Override @@ -157,7 +160,7 @@ protected String[] getTypeNames() { return new String[] {"text/plain", STRING}; } - return new String[] {UTF8_STRING, STRING}; + return new String[] {UTF8_STRING, STRING, TEXT_PLAIN_UTF8}; } boolean checkText(Object object) { From 937a6326747d956f14a9e4a52ab5a6c554aef395 Mon Sep 17 00:00:00 2001 From: the-snowwhite Date: Tue, 7 Nov 2023 12:58:20 +0100 Subject: [PATCH 3/4] Fix #421 and #851 present the text/plain;charset=utf-8 to the wayland clipboard Enables copy from eclipse to KDE/QT apps in a wayland session(RFC-1341) --- .../org/eclipse/swt/dnd/ClipboardProxy.java | 3 +++ .../gtk/org/eclipse/swt/dnd/TextTransfer.java | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java index fd61b6c8eaa..f53699c77ec 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java @@ -169,6 +169,9 @@ boolean setData(Clipboard owner, Object[] data, Transfer[] dataTypes, int clipbo System.arraycopy(entries, 0, tmp, 0, entries.length); tmp[entries.length] = entry; entries = tmp; + TransferData tdata = new TransferData(); + tdata.type = typeIds[j]; + transfer.javaToNative(data[i], tdata); } } 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 1122ae611d0..616666a927a 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 @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.swt.dnd; +import java.nio.charset.*; + import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; @@ -110,8 +112,29 @@ public void javaToNative (Object object, TransferData transferData) { transferData.pValue = string_target; transferData.result = 1; } + if (transferData.type == TEXTPLAINUTF8_ID) { + // Convert the text into RFC-1341 format + byte[] rfc1341Data = encodeTextAsRFC1341(string); + transferData.format = 8; // Format for UTF-8 + transferData.length = rfc1341Data.length; + transferData.pValue = OS.g_malloc(rfc1341Data.length); + if (transferData.pValue != 0) { + C.memmove(transferData.pValue, rfc1341Data, rfc1341Data.length); + transferData.result = 1; + } + } +} + +// New method to encode text as RFC-1341 +private byte[] encodeTextAsRFC1341(String text) { + // Implement encoding logic here, e.g., adding MIME headers and encoding text + // This is a simplified example; actual encoding depends on RFC-1341 standards +// String rfc1341Text = "Content-Type: " + TEXTPLAINUTF8 + "\r\n\r\n" + text; + String rfc1341Text = text; + return rfc1341Text.getBytes(StandardCharsets.UTF_8); } + /** * This implementation of nativeToJava converts a platform specific * representation of plain text to a java String. From ec94b9ef690d56161efb696c7694fd464cd0a01e Mon Sep 17 00:00:00 2001 From: Andrey Loskutov Date: Fri, 10 Nov 2023 15:10:11 +0100 Subject: [PATCH 4/4] fix: #851 PR 879 Final code cleanup and optimizing. Fix wrong implementation of TEXT_PLAIN_UTF8 transfer feature due to commit 666b7fd8fff95d286d4bf4cabd10649c36a7bbb7 --- .../org/eclipse/swt/dnd/ClipboardProxy.java | 3 --- .../gtk/org/eclipse/swt/dnd/TextTransfer.java | 25 +------------------ 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java index f53699c77ec..fd61b6c8eaa 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java @@ -169,9 +169,6 @@ boolean setData(Clipboard owner, Object[] data, Transfer[] dataTypes, int clipbo System.arraycopy(entries, 0, tmp, 0, entries.length); tmp[entries.length] = entry; entries = tmp; - TransferData tdata = new TransferData(); - tdata.type = typeIds[j]; - transfer.javaToNative(data[i], tdata); } } 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 616666a927a..cf323036dde 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 @@ -13,8 +13,6 @@ *******************************************************************************/ package org.eclipse.swt.dnd; -import java.nio.charset.*; - import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; @@ -93,11 +91,10 @@ public void javaToNative (Object object, TransferData transferData) { transferData.pValue = ctext[0]; transferData.result = 1; } - if (transferData.type == UTF8_STRING_ID) { + if (transferData.type == UTF8_STRING_ID || transferData.type == TEXT_PLAIN_UTF8_ID) { long pValue = OS.g_malloc(utf8.length); if (pValue == 0) return; C.memmove(pValue, utf8, utf8.length); - transferData.type = UTF8_STRING_ID; transferData.format = 8; transferData.length = utf8.length - 1; transferData.pValue = pValue; @@ -112,26 +109,6 @@ public void javaToNative (Object object, TransferData transferData) { transferData.pValue = string_target; transferData.result = 1; } - if (transferData.type == TEXTPLAINUTF8_ID) { - // Convert the text into RFC-1341 format - byte[] rfc1341Data = encodeTextAsRFC1341(string); - transferData.format = 8; // Format for UTF-8 - transferData.length = rfc1341Data.length; - transferData.pValue = OS.g_malloc(rfc1341Data.length); - if (transferData.pValue != 0) { - C.memmove(transferData.pValue, rfc1341Data, rfc1341Data.length); - transferData.result = 1; - } - } -} - -// New method to encode text as RFC-1341 -private byte[] encodeTextAsRFC1341(String text) { - // Implement encoding logic here, e.g., adding MIME headers and encoding text - // This is a simplified example; actual encoding depends on RFC-1341 standards -// String rfc1341Text = "Content-Type: " + TEXTPLAINUTF8 + "\r\n\r\n" + text; - String rfc1341Text = text; - return rfc1341Text.getBytes(StandardCharsets.UTF_8); }