diff options
author | Anatoly Spektor | 2012-10-12 21:16:47 +0000 |
---|---|---|
committer | Arun Thondapu | 2012-10-15 06:42:57 +0000 |
commit | 10f582427b55ec27f4cfe49dc45699d6a4b5a631 (patch) | |
tree | 0ac48aa50b7fbe69d2b175775100dfcecd8d72fc | |
parent | b16cc7ac5911d04bae872f4c5c032f451e75a127 (diff) | |
download | eclipse.platform.swt-10f582427b55ec27f4cfe49dc45699d6a4b5a631.tar.gz eclipse.platform.swt-10f582427b55ec27f4cfe49dc45699d6a4b5a631.tar.xz eclipse.platform.swt-10f582427b55ec27f4cfe49dc45699d6a4b5a631.zip |
Use gtk_render_expander () instead of gtk_paint_expander () for GTK+ 3
This patch replaces gtk_paint_expander () with gtk_paint_expander () for
GTK+3.
6 files changed, 57 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 aeab8e68b7..e7189e8696 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 @@ -11479,7 +11479,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1expander) OS_NATIVE_ENTER(env, that, _1gtk_1paint_1expander_FUNC); if (arg3) if ((lparg3 = getGdkRectangleFields(env, arg3, &_arg3)) == NULL) goto fail; if (arg5) if ((lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL)) == NULL) goto fail; - gtk_paint_expander((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, lparg3, (GtkWidget *)arg4, (const gchar *)lparg5, arg6, arg7, arg8); +/* + gtk_paint_expander(arg0, (GdkWindow *)arg1, arg2, lparg3, (GtkWidget *)arg4, (const gchar *)lparg5, arg6, arg7, arg8); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_paint_expander) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, GdkWindow *, jint, GdkRectangle *, GtkWidget *, const gchar *, jint, jint, jint))fp)(arg0, (GdkWindow *)arg1, arg2, lparg3, (GtkWidget *)arg4, (const gchar *)lparg5, arg6, arg7, arg8); + } + } fail: if (arg5 && lparg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0); if (arg3 && lparg3) setGdkRectangleFields(env, arg3, lparg3); @@ -12958,6 +12966,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1check) } #endif +#ifndef NO__1gtk_1render_1expander +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1expander) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1render_1expander_FUNC); +/* + gtk_render_expander(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_render_expander) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, jintLong, gdouble, gdouble, gdouble, gdouble))fp)(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1render_1expander_FUNC); +} +#endif + #ifndef NO__1gtk_1render_1focus JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1focus) (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 b4b96bc1ab..65837501a2 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 @@ -321,6 +321,7 @@ #define gtk_paint_box_gap_LIB LIB_GTK #define gtk_paint_handle_LIB LIB_GTK #define gtk_paint_focus_LIB LIB_GTK +#define gtk_paint_expander_LIB LIB_GTK #define gtk_paint_hline_LIB LIB_GTK #define gtk_paint_vline_LIB LIB_GTK #define gtk_paint_flat_box_LIB LIB_GTK @@ -397,6 +398,7 @@ #define gtk_printer_get_name_LIB LIB_GTK #define gtk_printer_is_default_LIB LIB_GTK #define gtk_render_check_LIB LIB_GTK +#define gtk_render_expander_LIB LIB_GTK #define gtk_render_handle_LIB LIB_GTK #define gtk_render_line_LIB LIB_GTK #define gtk_render_focus_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 2e93db0168..6dc1639b92 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 @@ -956,6 +956,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1rc_1style_1set_1text", "_1gtk_1render_1background", "_1gtk_1render_1check", + "_1gtk_1render_1expander", "_1gtk_1render_1focus", "_1gtk_1render_1frame", "_1gtk_1render_1frame_1gap", 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 64c93e3041..96b2ee735e 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 @@ -966,6 +966,7 @@ typedef enum { _1gtk_1rc_1style_1set_1text_FUNC, _1gtk_1render_1background_FUNC, _1gtk_1render_1check_FUNC, + _1gtk_1render_1expander_FUNC, _1gtk_1render_1focus_FUNC, _1gtk_1render_1frame_FUNC, _1gtk_1render_1frame_1gap_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 a8edc1713b..0ce81c03dc 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 @@ -8635,6 +8635,22 @@ public static final void gtk_render_frame(long /*int*/ context, long /*int*/ cr, * @param y cast=(gdouble) * @param width cast=(gdouble) * @param height cast=(gdouble) + */ +public static final native void _gtk_render_expander(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height); +public static final void gtk_render_expander(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height) { + lock.lock(); + try { + _gtk_render_expander(context, cr, x, y, width, height); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic + * @param x cast=(gdouble) + * @param y cast=(gdouble) + * @param width cast=(gdouble) + * @param height cast=(gdouble) * @param xy0_gap cast=(gdouble) * @param xy1_gap cast=(gdouble) */ @@ -8834,7 +8850,7 @@ public static final void gtk_render_check(long /*int*/ context, long /*int*/ cai } } /** - * @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/ExpanderDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ExpanderDrawData.java index 3f98b5077b..734df12873 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ExpanderDrawData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ExpanderDrawData.java @@ -13,6 +13,7 @@ package org.eclipse.swt.internal.theme; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; public class ExpanderDrawData extends DrawData { @@ -33,7 +34,14 @@ void draw(Theme theme, GC gc, Rectangle bounds) { int expander_size = theme.getWidgetProperty(treeHandle, "expander-size"); int x = bounds.x + expander_size / 2; int y = bounds.y + expander_size / 2; - OS.gtk_paint_expander(gtkStyle, drawable, state_type, null, treeHandle, detail, x, y, expander_style); + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + long /*int*/ cairo = OS.gdk_cairo_create (drawable); + long /*int*/ context = OS.gtk_widget_get_style_context (gtkStyle); + OS.gtk_render_expander (context, cairo, bounds.x, bounds.y, expander_size, expander_size); + Cairo.cairo_destroy (cairo); + } else { + OS.gtk_paint_expander(gtkStyle, drawable, state_type, null, treeHandle, detail, x, y, expander_style); + } } int hit(Theme theme, Point position, Rectangle bounds) { |