diff options
author | Anatoly Spektor | 2012-10-02 12:59:30 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2012-10-02 17:38:06 +0000 |
commit | ffe5186c17b22da6dd8ec55ad2dd5f424adf803a (patch) | |
tree | 48586f0c1626d1296c6dc165a63435dc6562dacf | |
parent | ed548011f4f983818b96640d346d126775013185 (diff) | |
download | eclipse.platform.swt-ffe5186c17b22da6dd8ec55ad2dd5f424adf803a.tar.gz eclipse.platform.swt-ffe5186c17b22da6dd8ec55ad2dd5f424adf803a.tar.xz eclipse.platform.swt-ffe5186c17b22da6dd8ec55ad2dd5f424adf803a.zip |
Replace gdk_cursor_unref with g_object_unref for GTK+ 3
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 e79e8caa0b..9693360a8c 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 500754ec02..1408fbcb78 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 065d032705..44a8f8a613 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 6ac6cb7412..c473b56e38 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 c13150c589..49c25629b4 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 9a67d462e0..73b4c6c806 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 995f6e1051..faec386acb 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 f45e9ab5a3..713587b523 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 0f35509f2f..02a53662e1 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); + } +} + } |