diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-10-05 13:54:10 -0400 |
---|---|---|
committer | Alexander Kurtakov <akurtako@redhat.com> | 2012-10-05 21:29:24 +0300 |
commit | d20287fc0028770d688fd3fc76eadc9c310edecb (patch) | |
tree | ce1ee2b8970a1be65f474541afdddcfadb5ed257 | |
parent | 6b085655091946913301a320f96fff5fdea79bb9 (diff) | |
download | eclipse.platform.swt-d20287fc0028770d688fd3fc76eadc9c310edecb.tar.gz eclipse.platform.swt-d20287fc0028770d688fd3fc76eadc9c310edecb.tar.xz eclipse.platform.swt-d20287fc0028770d688fd3fc76eadc9c310edecb.zip |
Use gtk_render_frame_gap instead of gtk_paint_box_gap for GTK+ 3
6 files changed, 63 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 f1a802a797..8772232767 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 @@ -11365,7 +11365,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1box_1gap) OS_NATIVE_ENTER(env, that, _1gtk_1paint_1box_1gap_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_box_gap((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); +/* + gtk_paint_box_gap(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_paint_box_gap) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, GdkWindow *, jint, jint, GdkRectangle *, GtkWidget *, gchar *, jint, jint, jint, jint, jint, jint, jint))fp)(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); + } + } fail: if (arg6 && lparg6) (*env)->ReleaseByteArrayElements(env, arg6, lparg6, 0); if (arg4 && lparg4) setGdkRectangleFields(env, arg4, lparg4); @@ -12870,6 +12878,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1frame) } #endif +#ifndef NO__1gtk_1render_1frame_1gap +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1frame_1gap) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5, jint arg6, jdouble arg7, jdouble arg8) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1render_1frame_1gap_FUNC); +/* + gtk_render_frame_gap(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5, arg6, (gdouble)arg7, (gdouble)arg8); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_render_frame_gap) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, jintLong, gdouble, gdouble, gdouble, gdouble, jint, gdouble, gdouble))fp)(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5, arg6, (gdouble)arg7, (gdouble)arg8); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1render_1frame_1gap_FUNC); +} +#endif + #ifndef NO__1gtk_1render_1handle JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1handle) (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 bcc864e180..4ec00c8c3c 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 @@ -304,6 +304,7 @@ #define gtk_object_sink_LIB LIB_GTK #define gtk_orientable_set_orientation_LIB LIB_GTK #define gtk_paint_box_LIB LIB_GTK +#define gtk_paint_box_gap_LIB LIB_GTK #define gtk_paint_handle_LIB LIB_GTK #define gtk_paint_hline_LIB LIB_GTK #define gtk_paint_vline_LIB LIB_GTK @@ -382,6 +383,7 @@ #define gtk_render_handle_LIB LIB_GTK #define gtk_render_line_LIB LIB_GTK #define gtk_render_frame_LIB LIB_GTK +#define gtk_render_frame_gap_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 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 cb64404aa7..b67091f790 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 @@ -954,6 +954,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1rc_1style_1set_1text", "_1gtk_1render_1background", "_1gtk_1render_1frame", + "_1gtk_1render_1frame_1gap", "_1gtk_1render_1handle", "_1gtk_1render_1layout", "_1gtk_1render_1line", 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 0a3e2db10c..17673d31b8 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 @@ -964,6 +964,7 @@ typedef enum { _1gtk_1rc_1style_1set_1text_FUNC, _1gtk_1render_1background_FUNC, _1gtk_1render_1frame_FUNC, + _1gtk_1render_1frame_1gap_FUNC, _1gtk_1render_1handle_FUNC, _1gtk_1render_1layout_FUNC, _1gtk_1render_1line_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 aa8ace34b1..6e8f2d0f16 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,24 @@ 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 width cast=(gdouble) + * @param height cast=(gdouble) + * @param xy0_gap cast=(gdouble) + * @param xy1_gap cast=(gdouble) + */ +public static final native void _gtk_render_frame_gap(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height, int gap_side, double xy0_gap, double xy1_gap); +public static final void gtk_render_frame_gap(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height, int gap_side, double xy0_gap, double xy1_gap) { + lock.lock(); + try { + _gtk_render_frame_gap(context, cr, x, y, width, height, gap_side, xy0_gap, xy1_gap); + } finally { + lock.unlock(); + } +} +/** + * @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); @@ -8692,7 +8710,7 @@ public static final void gtk_paint_box(long /*int*/ style, long /*int*/ window, } } /** - * @param style cast=(GtkStyle *) + * @method flags=dynamic * @param window cast=(GdkWindow *) * @param widget cast=(GtkWidget *) * @param detail cast=(gchar *) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/TabFolderDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/TabFolderDrawData.java index 84cabdfd04..8925d453a4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/TabFolderDrawData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/TabFolderDrawData.java @@ -13,6 +13,7 @@ package org.eclipse.swt.internal.theme; import org.eclipse.swt.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 TabFolderDrawData extends DrawData { @@ -44,7 +45,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) { y += tabsHeight; } byte[] detail = Converter.wcsToMbcs(null, "notebook", true); - OS.gtk_paint_box_gap(gtkStyle, drawable, getStateType(DrawData.WIDGET_WHOLE), OS.GTK_SHADOW_OUT, null, notebookHandle, detail, x, y, width, height, gap_side, gap_x, gap_width); + gtk_render_frame_gap (gtkStyle, drawable, getStateType(DrawData.WIDGET_WHOLE), OS.GTK_SHADOW_OUT, null, notebookHandle, detail, x, y, width, height, gap_side, gap_x, gap_width); if (tabsArea != null) { tabsArea.x = bounds.x; tabsArea.y = bounds.y; @@ -64,4 +65,15 @@ int hit(Theme theme, Point position, Rectangle bounds) { return bounds.contains(position) ? DrawData.WIDGET_WHOLE : DrawData.WIDGET_NOWHERE; } +void gtk_render_frame_gap (long /*int*/ style, long /*int*/ window, int state_type, int shadow_type, GdkRectangle area, long /*int*/ widget, byte[] detail, int x , int y, int width, int height, int gap_side, int gap_x, int gap_width) { + 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_frame_gap (context, cairo, context, y, gap_width, height, gap_side, gap_x, gap_x + gap_width); + Cairo.cairo_destroy (cairo); + } else { + OS.gtk_paint_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); + } +} + } |