diff options
12 files changed, 82 insertions, 10 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 cb1e5307cd..9029c72241 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 @@ -11305,7 +11305,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1box) OS_NATIVE_ENTER(env, that, _1gtk_1paint_1box_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((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, arg9, arg10); +/* + gtk_paint_box(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, arg9, arg10); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_paint_box) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, GdkWindow *, jint, jint, GdkRectangle *, GtkWidget *, const gchar *, jint, jint, jint, jint))fp)(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, arg9, arg10); + } + } fail: if (arg6 && lparg6) (*env)->ReleaseByteArrayElements(env, arg6, lparg6, 0); if (arg4 && lparg4) setGdkRectangleFields(env, arg4, lparg4); @@ -12775,6 +12783,24 @@ fail: } #endif +#ifndef NO__1gtk_1render_1background +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1background) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1render_1background_FUNC); +/* + gtk_render_background(arg0, (cairo_t *)arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_render_background) + 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_1background_FUNC); +} +#endif + #ifndef NO__1gtk_1render_1frame JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1frame) (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 fb918382db..0bb1de9c8e 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 @@ -301,6 +301,7 @@ #define gtk_enumerate_printers_LIB LIB_GTK #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_handle_LIB LIB_GTK #define gtk_paint_hline_LIB LIB_GTK #define gtk_paint_vline_LIB LIB_GTK @@ -377,6 +378,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_background_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 878e6d7812..24aea91661 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 @@ -951,6 +951,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1rc_1style_1set_1color_1flags", "_1gtk_1rc_1style_1set_1fg", "_1gtk_1rc_1style_1set_1text", + "_1gtk_1render_1background", "_1gtk_1render_1frame", "_1gtk_1render_1handle", "_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 40d72c91fd..3b1b9bdbed 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 @@ -961,6 +961,7 @@ typedef enum { _1gtk_1rc_1style_1set_1color_1flags_FUNC, _1gtk_1rc_1style_1set_1fg_FUNC, _1gtk_1rc_1style_1set_1text_FUNC, + _1gtk_1render_1background_FUNC, _1gtk_1render_1frame_FUNC, _1gtk_1render_1handle_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 0bd6d2c121..0fb80d5ebd 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 @@ -8555,6 +8555,23 @@ public static final void gtk_render_frame(long /*int*/ context, long /*int*/ cr, } /** * @method flags=dynamic + * @param cr cast=(cairo_t *) + * @param x cast=(gdouble) + * @param y cast=(gdouble) + * @param width cast=(gdouble) + * @param height cast=(gdouble) + */ +public static final native void _gtk_render_background(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height); +public static final void gtk_render_background(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height) { + lock.lock(); + try { + _gtk_render_background(context, cr, x, y, width, height); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic * @param window cast=(GdkWindow *) * @param widget cast=(GtkWidget *) * @param detail cast=(const gchar *) @@ -8616,7 +8633,7 @@ public static final void gtk_paint_arrow(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/ButtonDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ButtonDrawData.java index 9176d5cbb8..aa6cc69cee 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ButtonDrawData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ButtonDrawData.java @@ -155,7 +155,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) { int relief = OS.gtk_button_get_relief(buttonHandle); byte[] detail = Converter.wcsToMbcs(null, (state & DrawData.DEFAULTED) != 0 ? "buttondefault" : "button", true); if ((state & DrawData.DEFAULTED) != 0 && relief == OS.GTK_RELIEF_NORMAL) { - OS.gtk_paint_box(gtkStyle, drawable, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_IN, null, buttonHandle, detail, x, y, width, height); + gtk_render_box (gtkStyle, drawable, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_IN, null, buttonHandle, detail, x, y, width, height); x += default_border.left; y += default_border.top; width -= default_border.left + default_border.right; @@ -172,7 +172,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) { int state_type = getStateType(DrawData.WIDGET_WHOLE); if (relief != OS.GTK_RELIEF_NONE || ((state & (DrawData.PRESSED | DrawData.HOT)) != 0)) { - OS.gtk_paint_box(gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, x, y, width, height); + gtk_render_box (gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, x, y, width, height); } if ((state & DrawData.FOCUSED) != 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java index dfe64201a5..1bd41ea0cf 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java @@ -58,7 +58,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) { int arrow_y = y + (height - arrow_height) / 2 + 1; if (relief != OS.GTK_RELIEF_NONE || ((state[DrawData.COMBO_ARROW] & (DrawData.PRESSED | DrawData.HOT)) != 0)) { byte[] detail = Converter.wcsToMbcs(null, "button", true); - OS.gtk_paint_box(gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, arrow_button_x, y, arrow_button_width, height); + gtk_render_box (gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, arrow_button_x, y, arrow_button_width, height); } byte[] arrow_detail = Converter.wcsToMbcs(null, "arrow", true); long /*int*/ arrowHandle = theme.arrowHandle; 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 f2539a349f..f6079f84c7 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 @@ -200,4 +200,16 @@ void gtk_render_frame (long /*int*/ style, long /*int*/ window, int state_type, } } +void gtk_render_box (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) { + 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 (context, cairo, x, y, width, height); + OS.gtk_render_background (context, cairo, x, y, width, height); + Cairo.cairo_destroy (cairo); + } else { + OS.gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); + } +} + } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ProgressBarDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ProgressBarDrawData.java index 8103b29919..f18c48934e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ProgressBarDrawData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ProgressBarDrawData.java @@ -28,7 +28,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) { theme.transferClipping(gc, gtkStyle); byte[] detail = Converter.wcsToMbcs(null, "trough", true); int x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height; - OS.gtk_paint_box(gtkStyle, drawable, getStateType(DrawData.WIDGET_WHOLE), OS.GTK_SHADOW_IN, null, progressHandle, detail, x, y, width, height); + gtk_render_box (gtkStyle, drawable, getStateType(DrawData.WIDGET_WHOLE), OS.GTK_SHADOW_IN, null, progressHandle, detail, x, y, width, height); int xthichness = OS.gtk_style_get_xthickness(gtkStyle); int ythichness = OS.gtk_style_get_ythickness(gtkStyle); if ((style & SWT.VERTICAL) != 0) { @@ -47,7 +47,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) { width *= selection / (float)Math.max(1, maximum - minimum); } detail = Converter.wcsToMbcs(null, "bar", true); - OS.gtk_paint_box(gtkStyle, drawable, OS.GTK_STATE_PRELIGHT, OS.GTK_SHADOW_OUT, null, progressHandle, detail, x, y, width, height); + gtk_render_box (gtkStyle, drawable, OS.GTK_STATE_PRELIGHT, OS.GTK_SHADOW_OUT, null, progressHandle, detail, x, y, width, height); } int getStateType(int part) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolBarDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolBarDrawData.java index 584977d6ad..47560151e1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolBarDrawData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolBarDrawData.java @@ -27,7 +27,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) { theme.transferClipping(gc, gtkStyle); int x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height; byte[] detail = Converter.wcsToMbcs(null, "toolbar", true); - OS.gtk_paint_box(gtkStyle, drawable, getStateType(DrawData.WIDGET_WHOLE), OS.GTK_SHADOW_NONE, null, toolbarHandle, detail, x, y, width, height); + gtk_render_box (gtkStyle, drawable, getStateType(DrawData.WIDGET_WHOLE), OS.GTK_SHADOW_NONE, null, toolbarHandle, detail, x, y, width, height); if (clientArea != null) { clientArea.x = bounds.x; clientArea.y = bounds.y; 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 3334180a63..a590c4bb46 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 @@ -106,7 +106,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) { int state_type = getStateType(DrawData.WIDGET_WHOLE); if (relief[0] != OS.GTK_RELIEF_NONE || ((state & (DrawData.PRESSED | DrawData.HOT | DrawData.SELECTED)) != 0)) { - OS.gtk_paint_box(gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, x, y, width, height); + gtk_render_box(gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, x, y, width, height); } if (clientArea != null) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java index fcfc9db3ee..d8dac6457d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java @@ -13,6 +13,7 @@ package org.eclipse.swt.widgets; import org.eclipse.swt.*; import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.events.*; @@ -1260,7 +1261,7 @@ long /*int*/ gtk_expose_event (long /*int*/ widget, long /*int*/ event) { gtk_render_frame (style, window, state, OS.GTK_SHADOW_NONE, area, widget, detail, 0, height [0] - border, width [0], border); gtk_render_frame (style, window, state, OS.GTK_SHADOW_NONE, area, widget, detail, 0, border, border, height [0] - border - border); gtk_render_frame (style, window, state, OS.GTK_SHADOW_NONE, area, widget, detail, width [0] - border, border, border, height [0] - border - border); - gtk_render_frame (style, window, state, OS.GTK_SHADOW_OUT, area, widget, detail, 0, 0, width [0], height [0]); + gtk_render_box (style, window, state, OS.GTK_SHADOW_OUT, area, widget, detail, 0, 0, width [0], height [0]); return 1; } return 0; @@ -2567,4 +2568,16 @@ void setToolTipText (long /*int*/ rootWidget, long /*int*/ tipWidget, String str } } + +void gtk_render_box (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) { + 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 (context, cairo, x, y, width, height); + OS.gtk_render_background (context, cairo, x, y, width, height); + Cairo.cairo_destroy (cairo); + } else { + OS.gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); + } +} } |