diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-02 15:15:35 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-08-03 10:49:21 -0400 |
commit | 34f0c3974a377d1fb41f2905de1ceb16ac6ba1ce (patch) | |
tree | db37e353f83085b5007c25df73f051a6dd691ea2 | |
parent | 3728914b67bd00a8b771027767ab899d29ec9d30 (diff) | |
download | eclipse.platform.swt-34f0c3974a377d1fb41f2905de1ceb16ac6ba1ce.tar.gz eclipse.platform.swt-34f0c3974a377d1fb41f2905de1ceb16ac6ba1ce.tar.xz eclipse.platform.swt-34f0c3974a377d1fb41f2905de1ceb16ac6ba1ce.zip |
Use g_object_ref_sink() method instead of deprecated gtk_object_sink()
Conflicts:
bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
12 files changed, 133 insertions, 10 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 7f2beecf4c..8185f816e0 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 @@ -3580,6 +3580,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1object_1ref) } #endif +#ifndef NO__1g_1object_1ref_1sink +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1object_1ref_1sink) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1object_1ref_1sink_FUNC); +/* + rc = (jintLong)g_object_ref_sink(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, g_object_ref_sink) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1object_1ref_1sink_FUNC); + return rc; +} +#endif + #if (!defined(NO__1g_1object_1set__I_3BFI) && !defined(JNI64)) || (!defined(NO__1g_1object_1set__J_3BFJ) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1set__I_3BFI)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jfloat arg2, jintLong arg3) @@ -7278,6 +7298,42 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1window_1lookup_1for_1display) } #endif +#ifndef NO__1glib_1major_1version +JNIEXPORT jint JNICALL OS_NATIVE(_1glib_1major_1version) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1glib_1major_1version_FUNC); + rc = (jint)glib_major_version; + OS_NATIVE_EXIT(env, that, _1glib_1major_1version_FUNC); + return rc; +} +#endif + +#ifndef NO__1glib_1micro_1version +JNIEXPORT jint JNICALL OS_NATIVE(_1glib_1micro_1version) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1glib_1micro_1version_FUNC); + rc = (jint)glib_micro_version; + OS_NATIVE_EXIT(env, that, _1glib_1micro_1version_FUNC); + return rc; +} +#endif + +#ifndef NO__1glib_1minor_1version +JNIEXPORT jint JNICALL OS_NATIVE(_1glib_1minor_1version) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1glib_1minor_1version_FUNC); + rc = (jint)glib_minor_version; + OS_NATIVE_EXIT(env, that, _1glib_1minor_1version_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1accel_1group_1new JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1accel_1group_1new) (JNIEnv *env, jclass that) @@ -10464,7 +10520,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1object_1sink) (JNIEnv *env, jclass that, jintLong arg0) { OS_NATIVE_ENTER(env, that, _1gtk_1object_1sink_FUNC); - gtk_object_sink((GtkObject *)arg0); +/* + gtk_object_sink(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_object_sink) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } OS_NATIVE_EXIT(env, that, _1gtk_1object_1sink_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 7aa2584af6..0a5fd5fe20 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 @@ -237,6 +237,7 @@ #define gdk_cairo_region_LIB LIB_GDK #define gdk_cairo_create_LIB LIB_GDK #define gtk_enumerate_printers_LIB LIB_GTK +#define gtk_object_sink_LIB LIB_GTK #define gtk_orientable_set_orientation_LIB LIB_GTK #define gtk_page_setup_get_bottom_margin_LIB LIB_GTK #define gtk_page_setup_get_left_margin_LIB LIB_GTK @@ -341,6 +342,7 @@ #define g_icon_to_string_LIB LIB_GIO #define g_icon_new_for_string_LIB LIB_GIO #define g_file_query_info_LIB LIB_GIO +#define g_object_ref_sink_LIB LIB_GIO /* Field accessors */ #define G_OBJECT_CLASS_CONSTRUCTOR(arg0) (arg0)->constructor 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 010c8664f5..746a2767fc 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 = 1321; -int OS_nativeFunctionCallCount[1321]; +int OS_nativeFunctionCount = 1325; +int OS_nativeFunctionCallCount[1325]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -293,6 +293,7 @@ char * OS_nativeFunctionNames[] = { "_1g_1object_1new", "_1g_1object_1notify", "_1g_1object_1ref", + "_1g_1object_1ref_1sink", #ifndef JNI64 "_1g_1object_1set__I_3BFI", #else @@ -584,6 +585,9 @@ char * OS_nativeFunctionNames[] = { "_1gdk_1x11_1screen_1lookup_1visual", "_1gdk_1x11_1visual_1get_1xvisual", "_1gdk_1x11_1window_1lookup_1for_1display", + "_1glib_1major_1version", + "_1glib_1micro_1version", + "_1glib_1minor_1version", "_1gtk_1accel_1group_1new", "_1gtk_1accel_1label_1set_1accel_1widget", "_1gtk_1accelerator_1get_1default_1mod_1mask", 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 0f49d17c1b..036e9d8d3a 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 @@ -301,6 +301,7 @@ typedef enum { _1g_1object_1new_FUNC, _1g_1object_1notify_FUNC, _1g_1object_1ref_FUNC, + _1g_1object_1ref_1sink_FUNC, #ifndef JNI64 _1g_1object_1set__I_3BFI_FUNC, #else @@ -592,6 +593,9 @@ typedef enum { _1gdk_1x11_1screen_1lookup_1visual_FUNC, _1gdk_1x11_1visual_1get_1xvisual_FUNC, _1gdk_1x11_1window_1lookup_1for_1display_FUNC, + _1glib_1major_1version_FUNC, + _1glib_1micro_1version_FUNC, + _1glib_1minor_1version_FUNC, _1gtk_1accel_1group_1new_FUNC, _1gtk_1accel_1label_1set_1accel_1widget_FUNC, _1gtk_1accelerator_1get_1default_1mod_1mask_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 1e44962599..3357cf2ec5 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 @@ -581,6 +581,7 @@ public class OS extends C { public static final byte[] GTK_STOCK_CLEAR = ascii("gtk-clear"); public static final int GTK_VERSION = VERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version()); + public static final int GLIB_VERSION = VERSION(glib_major_version(), glib_minor_version(), glib_micro_version()); public static final boolean USE_CAIRO, INIT_CAIRO; static { boolean useCairo = false; @@ -7748,6 +7749,36 @@ public static final int gtk_micro_version() { lock.unlock(); } } +/** @method flags=const */ +public static final native int _glib_major_version(); +public static final int glib_major_version() { + lock.lock(); + try { + return _glib_major_version(); + } finally { + lock.unlock(); + } +} +/** @method flags=const */ +public static final native int _glib_minor_version(); +public static final int glib_minor_version() { + lock.lock(); + try { + return _glib_minor_version(); + } finally { + lock.unlock(); + } +} +/** @method flags=const */ +public static final native int _glib_micro_version(); +public static final int glib_micro_version() { + lock.lock(); + try { + return _glib_micro_version(); + } finally { + lock.unlock(); + } +} public static final native void _gtk_main(); public static final void gtk_main() { lock.lock(); @@ -8056,7 +8087,7 @@ public static final void gtk_notebook_set_tab_pos(int /*long*/ notebook, int pos lock.unlock(); } } -/** @param object cast=(GtkObject *) */ +/** @method flags=dynamic */ public static final native void _gtk_object_sink(int /*long*/ object); public static final void gtk_object_sink(int /*long*/ object) { lock.lock(); @@ -8067,6 +8098,16 @@ public static final void gtk_object_sink(int /*long*/ object) { } } /** @method flags=dynamic */ +public static final native int /*long*/ _g_object_ref_sink(int /*long*/ object); +public static final int /*long*/ g_object_ref_sink(int /*long*/ object) { + lock.lock(); + try { + return _g_object_ref_sink(object); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ public static final native void _gtk_orientable_set_orientation(int /*long*/ orientable, int orientation); public static final void gtk_orientable_set_orientation(int /*long*/ orientable, int orientation) { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java index 2e1a82bf05..00a8b635b9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java @@ -294,7 +294,7 @@ void createHandle (int index) { groupHandle = OS.gtk_radio_button_new (0); if (groupHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (groupHandle); - OS.gtk_object_sink (groupHandle); + g_object_ref_sink (groupHandle); handle = OS.gtk_radio_button_new (OS.gtk_radio_button_get_group (groupHandle)); if (handle == 0) error (SWT.ERROR_NO_HANDLES); break; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java index 3da092920c..64968d6e78 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java @@ -128,7 +128,7 @@ void createHandle(int index) { labelHandle = OS.gtk_label_new (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (labelHandle); - OS.gtk_object_sink (labelHandle); + g_object_ref_sink (labelHandle); clientHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (clientHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, handle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java index 59526c575b..dfca6d22da 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java @@ -257,7 +257,7 @@ void createHandle (int index) { groupHandle = OS.gtk_radio_menu_item_new (0); if (groupHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (groupHandle); - OS.gtk_object_sink (groupHandle); + g_object_ref_sink (groupHandle); int /*long*/ group = OS.gtk_radio_menu_item_get_group (groupHandle); handle = OS.gtk_radio_menu_item_new_with_label (group, buffer); break; 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 2a62e480cc..001b4cb64a 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 @@ -2461,7 +2461,7 @@ void setToolTipText (int /*long*/ rootWidget, int /*long*/ tipWidget, String str tooltipsHandle = OS.gtk_tooltips_new (); if (tooltipsHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (tooltipsHandle); - OS.gtk_object_sink (tooltipsHandle); + g_object_ref_sink (tooltipsHandle); } /* diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java index c7da6c4393..a205e6ef96 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java @@ -278,7 +278,7 @@ void createHandle (int index) { OS.gtk_tooltips_force_window (handle); } OS.g_object_ref (handle); - OS.gtk_object_sink (handle); + g_object_ref_sink (handle); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java index 2a82fb8e45..95dad533dc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java @@ -591,7 +591,7 @@ public void setToolTipText (String string) { tooltipsHandle = OS.gtk_tooltips_new (); if (tooltipsHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (tooltipsHandle); - OS.gtk_object_sink (tooltipsHandle); + g_object_ref_sink (tooltipsHandle); } if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { OS.gtk_status_icon_set_tooltip (handle, buffer); 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 6aa4be97f3..389c5fce7b 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 @@ -1681,6 +1681,14 @@ int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*lon int /*long*/ sizeRequestProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { return 0; } +int /*long*/ g_object_ref_sink (int /*long*/ object) { + if (OS.GLIB_VERSION >= OS.VERSION (2, 10, 0)) { + return OS.g_object_ref_sink (object); + } else { + OS.gtk_object_sink (object); + } + return 0; +} boolean gtk_widget_get_sensitive (int /*long*/ widget) { if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { |