summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-09-28 15:52:59 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-09-28 15:52:59 -0400
commit31de9190b5c45d25e232406da9f6fb03f6037a08 (patch)
tree84a6a3bd31fdafc5c8c6b69c18424bcb4931b8c9
parentc7591f1f1e20d7e15b4d710292d8c7ad4e89cff4 (diff)
downloadeclipse.platform.swt-gtk3_set_font.tar.gz
eclipse.platform.swt-gtk3_set_font.tar.xz
eclipse.platform.swt-gtk3_set_font.zip
Replace gtk_font_selection_dialog_set_font_name with GtkFontChoosergtk3_set_font
This patch replaces gtk_font_selection_dialog_set_font_name with gtk_font_chooser_set_font 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.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java11
6 files changed, 59 insertions, 3 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..896cfc3c24 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
@@ -9475,6 +9475,28 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1fixed_1set_1has_1window)
}
#endif
+#ifndef NO__1gtk_1font_1chooser_1set_1font
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1font_1chooser_1set_1font)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
+{
+ jbyte *lparg1=NULL;
+ OS_NATIVE_ENTER(env, that, _1gtk_1font_1chooser_1set_1font_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+/*
+ gtk_font_chooser_set_font(arg0, (const gchar *)lparg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_font_chooser_set_font)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, const gchar *))fp)(arg0, (const gchar *)lparg1);
+ }
+ }
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ OS_NATIVE_EXIT(env, that, _1gtk_1font_1chooser_1set_1font_FUNC);
+}
+#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)
@@ -9511,7 +9533,15 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1font_1selection_1dialog_1set_1font_1
jboolean rc = 0;
OS_NATIVE_ENTER(env, that, _1gtk_1font_1selection_1dialog_1set_1font_1name_FUNC);
if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
- rc = (jboolean)gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)arg0, (const gchar *)lparg1);
+/*
+ rc = (jboolean)gtk_font_selection_dialog_set_font_name(arg0, (const gchar *)lparg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_font_selection_dialog_set_font_name)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong, const gchar *))fp)(arg0, (const gchar *)lparg1);
+ }
+ }
fail:
if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
OS_NATIVE_EXIT(env, that, _1gtk_1font_1selection_1dialog_1set_1font_1name_FUNC);
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..a41e801c3f 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
@@ -102,6 +102,8 @@
#define gtk_combo_box_popdown_LIB LIB_GTK
#define gtk_entry_text_index_to_layout_index_LIB LIB_GTK
#define gtk_entry_get_inner_border_LIB LIB_GTK
+#define gtk_font_chooser_set_font_LIB LIB_GTK
+#define gtk_font_selection_dialog_set_font_name_LIB LIB_GTK
#define gtk_file_chooser_add_filter_LIB LIB_GTK
#define gtk_file_chooser_dialog_new_LIB LIB_GTK
#define gtk_file_chooser_get_current_folder_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..86962a80f1 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_1set_1font",
"_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..5e3caf5268 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_1set_1font_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..e985e4ccda 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
@@ -7108,7 +7108,7 @@ public static final long /*int*/ gtk_font_selection_dialog_new(byte[] title) {
}
}
/**
- * @param fsd cast=(GtkFontSelectionDialog *)
+ * @method flags=dynamic
* @param fontname cast=(const gchar *)
*/
public static final native boolean _gtk_font_selection_dialog_set_font_name(long /*int*/ fsd, byte[] fontname);
@@ -7120,6 +7120,19 @@ public static final boolean gtk_font_selection_dialog_set_font_name(long /*int*/
lock.unlock();
}
}
+/**
+ * @method flags=dynamic
+ * @param fontname cast=(const gchar *)
+ */
+public static final native void _gtk_font_chooser_set_font(long /*int*/ fsd, byte[] fontname);
+public static final void gtk_font_chooser_set_font(long /*int*/ fsd, byte[] fontname) {
+ lock.lock();
+ try {
+ _gtk_font_chooser_set_font(fsd, fontname);
+ } finally {
+ lock.unlock();
+ }
+}
/** @param label cast=(const gchar *) */
public static final native long /*int*/ _gtk_frame_new(byte[] label);
public static final long /*int*/ gtk_frame_new(byte[] label) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java
index 905110d34d..e2c6dcfae2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java
@@ -178,7 +178,7 @@ public FontData open () {
OS.memmove (buffer, fontName, length);
font.dispose();
OS.g_free (fontName);
- OS.gtk_font_selection_dialog_set_font_name (handle, buffer);
+ gtk_font_chooser_set_font (handle, buffer);
}
display.addIdleProc ();
Dialog oldModal = null;
@@ -284,4 +284,13 @@ public void setFontList (FontData [] fontData) {
public void setRGB (RGB rgb) {
this.rgb = rgb;
}
+
+void gtk_font_chooser_set_font(long /*int*/ fsd, byte[] fontname) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 2, 0)) {
+ OS.gtk_font_chooser_set_font(fsd, fontname);
+ } else {
+ OS.gtk_font_selection_dialog_set_font_name(fsd, fontname);
+ }
}
+}
+