summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-10-15 15:32:21 -0400
committerAlexander Kurtakov <akurtako@redhat.com>2012-10-16 12:00:30 +0300
commit8292090fe3ef8e634ba254763ccf7af619dd517a (patch)
treef11645fd3e81220fa666572adbbbbbc8e790fd58
parent801ec1483559446c0d86f80fed29f2453a706def (diff)
downloadeclipse.platform.swt-8292090fe3ef8e634ba254763ccf7af619dd517a.tar.gz
eclipse.platform.swt-8292090fe3ef8e634ba254763ccf7af619dd517a.tar.xz
eclipse.platform.swt-8292090fe3ef8e634ba254763ccf7af619dd517a.zip
Use gtk_render_arrow instead of gtk_paint_arrow for GTK+ 3
This patch replace gtk_paint_arrow with gtk_render_arrow for GTK+ 3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c28
-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/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java34
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java2
8 files changed, 83 insertions, 4 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 d3a603abea..6f173fea85 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
@@ -11408,7 +11408,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1arrow)
OS_NATIVE_ENTER(env, that, _1gtk_1paint_1arrow_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_arrow((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, arg9, arg10, arg11, arg12);
+/*
+ gtk_paint_arrow(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, arg9, arg10, arg11, arg12);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_paint_arrow)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, GdkWindow *, jint, jint, GdkRectangle *, GtkWidget *, const gchar *, jint, jboolean, jint, jint, jint, jint))fp)(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, arg9, arg10, arg11, arg12);
+ }
+ }
fail:
if (arg6 && lparg6) (*env)->ReleaseByteArrayElements(env, arg6, lparg6, 0);
if (arg4 && lparg4) setGdkRectangleFields(env, arg4, lparg4);
@@ -12959,6 +12967,24 @@ fail:
}
#endif
+#ifndef NO__1gtk_1render_1arrow
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1arrow)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1render_1arrow_FUNC);
+/*
+ gtk_render_arrow(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, arg5);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_render_arrow)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong, gdouble, gdouble, gdouble, jdouble))fp)(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, arg5);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1render_1arrow_FUNC);
+}
+#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)
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 abfce34e01..b0f72ec2db 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
@@ -319,6 +319,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_arrow_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
@@ -404,6 +405,7 @@
#define gtk_render_extension_LIB LIB_GTK
#define gtk_render_expander_LIB LIB_GTK
#define gtk_render_handle_LIB LIB_GTK
+#define gtk_render_arrow_LIB LIB_GTK
#define gtk_render_line_LIB LIB_GTK
#define gtk_render_focus_LIB LIB_GTK
#define gtk_render_frame_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 a446b7c2a9..5a32150dc0 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_1color_1flags",
"_1gtk_1rc_1style_1set_1fg",
"_1gtk_1rc_1style_1set_1text",
+ "_1gtk_1render_1arrow",
"_1gtk_1render_1background",
"_1gtk_1render_1check",
"_1gtk_1render_1expander",
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 4430538a77..ef0b6d6c6e 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_1color_1flags_FUNC,
_1gtk_1rc_1style_1set_1fg_FUNC,
_1gtk_1rc_1style_1set_1text_FUNC,
+ _1gtk_1render_1arrow_FUNC,
_1gtk_1render_1background_FUNC,
_1gtk_1render_1check_FUNC,
_1gtk_1render_1expander_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 0302e0a8f6..7286c755e7 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
@@ -8647,6 +8647,21 @@ public static final void gtk_render_frame(long /*int*/ context, long /*int*/ cr,
}
/**
* @method flags=dynamic
+ * @param angle cast=(gdouble)
+ * @param x cast=(gdouble)
+ * @param y cast=(gdouble)
+ */
+public static final native void _gtk_render_arrow(long /*int*/ context, long /*int*/ cr, double angle, double x , double y, double size);
+public static final void gtk_render_arrow(long /*int*/ context, long /*int*/ cr, double angle, double x , double y, double size) {
+ lock.lock();
+ try {
+ _gtk_render_arrow(context, cr, angle, x, y, size);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @method flags=dynamic
* @param x cast=(gdouble)
* @param y cast=(gdouble)
* @param width cast=(gdouble)
@@ -8806,7 +8821,7 @@ public static final void gtk_paint_option(long /*int*/ style, long /*int*/ windo
}
}
/**
- * @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/ComboDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java
index 1bd41ea0cf..1ebc81c9aa 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
@@ -62,7 +62,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
}
byte[] arrow_detail = Converter.wcsToMbcs(null, "arrow", true);
long /*int*/ arrowHandle = theme.arrowHandle;
- OS.gtk_paint_arrow(gtkStyle, drawable, state_type, OS.GTK_SHADOW_OUT, null, arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height);
+ gtk_render_arrow (gtkStyle, drawable, state_type, OS.GTK_SHADOW_OUT, null, arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height);
long /*int*/ entryHandle = theme.entryHandle;
gtkStyle = OS.gtk_widget_get_style(entryHandle);
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 8d7d44216b..2212fea8d1 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
@@ -241,4 +241,38 @@ void gtk_render_focus (long /*int*/ style, long /*int*/ window, int state_type,
}
}
+void gtk_render_arrow(long /*int*/ style, long /*int*/ window, int state_type, int shadow_type, GdkRectangle area, long /*int*/ widget, byte[] detail, int arrow_type, boolean fill, int x, int y, int width, int height) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ double angle = 0;
+ double size = 0;
+ switch (arrow_type) {
+ case OS.GTK_ARROW_UP:
+ angle = 0;
+ size = width;
+ break;
+ case OS.GTK_ARROW_RIGHT:
+ angle = Math.PI/2;
+ size = height;
+ break;
+ case OS.GTK_ARROW_DOWN:
+ angle = Math.PI;
+ size = width;
+ break;
+ case OS.GTK_ARROW_LEFT:
+ angle = (3 * Math.PI)/2;
+ size = height;
+ break;
+ }
+ long /*int*/ cairo = OS.gdk_cairo_create (window);
+ long /*int*/ context = OS.gtk_widget_get_style_context (style);
+ OS.gtk_style_context_set_state(context, state_type);
+ OS.gtk_render_background(context, cairo, x, y, width, height);
+ OS.gtk_render_frame (context, cairo, x, y, width, height);
+ OS.gtk_render_arrow(context, cairo, angle, x, y, size);
+ Cairo.cairo_destroy(cairo);
+ } else {
+ OS.gtk_paint_arrow(style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height);
+ }
+}
+
}
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 adb13f8c95..f3b4ee27c8 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
@@ -125,7 +125,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
if (interior_focus == 0) arrow_x -= focus_line_width;
int arrow_y = y + (height - arrow_height) / 2;
byte[] arrow_detail = Converter.wcsToMbcs(null, "arrow", true);
- OS.gtk_paint_arrow(gtkStyle, drawable, state_type, OS.GTK_SHADOW_NONE, null, theme.arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height);
+ gtk_render_arrow (gtkStyle, drawable, state_type, OS.GTK_SHADOW_NONE, null, theme.arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height);
if (clientArea != null) {
clientArea.width -= bounds.x + bounds.width - arrow_x;
}