aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor2012-10-02 08:59:30 (EDT)
committerAlexander Kurtakov2012-10-02 13:38:06 (EDT)
commitffe5186c17b22da6dd8ec55ad2dd5f424adf803a (patch)
tree48586f0c1626d1296c6dc165a63435dc6562dacf
parented548011f4f983818b96640d346d126775013185 (diff)
downloadeclipse.platform.swt-ffe5186c17b22da6dd8ec55ad2dd5f424adf803a.zip
eclipse.platform.swt-ffe5186c17b22da6dd8ec55ad2dd5f424adf803a.tar.gz
eclipse.platform.swt-ffe5186c17b22da6dd8ec55ad2dd5f424adf803a.tar.bz2
Replace gdk_cursor_unref with g_object_unref for GTK+ 3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java8
9 files changed, 32 insertions, 7 deletions
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 e79e8ca..9693360 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
@@ -4871,7 +4871,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1cursor_1unref)
(JNIEnv *env, jclass that, jintLong arg0)
{
OS_NATIVE_ENTER(env, that, _1gdk_1cursor_1unref_FUNC);
- gdk_cursor_unref((GdkCursor *)arg0);
+/*
+ gdk_cursor_unref(arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_cursor_unref)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1cursor_1unref_FUNC);
}
#endif
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 500754e..1408fbc 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
@@ -166,6 +166,7 @@
#define gtk_entry_set_icon_sensitive_LIB LIB_GTK
#define gtk_tooltips_new_LIB LIB_GTK
#define gdk_cursor_new_from_pixbuf_LIB LIB_GDK
+#define gdk_cursor_unref_LIB LIB_GDK
#define gdk_device_manager_get_client_pointer_LIB LIB_GDK
#define gdk_device_grab_LIB LIB_GDK
#define gdk_device_ungrab_LIB LIB_GDK
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 065d032..44a8f8a 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
@@ -3612,7 +3612,7 @@ public static final long /*int*/ gdk_colormap_get_system() {
lock.unlock();
}
}
-/** @param cursor cast=(GdkCursor *) */
+/** @method flags=dynamic */
public static final native void _gdk_cursor_unref(long /*int*/ cursor);
public static final void gdk_cursor_unref(long /*int*/ cursor) {
lock.lock();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java
index 6ac6cb7..c473b56 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java
@@ -449,7 +449,7 @@ long /*int*/ createCursor(byte[] sourceData, byte[] maskData, int width, int hei
}
void destroy() {
- OS.gdk_cursor_unref(handle);
+ gdk_cursor_unref(handle);
handle = 0;
}
@@ -530,4 +530,12 @@ public String toString () {
return "Cursor {" + handle + "}";
}
+void gdk_cursor_unref (long /*int*/ cursor) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ OS.g_object_unref (cursor);
+ } else {
+ OS.gdk_cursor_unref(cursor);
+ }
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
index c13150c..49c2562 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
@@ -414,7 +414,7 @@ void hookEvents () {
void releaseWidget () {
super.releaseWidget ();
- if (defaultCursor != 0) OS.gdk_cursor_unref (defaultCursor);
+ if (defaultCursor != 0) gdk_cursor_unref (defaultCursor);
defaultCursor = 0;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 9a67d46..73b4c6c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -1363,7 +1363,7 @@ long /*int*/ gtk_motion_notify_event (long /*int*/ widget, long /*int*/ event) {
long /*int*/ window = gtk_widget_get_window (shellHandle);
long /*int*/ cursor = OS.gdk_cursor_new (mode);
OS.gdk_window_set_cursor (window, cursor);
- OS.gdk_cursor_unref (cursor);
+ gdk_cursor_unref (cursor);
display.resizeMode = mode;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
index 995f6e1..faec386 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
@@ -880,7 +880,7 @@ void setCursor (long /*int*/ cursor) {
long /*int*/ defaultCursor = 0;
if (cursor == 0) defaultCursor = OS.gdk_cursor_new (OS.GDK_XTERM);
super.setCursor (cursor != 0 ? cursor : defaultCursor);
- if (cursor == 0) OS.gdk_cursor_unref (defaultCursor);
+ if (cursor == 0) gdk_cursor_unref (defaultCursor);
}
void setFontDescription (long /*int*/ font) {
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 f45e9ab..713587b 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
@@ -2050,7 +2050,7 @@ void setCursor (long /*int*/ cursor) {
long /*int*/ defaultCursor = 0;
if (cursor == 0) defaultCursor = OS.gdk_cursor_new (OS.GDK_XTERM);
super.setCursor (cursor != 0 ? cursor : defaultCursor);
- if (cursor == 0) OS.gdk_cursor_unref (defaultCursor);
+ if (cursor == 0) gdk_cursor_unref (defaultCursor);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index 0f35509..02a5366 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -2006,4 +2006,12 @@ long /*int*/ windowProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ ar
}
}
+void gdk_cursor_unref (long /*int*/ cursor) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ OS.g_object_unref (cursor);
+ } else {
+ OS.gdk_cursor_unref(cursor);
+ }
+}
+
}