Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor2012-10-05 16:04:46 +0000
committerAlexander Kurtakov2012-10-05 17:00:38 +0000
commitfced94f9eb057f73fb291e17160f948c0221a298 (patch)
treedbe4d464a9de3541e8e6c0e5946509d483b9e9a0
parentccfbe1d755ec8867af82b207cc663c1af09c8cf5 (diff)
downloadeclipse.platform.swt-fced94f9eb057f73fb291e17160f948c0221a298.tar.gz
eclipse.platform.swt-fced94f9eb057f73fb291e17160f948c0221a298.tar.xz
eclipse.platform.swt-fced94f9eb057f73fb291e17160f948c0221a298.zip
Use gtk_render_layout instead of gtk_paint_layout for GTK+3 and higher
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c28
-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.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java14
6 files changed, 60 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 5a6eda239c..f1a802a797 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
@@ -11523,7 +11523,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1layout)
OS_NATIVE_ENTER(env, that, _1gtk_1paint_1layout_FUNC);
if (arg4) if ((lparg4 = getGdkRectangleFields(env, arg4, &_arg4)) == NULL) goto fail;
if (arg6) if ((lparg6 = (*env)->GetByteArrayElements(env, arg6, NULL)) == NULL) goto fail;
- gtk_paint_layout((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, (PangoLayout *)arg9);
+/*
+ gtk_paint_layout(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, (PangoLayout *)arg9);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_paint_layout)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, GdkWindow *, jint, jboolean, GdkRectangle *, GtkWidget *, const gchar *, jint, jint, PangoLayout *))fp)(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, (PangoLayout *)arg9);
+ }
+ }
fail:
if (arg6 && lparg6) (*env)->ReleaseByteArrayElements(env, arg6, lparg6, 0);
if (arg4 && lparg4) setGdkRectangleFields(env, arg4, lparg4);
@@ -12880,6 +12888,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1handle)
}
#endif
+#ifndef NO__1gtk_1render_1layout
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1layout)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3, jintLong arg4)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1render_1layout_FUNC);
+/*
+ gtk_render_layout(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (PangoLayout *)arg4);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_render_layout)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong, gdouble, gdouble, PangoLayout *))fp)(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (PangoLayout *)arg4);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1render_1layout_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1render_1line
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1line)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5)
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 398622cb54..bcc864e180 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
@@ -309,6 +309,7 @@
#define gtk_paint_vline_LIB LIB_GTK
#define gtk_paint_flat_box_LIB LIB_GTK
#define gtk_paint_option_LIB LIB_GTK LIB_GTK
+#define gtk_paint_layout_LIB LIB_GTK
#define gtk_page_setup_get_bottom_margin_LIB LIB_GTK
#define gtk_page_setup_get_left_margin_LIB LIB_GTK
#define gtk_page_setup_get_orientation_LIB LIB_GTK
@@ -383,6 +384,7 @@
#define gtk_render_frame_LIB LIB_GTK
#define gtk_render_background_LIB LIB_GTK
#define gtk_render_option_LIB LIB_GTK LIB_GTK
+#define gtk_render_layout_LIB LIB_GTK
#define gtk_progress_bar_set_inverted_LIB LIB_GTK
#define gtk_progress_bar_set_orientation_LIB LIB_GTK
#define ubuntu_menu_proxy_get_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 2990feb813..cb64404aa7 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
@@ -955,6 +955,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1render_1background",
"_1gtk_1render_1frame",
"_1gtk_1render_1handle",
+ "_1gtk_1render_1layout",
"_1gtk_1render_1line",
"_1gtk_1render_1option",
"_1gtk_1scale_1new",
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 dd042cfd75..0a3e2db10c 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_1render_1background_FUNC,
_1gtk_1render_1frame_FUNC,
_1gtk_1render_1handle_FUNC,
+ _1gtk_1render_1layout_FUNC,
_1gtk_1render_1line_FUNC,
_1gtk_1render_1option_FUNC,
_1gtk_1scale_1new_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 46d1769d06..aa8ace34b1 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
@@ -8571,6 +8571,21 @@ public static final void gtk_render_frame(long /*int*/ context, long /*int*/ cr,
* @method flags=dynamic
* @param x cast=(gdouble)
* @param y cast=(gdouble)
+ * @param layout cast=(PangoLayout *)
+ */
+public static final native void _gtk_render_layout(long /*int*/ context, long /*int*/ cr, double x , double y, long /*int*/ layout);
+public static final void gtk_render_layout(long /*int*/ context, long /*int*/ cr, double x , double y, long /*int*/ layout) {
+ lock.lock();
+ try {
+ _gtk_render_layout(context, cr, x, y, layout);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @method flags=dynamic
+ * @param x cast=(gdouble)
+ * @param y cast=(gdouble)
* @param width cast=(gdouble)
* @param height cast=(gdouble)
*/
@@ -8752,7 +8767,7 @@ public static final void gtk_paint_hline(long /*int*/ style, long /*int*/ window
}
}
/**
- * @param style cast=(GtkStyle *)
+ * @method flags=dynamic
* @param window cast=(GdkWindow *)
* @param widget cast=(GtkWidget *)
* @param detail cast=(const gchar *)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java
index f6079f84c7..7156184b0f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java
@@ -135,7 +135,7 @@ void drawText(Theme theme, String text, int flags, GC gc, Rectangle bounds) {
}
int state_type = getStateType(DrawData.WIDGET_WHOLE);
byte[] detail = Converter.wcsToMbcs(null, "label", true);
- OS.gtk_paint_layout(gtkStyle, drawable, state_type, false, null, widget, detail, x, y, layout);
+ gtk_render_layout(gtkStyle, drawable, state_type, false, null, widget, detail, x, y, layout);
OS.g_object_unref(layout);
}
@@ -212,4 +212,16 @@ void gtk_render_box (long /*int*/ style, long /*int*/ window, int state_type, in
}
}
+
+void gtk_render_layout (long /*int*/ style, long /*int*/ window, int state_type, boolean use_text, GdkRectangle area, long /*int*/ widget, byte[] detail, int x , int y, long /*int*/ layout) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ long /*int*/ cairo = OS.gdk_cairo_create (window);
+ long /*int*/ context = OS.gtk_widget_get_style_context (style);
+ OS.gtk_render_layout (context, cairo, x, y, layout);
+ Cairo.cairo_destroy (cairo);
+ } else {
+ OS.gtk_paint_layout (style, window, state_type, use_text, area, widget, detail, x , y, layout);
+ }
+}
+
}

Back to the top