summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-09-28 15:28:15 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-09-28 15:28:15 -0400
commit7366e97ab2f5da2c41bc1a647d87b1575264ff01 (patch)
tree5a100ca7489aca9d2335bd631bc968ef3327e16d
parentc7591f1f1e20d7e15b4d710292d8c7ad4e89cff4 (diff)
downloadeclipse.platform.swt-gtk3_font_chooser_new.tar.gz
eclipse.platform.swt-gtk3_font_chooser_new.tar.xz
eclipse.platform.swt-gtk3_font_chooser_new.zip
Replace gtk_font_selection_dialog_new with gtk_font_chooser_dialog_newgtk3_font_chooser_new
This patch replaces gtk_font_selection_dialog_new with gtk_font_chooser_dialog_new for Gtk+ 3.2 and higher.
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-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.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java10
6 files changed, 64 insertions, 2 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 06b011ad96..6dc67a0a4d 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
@@ -8125,7 +8125,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1color_1selection_1dialog_1new)
jintLong rc = 0;
OS_NATIVE_ENTER(env, that, _1gtk_1color_1selection_1dialog_1new_FUNC);
if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+/*
rc = (jintLong)gtk_color_selection_dialog_new((const gchar *)lparg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_color_selection_dialog_new)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(const gchar *))fp)((const gchar *)lparg0);
+ }
+ }
fail:
if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
OS_NATIVE_EXIT(env, that, _1gtk_1color_1selection_1dialog_1new_FUNC);
@@ -9475,6 +9483,30 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1fixed_1set_1has_1window)
}
#endif
+#ifndef NO__1gtk_1font_1chooser_1dialog_1new
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1font_1chooser_1dialog_1new)
+ (JNIEnv *env, jclass that, jbyteArray arg0, jintLong arg1)
+{
+ jbyte *lparg0=NULL;
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1font_1chooser_1dialog_1new_FUNC);
+ if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+/*
+ rc = (jintLong)gtk_font_chooser_dialog_new((const gchar *)lparg0, (GtkWindow *)arg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_font_chooser_dialog_new)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(const gchar *, GtkWindow *))fp)((const gchar *)lparg0, (GtkWindow *)arg1);
+ }
+ }
+fail:
+ if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+ OS_NATIVE_EXIT(env, that, _1gtk_1font_1chooser_1dialog_1new_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gtk_1font_1selection_1dialog_1get_1font_1name
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1font_1selection_1dialog_1get_1font_1name)
(JNIEnv *env, jclass that, jintLong arg0)
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 8944f3f2a5..90ec27975c 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
@@ -90,6 +90,7 @@
#define gtk_cell_layout_set_attributes_LIB LIB_GTK
#define gtk_cell_layout_clear_LIB LIB_GTK
#define gtk_cell_layout_pack_start_LIB LIB_GTK
+#define gtk_color_selection_dialog_new_LIB LIB_GTK
#define gtk_combo_box_entry_new_text_LIB LIB_GTK
#define gtk_combo_box_new_text_LIB LIB_GTK
#define gtk_combo_box_insert_text_LIB LIB_GTK
@@ -237,6 +238,7 @@
#define gtk_widget_set_tooltip_text_LIB LIB_GTK
#define gtk_widget_set_has_window_LIB LIB_GTK
#define gtk_fixed_set_has_window_LIB LIB_GTK
+#define gtk_font_chooser_dialog_new_LIB LIB_GTK
#define gtk_widget_get_mapped_LIB LIB_GTK
#define gtk_widget_get_sensitive_LIB LIB_GTK
#define gtk_widget_get_has_window_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 8356918198..d34e707842 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
@@ -724,6 +724,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1fixed_1move",
"_1gtk_1fixed_1new",
"_1gtk_1fixed_1set_1has_1window",
+ "_1gtk_1font_1chooser_1dialog_1new",
"_1gtk_1font_1selection_1dialog_1get_1font_1name",
"_1gtk_1font_1selection_1dialog_1new",
"_1gtk_1font_1selection_1dialog_1set_1font_1name",
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 b0083a810d..78fb2523e1 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
@@ -734,6 +734,7 @@ typedef enum {
_1gtk_1fixed_1move_FUNC,
_1gtk_1fixed_1new_FUNC,
_1gtk_1fixed_1set_1has_1window_FUNC,
+ _1gtk_1font_1chooser_1dialog_1new_FUNC,
_1gtk_1font_1selection_1dialog_1get_1font_1name_FUNC,
_1gtk_1font_1selection_1dialog_1new_FUNC,
_1gtk_1font_1selection_1dialog_1set_1font_1name_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 39db03127f..56b31c4583 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
@@ -6064,7 +6064,10 @@ public static final long /*int*/ gtk_clipboard_wait_for_contents(long /*int*/ cl
lock.unlock();
}
}
-/** @param title cast=(const gchar *) */
+/**
+ * @method flags=dynamic
+ * @param title cast=(const gchar *)
+ */
public static final native long /*int*/ _gtk_color_selection_dialog_new(byte[] title);
public static final long /*int*/ gtk_color_selection_dialog_new(byte[] title) {
lock.lock();
@@ -6074,6 +6077,21 @@ public static final long /*int*/ gtk_color_selection_dialog_new(byte[] title) {
lock.unlock();
}
}
+
+/**
+ * @method flags=dynamic
+ * @param title cast=(const gchar *)
+ * @param parent cast=(GtkWindow *)
+ */
+public static final native long /*int*/ _gtk_font_chooser_dialog_new(byte[] title, long /*int*/ parent);
+public static final long /*int*/ gtk_font_chooser_dialog_new(byte[] title, long /*int*/ parent) {
+ lock.lock();
+ try {
+ return _gtk_font_chooser_dialog_new(title, parent);
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @param colorsel cast=(GtkColorSelection *)
* @param color cast=(GdkColor *),flags=no_in
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java
index dea297df44..fb91a770f1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java
@@ -126,7 +126,7 @@ public RGB[] getRGBs() {
*/
public RGB open () {
byte [] buffer = Converter.wcsToMbcs (null, title, true);
- long /*int*/ handle = OS.gtk_color_selection_dialog_new (buffer);
+ long /*int*/ handle = gtk_font_chooser_dialog_new (buffer, 0);
Display display = parent != null ? parent.getDisplay (): Display.getCurrent ();
if (parent != null) {
long /*int*/ shellHandle = parent.topHandle ();
@@ -285,4 +285,12 @@ static String[] splitString(String text, char ch) {
}
return substrings;
}
+
+long /*int*/ gtk_font_chooser_dialog_new(byte[] title, long /*int*/ parent) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 2, 0)) {
+ return OS.gtk_font_chooser_dialog_new(title, parent);
+ } else {
+ return OS.gtk_font_selection_dialog_new(title);
+ }
+}
}