From 6a6819c42d1e3be98b1484b2432fe381c3569546 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Wed, 25 Jan 2012 01:15:11 +0200 Subject: Make gdk_pango_context_set_colormap dynamic. This function needs to be called only on GTK versions prior to 2.6. On newer versions the colormap is set automatically. --- bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c | 8 ++++++++ bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h | 1 + .../Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java | 1 + .../Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java | 7 ++++++- .../Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java | 7 ++++++- 5 files changed, 22 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 511f2aa00b..b40a20bb16 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 @@ -5966,7 +5966,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1pango_1context_1set_1colormap) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) { OS_NATIVE_ENTER(env, that, _1gdk_1pango_1context_1set_1colormap_FUNC); +/* gdk_pango_context_set_colormap((PangoContext *)arg0, (GdkColormap *)arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_pango_context_set_colormap) + if (fp) { + ((void (CALLING_CONVENTION*)(PangoContext *, GdkColormap *))fp)((PangoContext *)arg0, (GdkColormap *)arg1); + } + } OS_NATIVE_EXIT(env, that, _1gdk_1pango_1context_1set_1colormap_FUNC); } #endif 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 f52d9290de..ca24b575cd 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 @@ -173,6 +173,7 @@ #define gtk_widget_is_composited_LIB LIB_GTK #define gtk_widget_get_tooltip_text_LIB LIB_GTK #define gtk_widget_set_tooltip_text_LIB LIB_GTK +#define gdk_pango_context_set_colormap_LIB LIB_GDK #define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK #define gdk_x11_screen_lookup_visual_LIB LIB_GDK #define gdk_threads_set_lock_functions_LIB LIB_GDK 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 95aba417a5..bec390a70b 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 @@ -4538,6 +4538,7 @@ public static final int /*long*/ gdk_pango_context_get() { } } /** + * @method flags=dynamic * @param context cast=(PangoContext *) * @param colormap cast=(GdkColormap *) */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java index bf75352497..23f6ec879b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java @@ -612,7 +612,12 @@ void createLayout() { data.layout = layout; OS.pango_context_set_language(context, OS.gtk_get_default_language()); OS.pango_context_set_base_dir(context, (data.style & SWT.MIRRORED) != 0 ? OS.PANGO_DIRECTION_RTL : OS.PANGO_DIRECTION_LTR); - OS.gdk_pango_context_set_colormap(context, OS.gdk_colormap_get_system()); + /* + * Colormap is automatically set for GTK 2.6.0 and newer. + */ + if (OS.GTK_VERSION < OS.VERSION(2, 6, 0)) { + OS.gdk_pango_context_set_colormap(context, OS.gdk_colormap_get_system()); + } if (OS.GTK_VERSION >= OS.VERSION(2, 4, 0)) { OS.pango_layout_set_auto_dir(layout, false); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java index 60fe06088b..7ce8f7f9fb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java @@ -79,7 +79,12 @@ public TextLayout (Device device) { if (context == 0) SWT.error(SWT.ERROR_NO_HANDLES); OS.pango_context_set_language(context, OS.gtk_get_default_language()); OS.pango_context_set_base_dir(context, OS.PANGO_DIRECTION_LTR); - OS.gdk_pango_context_set_colormap(context, OS.gdk_colormap_get_system()); + /* + * Colormap is automatically set for GTK 2.6.0 and newer. + */ + if (OS.GTK_VERSION < OS.VERSION(2, 6, 0)) { + OS.gdk_pango_context_set_colormap(context, OS.gdk_colormap_get_system()); + } layout = OS.pango_layout_new(context); if (layout == 0) SWT.error(SWT.ERROR_NO_HANDLES); OS.pango_layout_set_font_description(layout, device.systemFont.handle); -- cgit v1.2.3