summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-08-29 13:42:21 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-08-29 13:42:21 -0400
commit7162aa1f1d96b03611b30e77257c9c582c5957d1 (patch)
treec14da5ceb774c2f0330cd257e4147df37b6c051d
parent742806238aa69633cd6fc8812a666523c4c7585d (diff)
downloadeclipse.platform.swt-gtk3_separator_new.tar.gz
eclipse.platform.swt-gtk3_separator_new.tar.xz
eclipse.platform.swt-gtk3_separator_new.zip
Use gtk_separator_new () in GTK+3gtk3_separator_new
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 90c1ebac16..e0d6fe8649 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
@@ -9493,7 +9493,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;
}
@@ -12504,6 +12512,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)
@@ -15419,7 +15447,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 09073e9c3e..29174033b0 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
@@ -136,6 +136,9 @@
#define gtk_menu_tool_button_new_LIB LIB_GTK
#define gtk_window_set_keep_below_LIB LIB_GTK
#define gtk_set_locale_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 119f1c66aa..f6256d9c48 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",
@@ -953,6 +953,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 20250dbe2b..e16e6f3045 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
@@ -961,6 +961,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 c2310b7878..8362965998 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
@@ -7149,6 +7149,7 @@ public static final int /*long*/ gtk_hscrollbar_new(int /*long*/ adjustment) {
lock.unlock();
}
}
+/** @method flags=dynamic */
public static final native int /*long*/ _gtk_hseparator_new();
public static final int /*long*/ gtk_hseparator_new() {
lock.lock();
@@ -7158,6 +7159,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();
@@ -12066,6 +12080,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 4885a1b520..956a554cce 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;
+}
}