Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java6
6 files changed, 57 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
index 8dbffe1c41..91667cd011 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
@@ -39,10 +39,10 @@ public class Clipboard {
private static long TARGET;
static {
- GTKCLIPBOARD = GTK.gtk_clipboard_get(GDK.GDK_NONE);
+ GTKCLIPBOARD = GTK.GTK4 ? GDK.gdk_display_get_clipboard(GDK.gdk_display_get_default()) : GTK.gtk_clipboard_get (GDK.GDK_NONE);
byte[] buffer = Converter.wcsToMbcs("PRIMARY", true);
long primary = GDK.gdk_atom_intern(buffer, false);
- GTKPRIMARYCLIPBOARD = GTK.gtk_clipboard_get(primary);
+ GTKPRIMARYCLIPBOARD = GTK.GTK4 ? GDK.gdk_display_get_primary_clipboard(GDK.gdk_display_get_default()) : GTK.gtk_clipboard_get(primary);
buffer = Converter.wcsToMbcs("TARGETS", true);
TARGET = GDK.gdk_atom_intern(buffer, false);
}
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 483247a7d2..36b7018199 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
@@ -594,6 +594,18 @@ JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1display_1beep)
}
#endif
+#ifndef NO__1gdk_1display_1get_1clipboard
+JNIEXPORT jlong JNICALL GDK_NATIVE(_1gdk_1display_1get_1clipboard)
+ (JNIEnv *env, jclass that, jlong arg0)
+{
+ jlong rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1display_1get_1clipboard_FUNC);
+ rc = (jlong)gdk_display_get_clipboard((GdkDisplay *)arg0);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1display_1get_1clipboard_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1display_1get_1default
JNIEXPORT jlong JNICALL GDK_NATIVE(_1gdk_1display_1get_1default)
(JNIEnv *env, jclass that)
@@ -762,6 +774,18 @@ JNIEXPORT jint JNICALL GDK_NATIVE(_1gdk_1display_1get_1n_1monitors)
}
#endif
+#ifndef NO__1gdk_1display_1get_1primary_1clipboard
+JNIEXPORT jlong JNICALL GDK_NATIVE(_1gdk_1display_1get_1primary_1clipboard)
+ (JNIEnv *env, jclass that, jlong arg0)
+{
+ jlong rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1display_1get_1primary_1clipboard_FUNC);
+ rc = (jlong)gdk_display_get_primary_clipboard((GdkDisplay *)arg0);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1display_1get_1primary_1clipboard_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1display_1get_1primary_1monitor
JNIEXPORT jlong JNICALL GDK_NATIVE(_1gdk_1display_1get_1primary_1monitor)
(JNIEnv *env, jclass that, jlong arg0)
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 d507b756f3..2960b9cca8 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
@@ -64,6 +64,7 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1device_1warp__JII",
"_1gdk_1device_1warp__JJII",
"_1gdk_1display_1beep",
+ "_1gdk_1display_1get_1clipboard",
"_1gdk_1display_1get_1default",
"_1gdk_1display_1get_1default_1group",
"_1gdk_1display_1get_1default_1seat",
@@ -74,6 +75,7 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1display_1get_1monitor_1at_1surface",
"_1gdk_1display_1get_1monitor_1at_1window",
"_1gdk_1display_1get_1n_1monitors",
+ "_1gdk_1display_1get_1primary_1clipboard",
"_1gdk_1display_1get_1primary_1monitor",
"_1gdk_1display_1is_1composited",
"_1gdk_1display_1peek_1event",
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 b895961cfe..dedce921a3 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
@@ -74,6 +74,7 @@ typedef enum {
_1gdk_1device_1warp__JII_FUNC,
_1gdk_1device_1warp__JJII_FUNC,
_1gdk_1display_1beep_FUNC,
+ _1gdk_1display_1get_1clipboard_FUNC,
_1gdk_1display_1get_1default_FUNC,
_1gdk_1display_1get_1default_1group_FUNC,
_1gdk_1display_1get_1default_1seat_FUNC,
@@ -84,6 +85,7 @@ typedef enum {
_1gdk_1display_1get_1monitor_1at_1surface_FUNC,
_1gdk_1display_1get_1monitor_1at_1window_FUNC,
_1gdk_1display_1get_1n_1monitors_FUNC,
+ _1gdk_1display_1get_1primary_1clipboard_FUNC,
_1gdk_1display_1get_1primary_1monitor_FUNC,
_1gdk_1display_1is_1composited_FUNC,
_1gdk_1display_1peek_1event_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 eacd79a102..bc48b6dd97 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
@@ -772,6 +772,30 @@ public class GDK extends OS {
}
}
/**
+ * @param display cast=(GdkDisplay *)
+ */
+ public static final native long _gdk_display_get_clipboard(long display);
+ public static final long gdk_display_get_clipboard(long display) {
+ lock.lock();
+ try {
+ return _gdk_display_get_clipboard(display);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
+ * @param display cast=(GdkDisplay *)
+ */
+ public static final native long _gdk_display_get_primary_clipboard(long display);
+ public static final long gdk_display_get_primary_clipboard(long display) {
+ lock.lock();
+ try {
+ return _gdk_display_get_primary_clipboard(display);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
* @method flags=dynamic
*/
public static final native long _gdk_display_get_default_seat(long display);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index 984095f5c9..1b52111e33 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -699,7 +699,7 @@ public void copy () {
if ((style & SWT.SINGLE) != 0) {
GTK.gtk_editable_copy_clipboard (handle);
} else {
- long clipboard = GTK.gtk_clipboard_get (GDK.GDK_NONE);
+ long clipboard = GTK.GTK4 ? GDK.gdk_display_get_clipboard(GDK.gdk_display_get_default()) : GTK.gtk_clipboard_get (GDK.GDK_NONE);;
clearSegments (true);
GTK.gtk_text_buffer_copy_clipboard (bufferHandle, clipboard);
applySegments ();
@@ -723,7 +723,7 @@ public void cut () {
if ((style & SWT.SINGLE) != 0) {
GTK.gtk_editable_cut_clipboard (handle);
} else {
- long clipboard = GTK.gtk_clipboard_get (GDK.GDK_NONE);
+ long clipboard = GTK.GTK4 ? GDK.gdk_display_get_clipboard(GDK.gdk_display_get_default()) : GTK.gtk_clipboard_get (GDK.GDK_NONE);;
clearSegments (true);
GTK.gtk_text_buffer_cut_clipboard (bufferHandle, clipboard, GTK.gtk_text_view_get_editable (handle));
applySegments ();
@@ -2092,7 +2092,7 @@ public void paste () {
if ((style & SWT.SINGLE) != 0) {
GTK.gtk_editable_paste_clipboard (handle);
} else {
- long clipboard = GTK.gtk_clipboard_get (GDK.GDK_NONE);
+ long clipboard = GTK.GTK4 ? GDK.gdk_display_get_clipboard(GDK.gdk_display_get_default()) : GTK.gtk_clipboard_get (GDK.GDK_NONE);;
clearSegments (true);
GTK.gtk_text_buffer_paste_clipboard (bufferHandle, clipboard, null, GTK.gtk_text_view_get_editable (handle));
applySegments ();

Back to the top