diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-09-04 13:42:36 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-09-04 13:42:36 -0400 |
commit | 56511d68e3227c4aa43be7fc9889df06c5cc5b58 (patch) | |
tree | 117b22e8e1457f303ba55e5315d1657eb4169a6a | |
parent | 701a9c9f370c848f128ac2ab9ae7a599771e0cf7 (diff) | |
download | eclipse.platform.swt-gtk3_render_line.tar.gz eclipse.platform.swt-gtk3_render_line.tar.xz eclipse.platform.swt-gtk3_render_line.zip |
Use gtk_redner_line() instead of gtk_paint_vline/hline for GTK+3gtk3_render_line
6 files changed, 111 insertions, 7 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 90c1ebac16..bad8d15ab5 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 @@ -11039,7 +11039,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1hline) OS_NATIVE_ENTER(env, that, _1gtk_1paint_1hline_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_hline((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, lparg3, (GtkWidget *)arg4, (const gchar *)lparg5, arg6, arg7, arg8); +/* + gtk_paint_hline(arg0, (GdkWindow *)arg1, arg2, lparg3, (GtkWidget *)arg4, (const gchar *)lparg5, arg6, arg7, arg8); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_paint_hline) + 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); @@ -11124,7 +11132,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1vline) OS_NATIVE_ENTER(env, that, _1gtk_1paint_1vline_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_vline((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, lparg3, (GtkWidget *)arg4, (const gchar *)lparg5, arg6, arg7, arg8); +/* + gtk_paint_vline(arg0, (GdkWindow *)arg1, arg2, lparg3, (GtkWidget *)arg4, (const gchar *)lparg5, arg6, arg7, arg8); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_paint_vline) + 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); @@ -12317,6 +12333,24 @@ fail: } #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) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1render_1line_FUNC); +/* + gtk_render_line(arg0, (cairo_t *)arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_render_line) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, cairo_t *, gdouble, gdouble, gdouble, gdouble))fp)(arg0, (cairo_t *)arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1render_1line_FUNC); +} +#endif + #ifndef NO__1gtk_1scale_1set_1digits JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1scale_1set_1digits) (JNIEnv *env, jclass that, jintLong arg0, jint arg1) @@ -15780,6 +15814,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1style) } #endif +#ifndef NO__1gtk_1widget_1get_1style_1context +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1style_1context) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1style_1context_FUNC); +/* + rc = (jintLong)gtk_widget_get_style_context((GtkWidget *)arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_get_style_context) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkWidget *))fp)((GtkWidget *)arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1style_1context_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1widget_1get_1tooltip_1text JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1tooltip_1text) (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 09073e9c3e..77dceadfac 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 @@ -222,6 +222,7 @@ #define gtk_widget_get_realized_LIB LIB_GTK #define gtk_widget_get_can_default_LIB LIB_GTK #define gtk_widget_get_window_LIB LIB_GTK +#define gtk_widget_get_style_context_LIB LIB_GTK #define gtk_widget_set_can_default_LIB LIB_GTK #define gtk_widget_set_can_focus_LIB LIB_GTK #define gtk_widget_set_mapped_LIB LIB_GTK @@ -229,6 +230,7 @@ #define gtk_widget_set_receives_default_LIB LIB_GTK #define gtk_widget_set_visible_LIB LIB_GTK #define gtk_range_get_slider_range_LIB LIB_GTK +#define gtk_render_line_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 @@ -291,6 +293,8 @@ #define gtk_paper_size_new_LIB LIB_GTK #define gtk_paper_size_new_custom_LIB LIB_GTK #define gtk_paper_size_new_from_ppd_LIB LIB_GTK +#define gtk_paint_hline_LIB LIB_GTK +#define gtk_paint_vline_LIB LIB_GTK #define gtk_print_job_get_printer_LIB LIB_GTK #define gtk_print_job_get_settings_LIB LIB_GTK #define gtk_print_job_get_status_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 119f1c66aa..70ddda7d9a 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 @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1335; -int OS_nativeFunctionCallCount[1335]; +int OS_nativeFunctionCount = 1337; +int OS_nativeFunctionCallCount[1337]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -938,6 +938,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1rc_1style_1set_1color_1flags", "_1gtk_1rc_1style_1set_1fg", "_1gtk_1rc_1style_1set_1text", + "_1gtk_1render_1line", "_1gtk_1scale_1set_1digits", "_1gtk_1scale_1set_1draw_1value", "_1gtk_1scrolled_1window_1add_1with_1viewport", @@ -1239,6 +1240,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1widget_1get_1sensitive", "_1gtk_1widget_1get_1size_1request", "_1gtk_1widget_1get_1style", + "_1gtk_1widget_1get_1style_1context", "_1gtk_1widget_1get_1tooltip_1text", "_1gtk_1widget_1get_1toplevel", "_1gtk_1widget_1get_1visible", 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 20250dbe2b..7e7a9a9bc3 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 @@ -946,6 +946,7 @@ typedef enum { _1gtk_1rc_1style_1set_1color_1flags_FUNC, _1gtk_1rc_1style_1set_1fg_FUNC, _1gtk_1rc_1style_1set_1text_FUNC, + _1gtk_1render_1line_FUNC, _1gtk_1scale_1set_1digits_FUNC, _1gtk_1scale_1set_1draw_1value_FUNC, _1gtk_1scrolled_1window_1add_1with_1viewport_FUNC, @@ -1247,6 +1248,7 @@ typedef enum { _1gtk_1widget_1get_1sensitive_FUNC, _1gtk_1widget_1get_1size_1request_FUNC, _1gtk_1widget_1get_1style_FUNC, + _1gtk_1widget_1get_1style_1context_FUNC, _1gtk_1widget_1get_1tooltip_1text_FUNC, _1gtk_1widget_1get_1toplevel_FUNC, _1gtk_1widget_1get_1visible_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 c2310b7878..e49cde714c 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 @@ -8437,7 +8437,7 @@ public static final void gtk_paint_extension(int /*long*/ style, int /*long*/ wi } } /** - * @param style cast=(GtkStyle *) + * @method flags=dynamic * @param window cast=(GdkWindow *) * @param widget cast=(GtkWidget *) * @param detail cast=(const gchar *) @@ -8498,7 +8498,7 @@ public static final void gtk_paint_shadow(int /*long*/ style, int /*long*/ windo } } /** - * @param style cast=(GtkStyle *) + * @method flags=dynamic * @param window cast=(GdkWindow *) * @param widget cast=(GtkWidget *) * @param detail cast=(const gchar *) @@ -8512,6 +8512,23 @@ public static final void gtk_paint_vline(int /*long*/ style, int /*long*/ window lock.unlock(); } } +/** + * @method flags=dynamic + * @param cr cast=(cairo_t *) + * @param x0 cast=(gdouble) + * @param y0 cast=(gdouble) + * @param x1 cast=(gdouble) + * @param y1 cast=(gdouble) + */ +public static final native void _gtk_render_line(int /*long*/ context, int /*long*/ cr, double x0, double y0, double x1, double y1); +public static final void gtk_render_line(int /*long*/ context, int /*long*/ cr, double x0, double y0, double x1, double y1) { + lock.lock(); + try { + _gtk_render_line(context, cr, x0, y0, x1, y1); + } finally { + lock.unlock(); + } +} /** @method flags=dynamic */ public static final native void _gtk_paper_size_free(int /*long*/ size); public static final void gtk_paper_size_free(int /*long*/ size) { @@ -12327,6 +12344,19 @@ public static final int /*long*/ gtk_widget_get_style(int /*long*/ widget) { } } /** + * @method flags=dynamic + * @param widget cast=(GtkWidget *) + */ +public static final native int /*long*/ _gtk_widget_get_style_context(int /*long*/ widget); +public static final int /*long*/ gtk_widget_get_style_context(int /*long*/ widget) { + lock.lock(); + try { + return _gtk_widget_get_style_context(widget); + } finally { + lock.unlock(); + } +} +/** * @param widget cast=(GtkWidget *) * @param width cast=(gint *) * @param height cast=(gint *) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java index 67cc405d4f..9fbdfbb7ba 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java @@ -56,9 +56,21 @@ void draw(Theme theme, GC gc, Rectangle bounds) { int /*long*/ gtkStyle = OS.gtk_widget_get_style (separatorHandle); theme.transferClipping(gc, gtkStyle); if ((parent.style & SWT.VERTICAL) != 0) { - OS.gtk_paint_hline(gtkStyle, drawable, state_type, null, separatorHandle, detail, bounds.x, bounds.x + bounds.width, bounds.y + bounds.height / 2); + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + int /*long*/ cairo = OS.gdk_cairo_create(drawable); + int /*long*/ context = OS.gtk_widget_get_style_context(separatorHandle); + OS.gtk_render_line(context, cairo, bounds.x, bounds.y + bounds.height / 2, bounds.x + bounds.width, bounds.y + bounds.height / 2); + } else { + OS.gtk_paint_hline(gtkStyle, drawable, state_type, null, separatorHandle, detail, bounds.x, bounds.x + bounds.width, bounds.y + bounds.height / 2); + } } else { + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + int /*long*/ cairo = OS.gdk_cairo_create(drawable); + int /*long*/ context = OS.gtk_widget_get_style_context(separatorHandle); + OS.gtk_render_line(context, cairo, bounds.x + bounds.width / 2, bounds.y, bounds.x + bounds.width / 2, bounds.y + bounds.height); + } else { OS.gtk_paint_vline(gtkStyle, drawable, state_type, null, separatorHandle, detail, bounds.y, bounds.y + bounds.height, bounds.x + bounds.width / 2); + } } return; } |