Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java16
6 files changed, 45 insertions, 2 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 197cc62103..5181782bf9 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
@@ -61,10 +61,18 @@ ClipboardProxy(Display display) {
void clear (Clipboard owner, int clipboards) {
if ((clipboards & DND.CLIPBOARD) != 0 && activeClipboard == owner) {
- GTK.gtk_clipboard_clear(Clipboard.GTKCLIPBOARD);
+ gtk_gdk_clipboard_clear(Clipboard.GTKCLIPBOARD);
}
if ((clipboards & DND.SELECTION_CLIPBOARD) != 0 && activePrimaryClipboard == owner) {
- GTK.gtk_clipboard_clear(Clipboard.GTKPRIMARYCLIPBOARD);
+ gtk_gdk_clipboard_clear(Clipboard.GTKPRIMARYCLIPBOARD);
+ }
+}
+
+void gtk_gdk_clipboard_clear(long clipboard) {
+ if (GTK.GTK4) {
+ GDK.gdk_clipboard_set_content(clipboard, 0);
+ } else {
+ GTK.gtk_clipboard_clear(clipboard);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 36b7018199..fc8e175759 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -368,6 +368,18 @@ JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1cairo_1set_1source_1window)
}
#endif
+#ifndef NO__1gdk_1clipboard_1set_1content
+JNIEXPORT jlong JNICALL GDK_NATIVE(_1gdk_1clipboard_1set_1content)
+ (JNIEnv *env, jclass that, jlong arg0, jlong arg1)
+{
+ jlong rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1clipboard_1set_1content_FUNC);
+ rc = (jlong)gdk_clipboard_set_content((GdkClipboard *)arg0, (GdkContentProvider *)arg1);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1clipboard_1set_1content_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1cursor_1new_1for_1display
JNIEXPORT jlong JNICALL GDK_NATIVE(_1gdk_1cursor_1new_1for_1display)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
index 99b1e5f6b5..98f86dd750 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
@@ -424,6 +424,11 @@
#define NO__1gdk_1surface_1invalidate_1region
#define NO__1gdk_1event_1get_1surface
+// No GdkClipboard on GTK3
+#define NO__1gdk_1clipboard_1set_1content
+#define NO__1gdk_1display_1get_1clipboard
+#define NO__1gdk_1display_1get_1primary_1clipboard
+
// No GtkSnapshot on GTK3
#define NO__1gtk_1snapshot_1append_1cairo
#define NO__1gtk_1widget_1snapshot_1child
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 2960b9cca8..60c364f933 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -49,6 +49,7 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1cairo_1set_1source_1pixbuf",
"_1gdk_1cairo_1set_1source_1rgba",
"_1gdk_1cairo_1set_1source_1window",
+ "_1gdk_1clipboard_1set_1content",
"_1gdk_1cursor_1new_1for_1display",
"_1gdk_1cursor_1new_1from_1name__J_3B",
"_1gdk_1cursor_1new_1from_1name___3BJ",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index dedce921a3..63a4a35b38 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -59,6 +59,7 @@ typedef enum {
_1gdk_1cairo_1set_1source_1pixbuf_FUNC,
_1gdk_1cairo_1set_1source_1rgba_FUNC,
_1gdk_1cairo_1set_1source_1window_FUNC,
+ _1gdk_1clipboard_1set_1content_FUNC,
_1gdk_1cursor_1new_1for_1display_FUNC,
_1gdk_1cursor_1new_1from_1name__J_3B_FUNC,
_1gdk_1cursor_1new_1from_1name___3BJ_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
index bc48b6dd97..62f8fc2ff8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
@@ -775,6 +775,7 @@ public class GDK extends OS {
* @param display cast=(GdkDisplay *)
*/
public static final native long _gdk_display_get_clipboard(long display);
+ /** [GTK4 only, if-def'd in os.h] */
public static final long gdk_display_get_clipboard(long display) {
lock.lock();
try {
@@ -787,6 +788,7 @@ public class GDK extends OS {
* @param display cast=(GdkDisplay *)
*/
public static final native long _gdk_display_get_primary_clipboard(long display);
+ /** [GTK4 only, if-def'd in os.h] */
public static final long gdk_display_get_primary_clipboard(long display) {
lock.lock();
try {
@@ -1911,6 +1913,20 @@ public class GDK extends OS {
}
}
/**
+ * @param clipboard cast=(GdkClipboard *)
+ * @param provider cast=(GdkContentProvider *)
+ */
+ public static final native long _gdk_clipboard_set_content(long clipboard, long provider);
+ /** [GTK4 only, if-def'd in os.h] */
+ public static final long gdk_clipboard_set_content(long clipboard, long provider) {
+ lock.lock();
+ try {
+ return _gdk_clipboard_set_content(clipboard, provider);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
* @method flags=dynamic
* @param screen cast=(GdkScreen *)
* @param monitor_num cast=(gint)

Back to the top