summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-08-29 13:42:21 -0400
committerArun Thondapu <arunkumar.thondapu@in.ibm.com>2012-09-12 22:48:49 +0530
commit21331182885d36e87fd7aa26872a15a6f6734271 (patch)
treedb8f497de54b793b2211eb3c87d6063b605e33f7
parente146916783f37aa41636cc83669e5f610cf7343a (diff)
downloadeclipse.platform.swt-21331182885d36e87fd7aa26872a15a6f6734271.tar.gz
eclipse.platform.swt-21331182885d36e87fd7aa26872a15a6f6734271.tar.xz
eclipse.platform.swt-21331182885d36e87fd7aa26872a15a6f6734271.zip
Bug 388369 Use gtk_separator_new () in GTK+3
This patch replaces old GTK2 API methods gtk_vseparator_new () and gtk_hseparator_new () with GTK+ 3 API method gtk_separator_new() and makes old 2 methods dynamic
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c36
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java18
7 files changed, 89 insertions, 5 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 e2b6d7546d..e5d7b05768 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
@@ -9555,7 +9555,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1hseparator_1new)
{
jintLong rc = 0;
OS_NATIVE_ENTER(env, that, _1gtk_1hseparator_1new_FUNC);
+/*
rc = (jintLong)gtk_hseparator_new();
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_hseparator_new)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)();
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gtk_1hseparator_1new_FUNC);
return rc;
}
@@ -12606,6 +12614,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1separator_1menu_1item_1new)
}
#endif
+#ifndef NO__1gtk_1separator_1new
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1separator_1new)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1separator_1new_FUNC);
+/*
+ rc = (jintLong)gtk_separator_new((GtkOrientation)arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_separator_new)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkOrientation))fp)((GtkOrientation)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1separator_1new_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gtk_1separator_1tool_1item_1new
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1separator_1tool_1item_1new)
(JNIEnv *env, jclass that)
@@ -15545,7 +15573,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1vseparator_1new)
{
jintLong rc = 0;
OS_NATIVE_ENTER(env, that, _1gtk_1vseparator_1new_FUNC);
+/*
rc = (jintLong)gtk_vseparator_new();
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_vseparator_new)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)();
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gtk_1vseparator_1new_FUNC);
return rc;
}
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 288a48cf4f..741eeb657c 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
@@ -143,6 +143,9 @@
#define gtk_scrollbar_new_LIB LIB_GTK
#define gtk_hscrollbar_new_LIB LIB_GTK
#define gtk_vscrollbar_new_LIB LIB_GTK
+#define gtk_separator_new_LIB LIB_GTK
+#define gtk_hseparator_new_LIB LIB_GTK
+#define gtk_vseparator_new_LIB LIB_GTK
#define gtk_toolbar_set_orientation_LIB LIB_GTK
#define gtk_tooltip_trigger_tooltip_query_LIB LIB_GTK
#define gtk_tooltips_set_tip_LIB LIB_GTK
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 0ca15f077d..fe80e26f18 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 = 1339;
-int OS_nativeFunctionCallCount[1339];
+int OS_nativeFunctionCount = 1340;
+int OS_nativeFunctionCallCount[1340];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -957,6 +957,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1selection_1data_1free",
"_1gtk_1selection_1data_1set",
"_1gtk_1separator_1menu_1item_1new",
+ "_1gtk_1separator_1new",
"_1gtk_1separator_1tool_1item_1new",
"_1gtk_1separator_1tool_1item_1set_1draw",
"_1gtk_1set_1locale",
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 03201ea558..f336786e61 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
@@ -965,6 +965,7 @@ typedef enum {
_1gtk_1selection_1data_1free_FUNC,
_1gtk_1selection_1data_1set_FUNC,
_1gtk_1separator_1menu_1item_1new_FUNC,
+ _1gtk_1separator_1new_FUNC,
_1gtk_1separator_1tool_1item_1new_FUNC,
_1gtk_1separator_1tool_1item_1set_1draw_FUNC,
_1gtk_1set_1locale_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 4630423a17..2bdb8c00d2 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
@@ -7210,6 +7210,7 @@ public static final int /*long*/ gtk_scrollbar_new(int orientation, int /*long*/
lock.unlock();
}
}
+/** @method flags=dynamic */
public static final native int /*long*/ _gtk_hseparator_new();
public static final int /*long*/ gtk_hseparator_new() {
lock.lock();
@@ -7219,6 +7220,19 @@ public static final int /*long*/ gtk_hseparator_new() {
lock.unlock();
}
}
+/**
+ * @method flags=dynamic
+ * @param orientation cast=(GtkOrientation)
+ */
+public static final native int /*long*/ _gtk_separator_new(int orientation);
+public static final int /*long*/ gtk_separator_new(int orientation) {
+ lock.lock();
+ try {
+ return _gtk_separator_new(orientation);
+ } finally {
+ lock.unlock();
+ }
+}
public static final native int /*long*/ _gtk_status_icon_position_menu_func();
public static final int /*long*/ gtk_status_icon_position_menu_func() {
lock.lock();
@@ -12134,6 +12148,7 @@ public static final int /*long*/ gtk_vscrollbar_new(int /*long*/ adjustment) {
lock.unlock();
}
}
+/** @method flags=dynamic */
public static final native int /*long*/ _gtk_vseparator_new();
public static final int /*long*/ gtk_vseparator_new() {
lock.lock();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java
index 1357fb9c9e..569bd5b822 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java
@@ -37,7 +37,7 @@ public Theme(Device device) {
progressHandle = OS.gtk_progress_bar_new();
toolbarHandle = OS.gtk_toolbar_new();
treeHandle = OS.gtk_tree_view_new_with_model(0);
- separatorHandle = OS.gtk_vseparator_new();
+ separatorHandle = gtk_separator_new (OS.GTK_ORIENTATION_VERTICAL);
labelHandle = OS.gtk_label_new(null);
OS.gtk_container_add (fixedHandle, labelHandle);
OS.gtk_container_add (fixedHandle, frameHandle);
@@ -215,4 +215,18 @@ void transferClipping(GC gc, int /*long*/ style) {
OS.gdk_region_destroy(clipping);
}
}
+
+int /*long*/ gtk_separator_new (int orientation) {
+ int /*long*/ separator = 0;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ separator = OS.gtk_separator_new (orientation);
+ } else {
+ if (orientation == OS.GTK_ORIENTATION_HORIZONTAL) {
+ separator = OS.gtk_hseparator_new ();
+ } else if (orientation == OS.GTK_ORIENTATION_VERTICAL) {
+ separator = OS.gtk_vseparator_new ();
+ }
+ }
+ return separator;
+}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index d4326cdebb..345295fae7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -205,9 +205,9 @@ void createHandle (int index) {
gtk_widget_set_has_window (fixedHandle, true);
if ((style & SWT.SEPARATOR) != 0) {
if ((style & SWT.HORIZONTAL)!= 0) {
- handle = OS.gtk_hseparator_new ();
+ handle = gtk_separator_new (OS.GTK_ORIENTATION_HORIZONTAL);
} else {
- handle = OS.gtk_vseparator_new ();
+ handle = gtk_separator_new (OS.GTK_ORIENTATION_VERTICAL);
}
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
} else {
@@ -584,4 +584,18 @@ void showWidget () {
if (frameHandle != 0) OS.gtk_widget_show (frameHandle);
if (labelHandle != 0) OS.gtk_widget_show (labelHandle);
}
+
+int /*long*/ gtk_separator_new (int orientation) {
+ int /*long*/ separator = 0;
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ separator = OS.gtk_separator_new (orientation);
+ } else {
+ if (orientation == OS.GTK_ORIENTATION_HORIZONTAL) {
+ separator = OS.gtk_hseparator_new ();
+ } else if (orientation == OS.GTK_ORIENTATION_VERTICAL) {
+ separator = OS.gtk_vseparator_new ();
+ }
+ }
+ return separator;
+}
}