diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-08 11:36:27 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-08-08 11:36:27 -0400 |
commit | 4433240319dc2632482852019fe0de67bad7b5b0 (patch) | |
tree | 0655cf9040b6fefa7472d85f21ea81a5bc65a770 | |
parent | 758fea8d1686ce388e1d704038f537b23366a799 (diff) | |
download | eclipse.platform.swt-gtk_slider.tar.gz eclipse.platform.swt-gtk_slider.tar.xz eclipse.platform.swt-gtk_slider.zip |
Omit use of deprecated GTK_RANGE_SLIDER_END and GTK_RANGE_SLIDER_STARTgtk_slider
6 files changed, 79 insertions, 6 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 6536e523dd..bd4da685d9 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 @@ -12155,6 +12155,31 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1range_1get_1adjustment) } #endif +#ifndef NO__1gtk_1range_1get_1slider_1range +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1range_1get_1slider_1range) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2) +{ + jint *lparg1=NULL; + jint *lparg2=NULL; + OS_NATIVE_ENTER(env, that, _1gtk_1range_1get_1slider_1range_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; +/* + gtk_range_get_slider_range((GtkRange *)arg0, (gint *)lparg1, (gint *)lparg2); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_range_get_slider_range) + if (fp) { + ((void (CALLING_CONVENTION*)(GtkRange *, gint *, gint *))fp)((GtkRange *)arg0, (gint *)lparg1, (gint *)lparg2); + } + } +fail: + if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1gtk_1range_1get_1slider_1range_FUNC); +} +#endif + #ifndef NO__1gtk_1range_1set_1increments JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1range_1set_1increments) (JNIEnv *env, jclass that, jintLong arg0, jdouble arg1, jdouble arg2) 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 2b5ccc4bc4..721d8426f4 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 @@ -218,6 +218,7 @@ #define gtk_widget_get_realized_LIB LIB_GTK #define gtk_widget_get_can_default_LIB LIB_GTK #define gtk_widget_get_window_LIB LIB_GTK +#define gtk_range_get_slider_range_LIB LIB_GTK #define gdk_pango_context_set_colormap_LIB LIB_GDK #define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK #define gdk_x11_screen_lookup_visual_LIB LIB_GDK @@ -361,8 +362,16 @@ #define G_OBJECT_CLASS_SET_CONSTRUCTOR(arg0, arg1) (arg0)->constructor = (GObject* (*) (GType, guint, GObjectConstructParam *))arg1 #define GTK_ACCEL_LABEL_SET_ACCEL_STRING(arg0, arg1) (arg0)->accel_string = arg1 #define GTK_ACCEL_LABEL_GET_ACCEL_STRING(arg0) (arg0)->accel_string +#if GTK_CHECK_VERSION(2,20,0) +#define GTK_RANGE_SLIDER_START(arg0) 0 +#else #define GTK_RANGE_SLIDER_START(arg0) (arg0)->slider_start +#endif +#if GTK_CHECK_VERSION(2,20,0) +#define GTK_RANGE_SLIDER_END(arg0) 0 +#else #define GTK_RANGE_SLIDER_END(arg0) (arg0)->slider_end +#endif #define GTK_RANGE_HAS_STEPPER_A(arg0) (arg0)->has_stepper_a #define GTK_RANGE_HAS_STEPPER_B(arg0) (arg0)->has_stepper_b #define GTK_RANGE_HAS_STEPPER_C(arg0) (arg0)->has_stepper_c 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 4e33f737a5..f0d49cb061 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 = 1332; -int OS_nativeFunctionCallCount[1332]; +int OS_nativeFunctionCount = 1333; +int OS_nativeFunctionCallCount[1333]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -930,6 +930,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1radio_1menu_1item_1new", "_1gtk_1radio_1menu_1item_1new_1with_1label", "_1gtk_1range_1get_1adjustment", + "_1gtk_1range_1get_1slider_1range", "_1gtk_1range_1set_1increments", "_1gtk_1range_1set_1inverted", "_1gtk_1range_1set_1range", 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 d3c68639e1..fad8ce59fb 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 @@ -938,6 +938,7 @@ typedef enum { _1gtk_1radio_1menu_1item_1new_FUNC, _1gtk_1radio_1menu_1item_1new_1with_1label_FUNC, _1gtk_1range_1get_1adjustment_FUNC, + _1gtk_1range_1get_1slider_1range_FUNC, _1gtk_1range_1set_1increments_FUNC, _1gtk_1range_1set_1inverted_FUNC, _1gtk_1range_1set_1range_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 0b86c3d3d5..dde016a527 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 @@ -9167,6 +9167,21 @@ public static final void gtk_range_set_value(int /*long*/ range, double value) { lock.unlock(); } } +/** + * @method flags=dynamic + * @param range cast=(GtkRange *) + * @param slider_start cast=(gint *) + * @param slider_end cast=(gint *) + */ +public static final native void _gtk_range_get_slider_range(int /*long*/ range, int[] slider_start, int[] slider_end); +public static final void gtk_range_get_slider_range(int /*long*/ range, int[] slider_start, int[] slider_end) { + lock.lock(); + try { + _gtk_range_get_slider_range(range, slider_start, slider_end); + } finally { + lock.unlock(); + } +} /** @param rc_string cast=(const gchar *) */ public static final native void _gtk_rc_parse_string(byte[] rc_string); public static final void gtk_rc_parse_string(byte[] rc_string) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java index 2cf5fbeaea..1e96656d78 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java @@ -339,8 +339,8 @@ public int getThumb () { */ public Rectangle getThumbBounds () { checkWidget(); - int slider_start = OS.GTK_RANGE_SLIDER_START (handle); - int slider_end = OS.GTK_RANGE_SLIDER_END (handle); + int slider_start = gtk_range_slider_start (handle); + int slider_end = gtk_range_slider_end (handle); int x, y, width, height; GtkAllocation allocation = new GtkAllocation (); if ((style & SWT.VERTICAL) != 0) { @@ -423,7 +423,7 @@ public Rectangle getThumbTrackBounds () { if (hasC) height -= stepperSize; if (hasD) height -= stepperSize; if (height < 0) { - y = OS.GTK_RANGE_SLIDER_START (handle); + y = gtk_range_slider_start (handle); height = 0; } } else { @@ -450,7 +450,7 @@ public Rectangle getThumbTrackBounds () { height = OS.GTK_WIDGET_HEIGHT (handle); } if (width < 0) { - x = OS.GTK_RANGE_SLIDER_START (handle); + x = gtk_range_slider_start (handle); width = 0; } } @@ -909,4 +909,26 @@ public void setVisible (boolean visible) { } } +int gtk_range_slider_start (int /*long*/ widget) { + if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { + int[] slider_start = new int [1]; + int[] slider_end = new int [1]; + OS.gtk_range_get_slider_range (widget, slider_start, slider_end); + return slider_start [0]; + } else { + return OS.GTK_RANGE_SLIDER_START (widget); + } +} + +int gtk_range_slider_end (int /*long*/ widget) { + if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { + int[] slider_start = new int [1]; + int[] slider_end = new int [1]; + OS.gtk_range_get_slider_range (widget, slider_start, slider_end); + return slider_end [0]; + } else { + return OS.GTK_RANGE_SLIDER_END (widget); + } +} + } |