From a61caa1cfed4d2ec7b9bccff2e9d74f32593118d Mon Sep 17 00:00:00 2001 From: Anatoly Spektor Date: Wed, 8 Aug 2012 11:36:27 -0400 Subject: Omit use of deprecated GTK_RANGE_SLIDER_END and GTK_RANGE_SLIDER_START Conflicts: bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c --- .../Eclipse SWT PI/gtk/library/os.c | 25 +++++++++++++++++++ .../Eclipse SWT PI/gtk/library/os_custom.h | 9 +++++++ .../Eclipse SWT PI/gtk/library/os_stats.c | 5 ++-- .../Eclipse SWT PI/gtk/library/os_stats.h | 1 + .../gtk/org/eclipse/swt/internal/gtk/OS.java | 15 +++++++++++ .../gtk/org/eclipse/swt/widgets/ScrollBar.java | 29 ++++++++++++++++------ 6 files changed, 74 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 92f1670fae..e48a8f9a76 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 @@ -12135,6 +12135,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 3b2b5ba659..050eae6ae7 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 @@ -224,6 +224,7 @@ #define gtk_widget_set_sensitive_LIB LIB_GTK #define gtk_widget_set_receives_default_LIB LIB_GTK #define gtk_widget_set_visible_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 @@ -367,8 +368,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 b1b6aaeda9..aa5d1eab09 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 = 1335; -int OS_nativeFunctionCallCount[1335]; +int OS_nativeFunctionCount = 1336; +int OS_nativeFunctionCallCount[1336]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -928,6 +928,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 81bd7056a9..34e4638271 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 @@ -936,6 +936,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 1b27f48bda..d79646c18a 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 @@ -9163,6 +9163,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..fecf64eba9 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 = new int [1], slider_end = new int [1]; + gtk_range_get_slider_range (handle, slider_start, slider_end); int x, y, width, height; GtkAllocation allocation = new GtkAllocation (); if ((style & SWT.VERTICAL) != 0) { @@ -352,10 +352,10 @@ public Rectangle getThumbBounds () { x = OS.GTK_WIDGET_X (handle); width = OS.GTK_WIDGET_WIDTH (handle); } - y = slider_start; - height = slider_end - slider_start; + y = slider_start [0]; + height = slider_end [0] - slider_start [0]; } else { - x = slider_start; + x = slider_start [0]; if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { OS.gtk_widget_get_allocation(handle, allocation); y = allocation.y; @@ -364,7 +364,7 @@ public Rectangle getThumbBounds () { y = OS.GTK_WIDGET_Y (handle); height = OS.GTK_WIDGET_HEIGHT (handle); } - width = slider_end - slider_start; + width = slider_end [0] - slider_start [0]; } Rectangle rect = new Rectangle(x, y, width, height); int [] origin_x = new int [1], origin_y = new int [1]; @@ -423,7 +423,9 @@ public Rectangle getThumbTrackBounds () { if (hasC) height -= stepperSize; if (hasD) height -= stepperSize; if (height < 0) { - y = OS.GTK_RANGE_SLIDER_START (handle); + int [] slider_start = new int [1], slider_end = new int [1]; + gtk_range_get_slider_range (handle, slider_start, slider_end); + y = slider_start [0]; height = 0; } } else { @@ -450,7 +452,9 @@ public Rectangle getThumbTrackBounds () { height = OS.GTK_WIDGET_HEIGHT (handle); } if (width < 0) { - x = OS.GTK_RANGE_SLIDER_START (handle); + int [] slider_start = new int [1], slider_end = new int [1]; + gtk_range_get_slider_range (handle, slider_start, slider_end); + x = slider_start [0]; width = 0; } } @@ -509,6 +513,15 @@ int /*long*/ gtk_change_value (int /*long*/ widget, int /*long*/ scroll, int /*l return 0; } +void gtk_range_get_slider_range (int /*long*/ widget, int [] slider_start, int [] slider_end) { + if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { + OS.gtk_range_get_slider_range (widget, slider_start, slider_end); + } else { + slider_start [0] = OS.GTK_RANGE_SLIDER_START (widget); + slider_end [0] = OS.GTK_RANGE_SLIDER_END (widget); + } +} + int /*long*/ gtk_value_changed (int /*long*/ adjustment) { Event event = new Event (); dragSent = detail == OS.GTK_SCROLL_JUMP; -- cgit