aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2012-06-20 10:10:12 (EDT)
committerSilenio Quarti2012-06-21 11:09:21 (EDT)
commit2f67efb12116378f6c4fe455aa16cedec07ec5d6 (patch)
treea3000b10760bba538b0b9332726d2d92c1c74f66
parentd62ca75a93db110199fc4bd6eaf1279a676d827b (diff)
downloadeclipse.platform.swt-2f67efb12116378f6c4fe455aa16cedec07ec5d6.zip
eclipse.platform.swt-2f67efb12116378f6c4fe455aa16cedec07ec5d6.tar.gz
eclipse.platform.swt-2f67efb12116378f6c4fe455aa16cedec07ec5d6.tar.bz2
Use gtk_scrolled_window_get_[h|v]scrollbar functions for GTK >= 2.8.
The old way of accessing the struct directly is ifdefed as the struct can not be accessed directly in GTK 3. With this change if SWT is compiled against newer GTK it will not run for pre GTK 2.8.
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java26
7 files changed, 110 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 97b16fc..321026e 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
@@ -13141,6 +13141,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1scrolled_1window_1get_1hadjustment)
}
#endif
+#ifndef NO__1gtk_1scrolled_1window_1get_1hscrollbar
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1scrolled_1window_1get_1hscrollbar)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1scrolled_1window_1get_1hscrollbar_FUNC);
+/*
+ rc = (jintLong)gtk_scrolled_window_get_hscrollbar((GtkScrolledWindow *)arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_scrolled_window_get_hscrollbar)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkScrolledWindow *))fp)((GtkScrolledWindow *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1scrolled_1window_1get_1hscrollbar_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gtk_1scrolled_1window_1get_1policy
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1scrolled_1window_1get_1policy)
(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2)
@@ -13182,6 +13202,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1scrolled_1window_1get_1vadjustment)
}
#endif
+#ifndef NO__1gtk_1scrolled_1window_1get_1vscrollbar
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1scrolled_1window_1get_1vscrollbar)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1scrolled_1window_1get_1vscrollbar_FUNC);
+/*
+ rc = (jintLong)gtk_scrolled_window_get_vscrollbar((GtkScrolledWindow *)arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_scrolled_window_get_vscrollbar)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkScrolledWindow *))fp)((GtkScrolledWindow *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1scrolled_1window_1get_1vscrollbar_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gtk_1scrolled_1window_1new
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1scrolled_1window_1new)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
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 310e9fb..e8e752c 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
@@ -176,6 +176,8 @@
#define gdk_screen_get_monitor_geometry_LIB LIB_GDK
#define gdk_screen_get_n_monitors_LIB LIB_GDK
#define gdk_screen_get_number_LIB LIB_GDK
+#define gtk_scrolled_window_get_hscrollbar_LIB LIB_GTK
+#define gtk_scrolled_window_get_vscrollbar_LIB LIB_GTK
#define gtk_status_icon_get_geometry_LIB LIB_GTK
#define gtk_status_icon_get_visible_LIB LIB_GTK
#define gtk_status_icon_new_LIB LIB_GTK
@@ -342,9 +344,17 @@
#define GTK_RANGE_HAS_STEPPER_B(arg0) (arg0)->has_stepper_b
#define GTK_RANGE_HAS_STEPPER_C(arg0) (arg0)->has_stepper_c
#define GTK_RANGE_HAS_STEPPER_D(arg0) (arg0)->has_stepper_d
+#if GTK_CHECK_VERSION(2,8,0)
+#define GTK_SCROLLED_WINDOW_HSCROLLBAR(arg0) 0
+#else
#define GTK_SCROLLED_WINDOW_HSCROLLBAR(arg0) (arg0)->hscrollbar
+#endif
#define GTK_SCROLLED_WINDOW_SCROLLBAR_SPACING(arg0) (GTK_SCROLLED_WINDOW_GET_CLASS (arg0)->scrollbar_spacing >= 0 ? GTK_SCROLLED_WINDOW_GET_CLASS (arg0)->scrollbar_spacing : 3)
+#if GTK_CHECK_VERSION(2,8,0)
+#define GTK_SCROLLED_WINDOW_VSCROLLBAR(arg0) 0
+#else
#define GTK_SCROLLED_WINDOW_VSCROLLBAR(arg0) (arg0)->vscrollbar
+#endif
#define GTK_WIDGET_HEIGHT(arg0) (arg0)->allocation.height
#define GTK_WIDGET_SET_HEIGHT(arg0, arg1) (arg0)->allocation.height = arg1
#define GTK_WIDGET_WIDTH(arg0) (arg0)->allocation.width
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 1d036c1..ca0a055 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 = 1404;
-int OS_nativeFunctionCallCount[1404];
+int OS_nativeFunctionCount = 1406;
+int OS_nativeFunctionCallCount[1406];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -1002,9 +1002,11 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1scale_1set_1draw_1value",
"_1gtk_1scrolled_1window_1add_1with_1viewport",
"_1gtk_1scrolled_1window_1get_1hadjustment",
+ "_1gtk_1scrolled_1window_1get_1hscrollbar",
"_1gtk_1scrolled_1window_1get_1policy",
"_1gtk_1scrolled_1window_1get_1shadow_1type",
"_1gtk_1scrolled_1window_1get_1vadjustment",
+ "_1gtk_1scrolled_1window_1get_1vscrollbar",
"_1gtk_1scrolled_1window_1new",
"_1gtk_1scrolled_1window_1set_1placement",
"_1gtk_1scrolled_1window_1set_1policy",
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 e8c483e..e5b773c 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
@@ -1010,9 +1010,11 @@ typedef enum {
_1gtk_1scale_1set_1draw_1value_FUNC,
_1gtk_1scrolled_1window_1add_1with_1viewport_FUNC,
_1gtk_1scrolled_1window_1get_1hadjustment_FUNC,
+ _1gtk_1scrolled_1window_1get_1hscrollbar_FUNC,
_1gtk_1scrolled_1window_1get_1policy_FUNC,
_1gtk_1scrolled_1window_1get_1shadow_1type_FUNC,
_1gtk_1scrolled_1window_1get_1vadjustment_FUNC,
+ _1gtk_1scrolled_1window_1get_1vscrollbar_FUNC,
_1gtk_1scrolled_1window_1new_FUNC,
_1gtk_1scrolled_1window_1set_1placement_FUNC,
_1gtk_1scrolled_1window_1set_1policy_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 4aab5e3..99353aa 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
@@ -9961,6 +9961,19 @@ public static final int /*long*/ gtk_scrolled_window_get_hadjustment(int /*long*
lock.unlock();
}
}
+/**
+ * @method flags=dynamic
+ * @param scrolled_window cast=(GtkScrolledWindow *)
+ */
+public static final native int /*long*/ _gtk_scrolled_window_get_hscrollbar(int /*long*/ scrolled_window);
+public static final int /*long*/ gtk_scrolled_window_get_hscrollbar(int /*long*/ scrolled_window) {
+ lock.lock();
+ try {
+ return _gtk_scrolled_window_get_hscrollbar(scrolled_window);
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @param scrolled_window cast=(GtkScrolledWindow *)
* @param hscrollbar_policy cast=(GtkPolicyType *)
@@ -9995,6 +10008,19 @@ public static final int /*long*/ gtk_scrolled_window_get_vadjustment(int /*long*
lock.unlock();
}
}
+/**
+ * @method flags=dynamic
+ * @param scrolled_window cast=(GtkScrolledWindow *)
+ */
+public static final native int /*long*/ _gtk_scrolled_window_get_vscrollbar(int /*long*/ scrolled_window);
+public static final int /*long*/ gtk_scrolled_window_get_vscrollbar(int /*long*/ scrolled_window) {
+ lock.lock();
+ try {
+ return _gtk_scrolled_window_get_vscrollbar(scrolled_window);
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @param hadjustment cast=(GtkAdjustment *)
* @param vadjustment cast=(GtkAdjustment *)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
index cd9e405..fc1b31b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
@@ -455,7 +455,12 @@ void setScrollbar () {
OS.gtk_scrolled_window_set_policy (scrolledHandle, OS.GTK_POLICY_NEVER, policy);
int width = OS.GTK_WIDGET_WIDTH (fixedHandle) - spacing * 2;
if (policy == OS.GTK_POLICY_ALWAYS) {
- int /*long*/ vHandle = OS.GTK_SCROLLED_WINDOW_VSCROLLBAR (scrolledHandle);
+ int /*long*/ vHandle = 0;
+ if (OS.GTK_VERSION < OS.VERSION(2, 8, 0)) {
+ vHandle = OS.GTK_SCROLLED_WINDOW_VSCROLLBAR (scrolledHandle);
+ } else {
+ vHandle = OS.gtk_scrolled_window_get_vscrollbar (scrolledHandle);
+ }
GtkRequisition requisition = new GtkRequisition ();
OS.gtk_widget_size_request (vHandle, requisition);
width -= requisition.width;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
index 6d20f58..5f63d5d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
@@ -136,10 +136,18 @@ ScrollBar createScrollBar (int style) {
bar.display = display;
bar.state |= HANDLE;
if ((style & SWT.H_SCROLL) != 0) {
- bar.handle = OS.GTK_SCROLLED_WINDOW_HSCROLLBAR (scrolledHandle);
+ if (OS.GTK_VERSION < OS.VERSION(2, 8, 0)) {
+ bar.handle = OS.GTK_SCROLLED_WINDOW_HSCROLLBAR (scrolledHandle);
+ } else {
+ bar.handle = OS.gtk_scrolled_window_get_hscrollbar (scrolledHandle);
+ }
bar.adjustmentHandle = OS.gtk_scrolled_window_get_hadjustment (scrolledHandle);
} else {
- bar.handle = OS.GTK_SCROLLED_WINDOW_VSCROLLBAR (scrolledHandle);
+ if (OS.GTK_VERSION < OS.VERSION(2, 8, 0)) {
+ bar.handle = OS.GTK_SCROLLED_WINDOW_VSCROLLBAR (scrolledHandle);
+ } else {
+ bar.handle = OS.gtk_scrolled_window_get_vscrollbar (scrolledHandle);
+ }
bar.adjustmentHandle = OS.gtk_scrolled_window_get_vadjustment (scrolledHandle);
}
bar.setOrientation (true);
@@ -293,7 +301,12 @@ int /*long*/ gtk_scroll_event (int /*long*/ widget, int /*long*/ eventPtr) {
int hScrollBarWidth() {
if (horizontalBar==null) return 0;
- int /*long*/ hBarHandle = OS.GTK_SCROLLED_WINDOW_HSCROLLBAR(scrolledHandle);
+ int /*long*/ hBarHandle = 0;
+ if (OS.GTK_VERSION < OS.VERSION(2, 8, 0)) {
+ hBarHandle = OS.GTK_SCROLLED_WINDOW_HSCROLLBAR (scrolledHandle);
+ } else {
+ hBarHandle = OS.gtk_scrolled_window_get_hscrollbar (scrolledHandle);
+ }
if (hBarHandle==0) return 0;
GtkRequisition requisition = new GtkRequisition();
OS.gtk_widget_size_request(hBarHandle, requisition);
@@ -408,7 +421,12 @@ void updateScrollBarValue (ScrollBar bar) {
int vScrollBarWidth() {
if (verticalBar == null) return 0;
- int /*long*/ vBarHandle = OS.GTK_SCROLLED_WINDOW_VSCROLLBAR(scrolledHandle);
+ int /*long*/ vBarHandle = 0;
+ if (OS.GTK_VERSION < OS.VERSION(2, 8, 0)) {
+ vBarHandle = OS.GTK_SCROLLED_WINDOW_VSCROLLBAR (scrolledHandle);
+ } else {
+ vBarHandle = OS.gtk_scrolled_window_get_vscrollbar (scrolledHandle);
+ }
if (vBarHandle == 0) return 0;
GtkRequisition requisition = new GtkRequisition();
OS.gtk_widget_size_request (vBarHandle, requisition);