aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor2012-10-15 16:56:17 (EDT)
committerAlexander Kurtakov2012-10-16 08:41:13 (EDT)
commit4d14d1d7f1ee27438fcb7cae794de91c14605b9e (patch)
treee8c3d0d60381835dfe8e3a0753d458c50827c08d
parent712033c25326bef959a86e71f285bbe0ad256c16 (diff)
downloadeclipse.platform.swt-4d14d1d7f1ee27438fcb7cae794de91c14605b9e.zip
eclipse.platform.swt-4d14d1d7f1ee27438fcb7cae794de91c14605b9e.tar.gz
eclipse.platform.swt-4d14d1d7f1ee27438fcb7cae794de91c14605b9e.tar.bz2
Use gtk_render_frame* instead of gtk_paint_shadow* for GTK+ 3
This patch uses gtk_render_frame and gtk_render_frame_gap instead of gtk_paint_shadow and gtk_paint_shadow_gap
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c20
-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/org/eclipse/swt/internal/gtk/OS.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/GroupDrawData.java15
5 files changed, 50 insertions, 6 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 6f173fe..0cfbb1c 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
@@ -11706,7 +11706,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1shadow)
OS_NATIVE_ENTER(env, that, _1gtk_1paint_1shadow_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_shadow((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10);
+/*
+ gtk_paint_shadow(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_paint_shadow)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, GdkWindow *, jint, jint, GdkRectangle *, GtkWidget *, gchar *, jint, jint, jint, jint))fp)(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10);
+ }
+ }
fail:
if (arg6 && lparg6) (*env)->ReleaseByteArrayElements(env, arg6, lparg6, 0);
if (arg4 && lparg4) setGdkRectangleFields(env, arg4, lparg4);
@@ -11723,7 +11731,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1shadow_1gap)
OS_NATIVE_ENTER(env, that, _1gtk_1paint_1shadow_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_shadow_gap((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13);
+/*
+ gtk_paint_shadow_gap(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_paint_shadow_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);
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 b0f72ec..6e7d750 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
@@ -330,6 +330,8 @@
#define gtk_paint_vline_LIB LIB_GTK
#define gtk_paint_flat_box_LIB LIB_GTK
#define gtk_paint_check_LIB LIB_GTK
+#define gtk_paint_shadow_LIB LIB_GTK
+#define gtk_paint_shadow_gap_LIB LIB_GTK
#define gtk_paint_option_LIB LIB_GTK
#define gtk_paint_layout_LIB LIB_GTK
#define gtk_page_setup_get_bottom_margin_LIB LIB_GTK
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 7286c75..ac7901e 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
@@ -8959,7 +8959,7 @@ public static final void gtk_paint_layout(long /*int*/ style, long /*int*/ windo
}
}
/**
- * @param style cast=(GtkStyle *)
+ * @method flags=dynamic
* @param window cast=(GdkWindow *)
* @param widget cast=(GtkWidget *)
* @param detail cast=(gchar *)
@@ -8974,7 +8974,7 @@ public static final void gtk_paint_shadow_gap(long /*int*/ style, long /*int*/ w
}
}
/**
- * @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/ComboDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java
index 1ebc81c..ec12e88 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
@@ -12,6 +12,7 @@ package org.eclipse.swt.internal.theme;
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 ComboDrawData extends DrawData {
@@ -69,7 +70,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
theme.transferClipping(gc, gtkStyle);
state_type = getStateType(DrawData.WIDGET_WHOLE);
byte[] detail = Converter.wcsToMbcs(null, "entry", true);
- OS.gtk_paint_shadow(gtkStyle, drawable, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_IN, null, entryHandle, detail, x, y, width - arrow_button_width, height);
+ gtk_render_shadow (gtkStyle, drawable, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_IN, null, entryHandle, detail, x, y, width - arrow_button_width, height);
xthickness = OS.gtk_style_get_xthickness(gtkStyle);
ythickness = OS.gtk_style_get_xthickness(gtkStyle);
x += xthickness;
@@ -122,4 +123,16 @@ int hit(Theme theme, Point position, Rectangle bounds) {
return DrawData.WIDGET_WHOLE;
}
+void gtk_render_shadow(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_style_context_save(context);
+ OS.gtk_style_context_set_state (style, state_type);
+ OS.gtk_render_frame (context, cairo, x, y, width, height);
+ Cairo.cairo_destroy (cairo);
+ } else {
+ OS.gtk_paint_shadow(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/GroupDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/GroupDrawData.java
index fa3d414..d13e4c3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/GroupDrawData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/GroupDrawData.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.internal.theme;
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 GroupDrawData extends DrawData {
@@ -39,7 +40,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
byte[] detail = Converter.wcsToMbcs(null, "frame", true);
int gap_x = xthickness + GROUP_X, gap_width = headerWidth + GROUP_PAD * 2, gap_side = OS.GTK_POS_TOP;
int state_type = getStateType(DrawData.WIDGET_WHOLE);
- OS.gtk_paint_shadow_gap(gtkStyle, drawable, state_type, OS.GTK_SHADOW_ETCHED_IN, null, frameHandle, detail, x, y, width, height, gap_side, gap_x, gap_width);
+ gtk_render_shadow_gap (gtkStyle, drawable, state_type, OS.GTK_SHADOW_ETCHED_IN, null, frameHandle, detail, x, y, width, height, gap_side, gap_x, gap_width);
if (headerArea != null) {
headerArea.x = bounds.x + gap_x + GROUP_PAD;
headerArea.y = bounds.y;
@@ -65,4 +66,16 @@ int hit(Theme theme, Point position, Rectangle bounds) {
return bounds.contains(position) ? DrawData.WIDGET_WHOLE : DrawData.WIDGET_NOWHERE;
}
+void gtk_render_shadow_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_style_context_save (context);
+ OS.gtk_style_context_set_state (context, state_type);
+ 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_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
+ }
+}
}