Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2012-10-11 22:19:39 +0000
committerAlexander Kurtakov2012-10-15 08:26:10 +0000
commitdf2aec5c90d07756dc802b7f295801f7f8f7b06a (patch)
treec5df055ed3235c5bf7a6564c0b905604d10282a8
parent10f582427b55ec27f4cfe49dc45699d6a4b5a631 (diff)
downloadeclipse.platform.swt-df2aec5c90d07756dc802b7f295801f7f8f7b06a.tar.gz
eclipse.platform.swt-df2aec5c90d07756dc802b7f295801f7f8f7b06a.tar.xz
eclipse.platform.swt-df2aec5c90d07756dc802b7f295801f7f8f7b06a.zip
Do not use GtkTargetPair and remove it.
It was used in DropTarget.setEventData where the list was iterated using g_list_nth and GtkTargetPair struct recreated on the java side. It is way more simple and effective to use g_list_nth_data which gives us exactly what we need, reduces java/c roundtrips and allows to be compiled on GTK 3.
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c37
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.c39
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.h14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkTargetPair.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java7
8 files changed, 4 insertions, 137 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
index cae866331b..8246075242 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
@@ -778,11 +778,9 @@ boolean setEventData(long /*int*/ context, int x, int y, int time, DNDEvent even
int length = OS.g_list_length(targets);
TransferData[] dataTypes = new TransferData[0];
for (int i = 0; i < length; i++) {
- long /*int*/ pData = OS.g_list_nth(targets, i);
- GtkTargetPair gtkTargetPair = new GtkTargetPair();
- OS.memmove(gtkTargetPair, pData, GtkTargetPair.sizeof);
+ long /*int*/ pData = OS.g_list_nth_data(targets, i);
TransferData data = new TransferData();
- data.type = gtkTargetPair.target;
+ data.type = pData;
for (int j = 0; j < transferAgents.length; j++) {
Transfer transfer = transferAgents[j];
if (transfer != null && transfer.isSupportedType(data)) {
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 e7189e8696..8d344d8fda 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
@@ -861,18 +861,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(GtkTargetEntry_1sizeof)
}
#endif
-#ifndef NO_GtkTargetPair_1sizeof
-JNIEXPORT jint JNICALL OS_NATIVE(GtkTargetPair_1sizeof)
- (JNIEnv *env, jclass that)
-{
- jint rc = 0;
- OS_NATIVE_ENTER(env, that, GtkTargetPair_1sizeof_FUNC);
- rc = (jint)GtkTargetPair_sizeof();
- OS_NATIVE_EXIT(env, that, GtkTargetPair_1sizeof_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_GtkTextIter_1sizeof
JNIEXPORT jint JNICALL OS_NATIVE(GtkTextIter_1sizeof)
(JNIEnv *env, jclass that)
@@ -20555,31 +20543,6 @@ fail:
}
#endif
-#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2JJ) && defined(JNI64))
-#ifndef JNI64
-JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
-#else
-JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2JJ)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
-#endif
-{
- GtkTargetPair _arg0, *lparg0=NULL;
-#ifndef JNI64
- OS_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2II_FUNC);
-#else
- OS_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2JJ_FUNC);
-#endif
- if (arg0) if ((lparg0 = &_arg0) == NULL) goto fail;
- memmove((void *)lparg0, (const void *)arg1, (size_t)arg2);
-fail:
- if (arg0 && lparg0) setGtkTargetPairFields(env, arg0, lparg0);
-#ifndef JNI64
- OS_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2II_FUNC);
-#else
- OS_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2JJ_FUNC);
-#endif
-}
-#endif
-
#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GtkWidgetClass_2I) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GtkWidgetClass_2J) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GtkWidgetClass_2I)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1)
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 6dc1639b92..4e78f040c3 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
@@ -97,7 +97,6 @@ char * OS_nativeFunctionNames[] = {
"GtkRequisition_1sizeof",
"GtkSelectionData_1sizeof",
"GtkTargetEntry_1sizeof",
- "GtkTargetPair_1sizeof",
"GtkTextIter_1sizeof",
"GtkTreeIter_1sizeof",
"PangoAttrColor_1sizeof",
@@ -1693,11 +1692,6 @@ char * OS_nativeFunctionNames[] = {
"memmove__Lorg_eclipse_swt_internal_gtk_GtkSelectionData_2JJ",
#endif
#ifndef JNI64
- "memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2II",
-#else
- "memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2JJ",
-#endif
-#ifndef JNI64
"memmove__Lorg_eclipse_swt_internal_gtk_GtkWidgetClass_2I",
#else
"memmove__Lorg_eclipse_swt_internal_gtk_GtkWidgetClass_2J",
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 96b2ee735e..c3ede72adc 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
@@ -107,7 +107,6 @@ typedef enum {
GtkRequisition_1sizeof_FUNC,
GtkSelectionData_1sizeof_FUNC,
GtkTargetEntry_1sizeof_FUNC,
- GtkTargetPair_1sizeof_FUNC,
GtkTextIter_1sizeof_FUNC,
GtkTreeIter_1sizeof_FUNC,
PangoAttrColor_1sizeof_FUNC,
@@ -1703,11 +1702,6 @@ typedef enum {
memmove__Lorg_eclipse_swt_internal_gtk_GtkSelectionData_2JJ_FUNC,
#endif
#ifndef JNI64
- memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2II_FUNC,
-#else
- memmove__Lorg_eclipse_swt_internal_gtk_GtkTargetPair_2JJ_FUNC,
-#endif
-#ifndef JNI64
memmove__Lorg_eclipse_swt_internal_gtk_GtkWidgetClass_2I_FUNC,
#else
memmove__Lorg_eclipse_swt_internal_gtk_GtkWidgetClass_2J_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.c
index f40d3a9bce..40e81e0df8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2012 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -1654,43 +1654,6 @@ void setGtkTargetEntryFields(JNIEnv *env, jobject lpObject, GtkTargetEntry *lpSt
}
#endif
-#ifndef NO_GtkTargetPair
-typedef struct GtkTargetPair_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID target, flags, info;
-} GtkTargetPair_FID_CACHE;
-
-GtkTargetPair_FID_CACHE GtkTargetPairFc;
-
-void cacheGtkTargetPairFields(JNIEnv *env, jobject lpObject)
-{
- if (GtkTargetPairFc.cached) return;
- GtkTargetPairFc.clazz = (*env)->GetObjectClass(env, lpObject);
- GtkTargetPairFc.target = (*env)->GetFieldID(env, GtkTargetPairFc.clazz, "target", I_J);
- GtkTargetPairFc.flags = (*env)->GetFieldID(env, GtkTargetPairFc.clazz, "flags", "I");
- GtkTargetPairFc.info = (*env)->GetFieldID(env, GtkTargetPairFc.clazz, "info", "I");
- GtkTargetPairFc.cached = 1;
-}
-
-GtkTargetPair *getGtkTargetPairFields(JNIEnv *env, jobject lpObject, GtkTargetPair *lpStruct)
-{
- if (!GtkTargetPairFc.cached) cacheGtkTargetPairFields(env, lpObject);
- lpStruct->target = (GdkAtom)(*env)->GetIntLongField(env, lpObject, GtkTargetPairFc.target);
- lpStruct->flags = (guint)(*env)->GetIntField(env, lpObject, GtkTargetPairFc.flags);
- lpStruct->info = (guint)(*env)->GetIntField(env, lpObject, GtkTargetPairFc.info);
- return lpStruct;
-}
-
-void setGtkTargetPairFields(JNIEnv *env, jobject lpObject, GtkTargetPair *lpStruct)
-{
- if (!GtkTargetPairFc.cached) cacheGtkTargetPairFields(env, lpObject);
- (*env)->SetIntLongField(env, lpObject, GtkTargetPairFc.target, (jintLong)lpStruct->target);
- (*env)->SetIntField(env, lpObject, GtkTargetPairFc.flags, (jint)lpStruct->flags);
- (*env)->SetIntField(env, lpObject, GtkTargetPairFc.info, (jint)lpStruct->info);
-}
-#endif
-
#ifndef NO_GtkWidgetClass
typedef struct GtkWidgetClass_FID_CACHE {
int cached;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.h
index eec80eb652..2b22c726f8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2012 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -411,18 +411,6 @@ void setGtkTargetEntryFields(JNIEnv *env, jobject lpObject, GtkTargetEntry *lpSt
#define GtkTargetEntry_sizeof() 0
#endif
-#ifndef NO_GtkTargetPair
-void cacheGtkTargetPairFields(JNIEnv *env, jobject lpObject);
-GtkTargetPair *getGtkTargetPairFields(JNIEnv *env, jobject lpObject, GtkTargetPair *lpStruct);
-void setGtkTargetPairFields(JNIEnv *env, jobject lpObject, GtkTargetPair *lpStruct);
-#define GtkTargetPair_sizeof() sizeof(GtkTargetPair)
-#else
-#define cacheGtkTargetPairFields(a,b)
-#define getGtkTargetPairFields(a,b,c) NULL
-#define setGtkTargetPairFields(a,b,c)
-#define GtkTargetPair_sizeof() 0
-#endif
-
#ifndef NO_GtkWidgetClass
void cacheGtkWidgetClassFields(JNIEnv *env, jobject lpObject);
GtkWidgetClass *getGtkWidgetClassFields(JNIEnv *env, jobject lpObject, GtkWidgetClass *lpStruct);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkTargetPair.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkTargetPair.java
deleted file mode 100644
index beef1cfe6f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkTargetPair.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved.
- * The contents of this file are made available under the terms
- * of the GNU Lesser General Public License (LGPL) Version 2.1 that
- * accompanies this distribution (lgpl-v21.txt). The LGPL is also
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.internal.gtk;
-
-
-public class GtkTargetPair {
- /** @field cast=(GdkAtom) */
- public long /*int*/ target;
- /** @field cast=(guint) */
- public int flags;
- /** @field cast=(guint) */
- public int info;
- public static final int sizeof = OS.GtkTargetPair_sizeof();
-}
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 0ce81c03dc..1551cfcca3 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
@@ -647,7 +647,6 @@ public static final native int GtkFixedClass_sizeof();
public static final native int GtkRequisition_sizeof();
public static final native int GtkSelectionData_sizeof();
public static final native int GtkTargetEntry_sizeof();
-public static final native int GtkTargetPair_sizeof();
public static final native int GtkTextIter_sizeof();
public static final native int GtkCellRendererText_sizeof();
public static final native int GtkCellRendererTextClass_sizeof();
@@ -13955,12 +13954,6 @@ public static final native void memmove(GtkWidgetClass dest, long /*int*/ src);
/**
* @param dest cast=(void *),flags=no_in
* @param src cast=(const void *)
- * @param size cast=(size_t)
- */
-public static final native void memmove(GtkTargetPair dest, long /*int*/ src, long /*int*/ size);
-/**
- * @param dest cast=(void *),flags=no_in
- * @param src cast=(const void *)
*/
public static final native void memmove(GtkAdjustment dest, long /*int*/ src);
/**

Back to the top