summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-08-24 15:46:26 -0400
committerSilenio Quarti <silenio_quarti@ca.ibm.com>2012-08-28 13:57:50 -0400
commitce67da633501ca7f46ae5739cc12b5af84e7fa58 (patch)
treeb25914510ae2ac351c44bad708a504737972e920
parent9298b2b5e4c70841e967d5ebec2fff49d69edcf8 (diff)
downloadeclipse.platform.swt-ce67da633501ca7f46ae5739cc12b5af84e7fa58.tar.gz
eclipse.platform.swt-ce67da633501ca7f46ae5739cc12b5af84e7fa58.tar.xz
eclipse.platform.swt-ce67da633501ca7f46ae5739cc12b5af84e7fa58.zip
Omit use of deprecated gdk_utf8_to_compound_text() in newer GTK+
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c46
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c5
-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/OS.java19
6 files changed, 71 insertions, 9 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 f6de5c5d92..6e2a842c06 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
@@ -76,7 +76,12 @@ public void javaToNative (Object object, TransferData transferData) {
int[] format = new int[1];
int /*long*/[] ctext = new int /*long*/[1];
int[] length = new int[1];
- boolean result = OS.gdk_utf8_to_compound_text(utf8, encoding, format, ctext, length);
+ boolean result;
+ if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) {
+ result = OS.gdk_x11_display_utf8_to_compound_text (OS.gdk_display_get_default(), utf8, encoding, format, ctext, length);
+ } else {
+ result = OS.gdk_utf8_to_compound_text(utf8, encoding, format, ctext, length);
+ }
if (!result) return;
transferData.type = encoding[0];
transferData.format = format[0];
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 16ad4e8134..704e487a71 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
@@ -6542,7 +6542,15 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1gdk_1utf8_1to_1compound_1text)
if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail;
if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail;
- rc = (jboolean)gdk_utf8_to_compound_text((const gchar *)lparg0, (GdkAtom *)lparg1, (gint *)lparg2, (guchar **)lparg3, (gint *)lparg4);
+/*
+ rc = (jboolean)gdk_utf8_to_compound_text(lparg0, lparg1, lparg2, lparg3, lparg4);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_utf8_to_compound_text)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jbyte *, jintLong *, jint *, jintLong *, jint *))fp)(lparg0, lparg1, lparg2, lparg3, lparg4);
+ }
+ }
fail:
if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0);
@@ -7158,6 +7166,42 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1display_1get_1xdisplay)
}
#endif
+#ifndef NO__1gdk_1x11_1display_1utf8_1to_1compound_1text
+JNIEXPORT jboolean JNICALL OS_NATIVE(_1gdk_1x11_1display_1utf8_1to_1compound_1text)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLongArray arg2, jintArray arg3, jintLongArray arg4, jintArray arg5)
+{
+ jbyte *lparg1=NULL;
+ jintLong *lparg2=NULL;
+ jint *lparg3=NULL;
+ jintLong *lparg4=NULL;
+ jint *lparg5=NULL;
+ jboolean rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gdk_1x11_1display_1utf8_1to_1compound_1text_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetIntLongArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ if (arg4) if ((lparg4 = (*env)->GetIntLongArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ if (arg5) if ((lparg5 = (*env)->GetIntArrayElements(env, arg5, NULL)) == NULL) goto fail;
+/*
+ rc = (jboolean)gdk_x11_display_utf8_to_compound_text((GdkDisplay *)arg0, lparg1, lparg2, lparg3, lparg4, lparg5);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_x11_display_utf8_to_compound_text)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(GdkDisplay *, jbyte *, jintLong *, jint *, jintLong *, jint *))fp)((GdkDisplay *)arg0, lparg1, lparg2, lparg3, lparg4, lparg5);
+ }
+ }
+fail:
+ if (arg5 && lparg5) (*env)->ReleaseIntArrayElements(env, arg5, lparg5, 0);
+ if (arg4 && lparg4) (*env)->ReleaseIntLongArrayElements(env, arg4, lparg4, 0);
+ if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
+ if (arg2 && lparg2) (*env)->ReleaseIntLongArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ OS_NATIVE_EXIT(env, that, _1gdk_1x11_1display_1utf8_1to_1compound_1text_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1x11_1drawable_1get_1xdisplay
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1drawable_1get_1xdisplay)
(JNIEnv *env, jclass that, jintLong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
index 69b44542ef..09073e9c3e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
@@ -233,6 +233,8 @@
#define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK
#define gdk_x11_screen_lookup_visual_LIB LIB_GDK
#define gdk_x11_window_lookup_for_display_LIB LIB_GDK
+#define gdk_x11_display_utf8_to_compound_text_LIB LIB_GDK
+#define gdk_utf8_to_compound_text_LIB LIB_GDK
#define gdk_threads_set_lock_functions_LIB LIB_GDK
#define atk_object_add_relationship_LIB LIB_ATK
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 657e02529d..1bc0376697 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
@@ -18,8 +18,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1333;
-int OS_nativeFunctionCallCount[1333];
+int OS_nativeFunctionCount = 1334;
+int OS_nativeFunctionCallCount[1334];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -573,6 +573,7 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1window_1show_1unraised",
"_1gdk_1x11_1atom_1to_1xatom",
"_1gdk_1x11_1display_1get_1xdisplay",
+ "_1gdk_1x11_1display_1utf8_1to_1compound_1text",
"_1gdk_1x11_1drawable_1get_1xdisplay",
"_1gdk_1x11_1drawable_1get_1xid",
"_1gdk_1x11_1screen_1get_1window_1manager_1name",
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 e97f22092c..0f8e23db7e 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
@@ -581,6 +581,7 @@ typedef enum {
_1gdk_1window_1show_1unraised_FUNC,
_1gdk_1x11_1atom_1to_1xatom_FUNC,
_1gdk_1x11_1display_1get_1xdisplay_FUNC,
+ _1gdk_1x11_1display_1utf8_1to_1compound_1text_FUNC,
_1gdk_1x11_1drawable_1get_1xdisplay_FUNC,
_1gdk_1x11_1drawable_1get_1xid_FUNC,
_1gdk_1x11_1screen_1get_1window_1manager_1name_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index c0ae254c02..77cdf50766 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -4926,11 +4926,7 @@ public static final void gdk_set_program_class(byte[] program_class) {
}
}
/**
- * @param str cast=(const gchar *)
- * @param encoding cast=(GdkAtom *)
- * @param format cast=(gint *)
- * @param ctext cast=(guchar **)
- * @param length cast=(gint *)
+ * @method flags=dynamic
*/
public static final native boolean _gdk_utf8_to_compound_text(byte[] str, int /*long*/[] encoding, int[] format, int /*long*/[] ctext, int[] length);
public static final boolean gdk_utf8_to_compound_text(byte[] str, int /*long*/[] encoding, int[] format, int /*long*/[] ctext, int[] length) {
@@ -4941,6 +4937,19 @@ public static final boolean gdk_utf8_to_compound_text(byte[] str, int /*long*/[]
lock.unlock();
}
}
+/**
+ * @param display cast=(GdkDisplay *)
+ * @method flags=dynamic
+ */
+public static final native boolean _gdk_x11_display_utf8_to_compound_text(int /*long*/ display, byte[] str, int /*long*/[] encoding, int[] format, int /*long*/[] ctext, int[] length);
+public static final boolean gdk_x11_display_utf8_to_compound_text(int /*long*/ display, byte[] str, int /*long*/[] encoding, int[] format, int /*long*/[] ctext, int[] length) {
+ lock.lock();
+ try {
+ return _gdk_x11_display_utf8_to_compound_text(display, str, encoding, format, ctext, length);
+ } finally {
+ lock.unlock();
+ }
+}
/** @param str cast=(const gchar *) */
public static final native int /*long*/ _gdk_utf8_to_string_target(byte[] str);
public static final int /*long*/ gdk_utf8_to_string_target(byte[] str) {