summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorAnatoly Spektor2012-10-04 13:12:41 (EDT)
committer Alexander Kurtakov2012-10-04 13:55:23 (EDT)
commited18df252bb05902f6e134f9ab9e155c5cd00356 (patch)
tree57f5aa8390d8a25e73ed725b4f46a53f700443a0
parent41b28fb69b28913e45dadfb38d783336ab3b6dcc (diff)
downloadeclipse.platform.swt-ed18df252bb05902f6e134f9ab9e155c5cd00356.zip
eclipse.platform.swt-ed18df252bb05902f6e134f9ab9e155c5cd00356.tar.gz
eclipse.platform.swt-ed18df252bb05902f6e134f9ab9e155c5cd00356.tar.bz2
Use gtk_redner_line() instead of gtk_paint_vline/hline for GTK+3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h3
-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.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java19
6 files changed, 77 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 a27a60f..697fca1 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
@@ -11447,7 +11447,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);
@@ -11532,7 +11540,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);
@@ -12769,6 +12785,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1handle)
}
#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_1new
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1scale_1new)
(JNIEnv *env, jclass that, jint arg0, jintLong arg1)
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 ba01726..6ce95cd 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
@@ -302,6 +302,8 @@
#define gtk_object_sink_LIB LIB_GTK
#define gtk_orientable_set_orientation_LIB LIB_GTK
#define gtk_paint_handle_LIB LIB_GTK
+#define gtk_paint_hline_LIB LIB_GTK
+#define gtk_paint_vline_LIB LIB_GTK
#define gtk_page_setup_get_bottom_margin_LIB LIB_GTK
#define gtk_page_setup_get_left_margin_LIB LIB_GTK
#define gtk_page_setup_get_orientation_LIB LIB_GTK
@@ -372,6 +374,7 @@
#define gtk_printer_get_name_LIB LIB_GTK
#define gtk_printer_is_default_LIB LIB_GTK
#define gtk_render_handle_LIB LIB_GTK
+#define gtk_render_line_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 b789623..39ab44a 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
@@ -952,6 +952,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1rc_1style_1set_1fg",
"_1gtk_1rc_1style_1set_1text",
"_1gtk_1render_1handle",
+ "_1gtk_1render_1line",
"_1gtk_1scale_1new",
"_1gtk_1scale_1set_1digits",
"_1gtk_1scale_1set_1draw_1value",
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 20986ca..98ce7b0 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
@@ -962,6 +962,7 @@ typedef enum {
_1gtk_1rc_1style_1set_1fg_FUNC,
_1gtk_1rc_1style_1set_1text_FUNC,
_1gtk_1render_1handle_FUNC,
+ _1gtk_1render_1line_FUNC,
_1gtk_1scale_1new_FUNC,
_1gtk_1scale_1set_1digits_FUNC,
_1gtk_1scale_1set_1draw_1value_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 574fb33..88c3494 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
@@ -8674,7 +8674,7 @@ public static final void gtk_paint_extension(long /*int*/ style, long /*int*/ wi
}
}
/**
- * @param style cast=(GtkStyle *)
+ * @method flags=dynamic
* @param window cast=(GdkWindow *)
* @param widget cast=(GtkWidget *)
* @param detail cast=(const gchar *)
@@ -8735,7 +8735,7 @@ public static final void gtk_paint_shadow(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 *)
@@ -8749,6 +8749,23 @@ public static final void gtk_paint_vline(long /*int*/ style, long /*int*/ 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(long /*int*/ context, long /*int*/ cr, double x0, double y0, double x1, double y1);
+public static final void gtk_render_line(long /*int*/ context, long /*int*/ 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(long /*int*/ size);
public static final void gtk_paper_size_free(long /*int*/ size) {
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 40754df..3334180 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
@@ -13,6 +13,7 @@ package org.eclipse.swt.internal.theme;
import org.eclipse.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 ToolItemDrawData extends DrawData {
@@ -56,9 +57,23 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
long /*int*/ 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)) {
+ long /*int*/ cairo = OS.gdk_cairo_create (drawable);
+ long /*int*/ 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);
+ Cairo.cairo_destroy(cairo);
+ } else {
+ OS.gtk_paint_hline(gtkStyle, drawable, state_type, null, separatorHandle, detail, bounds.x, bounds.x + bounds.width, bounds.y + bounds.height / 2);
+ }
} else {
- OS.gtk_paint_vline(gtkStyle, drawable, state_type, null, separatorHandle, detail, bounds.y, bounds.y + bounds.height, bounds.x + bounds.width / 2);
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ long /*int*/ cairo = OS.gdk_cairo_create (drawable);
+ long /*int*/ 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);
+ Cairo.cairo_destroy (cairo);
+ } else {
+ OS.gtk_paint_vline(gtkStyle, drawable, state_type, null, separatorHandle, detail, bounds.y, bounds.y + bounds.height, bounds.x + bounds.width / 2);
+ }
}
return;
}