summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorAnatoly Spektor2012-10-04 10:52:37 (EDT)
committer Alexander Kurtakov2012-10-04 10:57:15 (EDT)
commit41b28fb69b28913e45dadfb38d783336ab3b6dcc (patch)
tree94d67dd6c665fe977161dd6f661381428fc7b70f
parentc159a9553ef0699a68dfd8ee6cae8e56f4b4ccb4 (diff)
downloadeclipse.platform.swt-41b28fb69b28913e45dadfb38d783336ab3b6dcc.zip
eclipse.platform.swt-41b28fb69b28913e45dadfb38d783336ab3b6dcc.tar.gz
eclipse.platform.swt-41b28fb69b28913e45dadfb38d783336ab3b6dcc.tar.bz2
Use gtk_render_handle() instead of gtk_paint_handle() for GTK+ 3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c48
-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.c2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java9
6 files changed, 93 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 e35bed5..a27a60f 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
@@ -11423,7 +11423,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1handle)
OS_NATIVE_ENTER(env, that, _1gtk_1paint_1handle_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_handle((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, arg9, arg10, arg11);
+/*
+ gtk_paint_handle(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, arg9, arg10, arg11);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_paint_handle)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, GdkWindow *, jint, jint, GdkRectangle *, GtkWidget *, const gchar *, jint, jint, jint, jint, jint))fp)(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, arg9, arg10, arg11);
+ }
+ }
fail:
if (arg6 && lparg6) (*env)->ReleaseByteArrayElements(env, arg6, lparg6, 0);
OS_NATIVE_EXIT(env, that, _1gtk_1paint_1handle_FUNC);
@@ -12743,6 +12751,24 @@ fail:
}
#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)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1render_1handle_FUNC);
+/*
+ gtk_render_handle(arg0, (cairo_t *)arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_render_handle)
+ 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_1handle_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1scale_1new
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1scale_1new)
(JNIEnv *env, jclass that, jint arg0, jintLong arg1)
@@ -16298,6 +16324,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1style)
}
#endif
+#ifndef NO__1gtk_1widget_1get_1style_1context
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1style_1context)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1style_1context_FUNC);
+/*
+ rc = (jintLong)gtk_widget_get_style_context((GtkWidget *)arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_widget_get_style_context)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkWidget *))fp)((GtkWidget *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1style_1context_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gtk_1widget_1get_1tooltip_1text
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1tooltip_1text)
(JNIEnv *env, jclass that, jintLong arg0)
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 bde1484..ba01726 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
@@ -241,6 +241,7 @@
#define gtk_window_set_skip_taskbar_hint_LIB LIB_GTK
#define gtk_widget_is_composited_LIB LIB_GTK
#define gtk_widget_get_allocation_LIB LIB_GTK
+#define gtk_widget_get_style_context_LIB LIB_GTK
#define gtk_widget_get_tooltip_text_LIB LIB_GTK
#define gtk_widget_get_visible_LIB LIB_GTK
#define gtk_widget_has_focus_LIB LIB_GTK
@@ -300,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_handle_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
@@ -369,6 +371,7 @@
#define gtk_printer_get_backend_LIB LIB_GTK
#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_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 b4c5e21..b789623 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_1handle",
"_1gtk_1scale_1new",
"_1gtk_1scale_1set_1digits",
"_1gtk_1scale_1set_1draw_1value",
@@ -1255,6 +1256,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1widget_1get_1sensitive",
"_1gtk_1widget_1get_1size_1request",
"_1gtk_1widget_1get_1style",
+ "_1gtk_1widget_1get_1style_1context",
"_1gtk_1widget_1get_1tooltip_1text",
"_1gtk_1widget_1get_1toplevel",
"_1gtk_1widget_1get_1visible",
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 af36d44..20986ca 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_1handle_FUNC,
_1gtk_1scale_1new_FUNC,
_1gtk_1scale_1set_1digits_FUNC,
_1gtk_1scale_1set_1draw_1value_FUNC,
@@ -1265,6 +1266,7 @@ typedef enum {
_1gtk_1widget_1get_1sensitive_FUNC,
_1gtk_1widget_1get_1size_1request_FUNC,
_1gtk_1widget_1get_1style_FUNC,
+ _1gtk_1widget_1get_1style_1context_FUNC,
_1gtk_1widget_1get_1tooltip_1text_FUNC,
_1gtk_1widget_1get_1toplevel_FUNC,
_1gtk_1widget_1get_1visible_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 2c75cdc..574fb33 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
@@ -8521,7 +8521,7 @@ public static final double gtk_page_setup_get_page_height(long /*int*/ setup, in
}
}
/**
- * @param style cast=(GtkStyle *)
+ * @method flags=dynamic
* @param window cast=(GdkWindow *)
* @param area flags=no_out
* @param widget cast=(GtkWidget *)
@@ -12575,6 +12575,36 @@ public static final void gtk_widget_get_allocation (long /*int*/ widget, GtkAllo
lock.unlock();
}
}
+/**
+ * @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_handle(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height);
+public static final void gtk_render_handle(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height) {
+ lock.lock();
+ try {
+ gtk_render_handle(context,cr, x ,y, width, height);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @method flags=dynamic
+ * @param widget cast=(GtkWidget *)
+ */
+public static final native long /*int*/ _gtk_widget_get_style_context(long /*int*/ widget);
+public static final long /*int*/ gtk_widget_get_style_context(long /*int*/ widget) {
+ lock.lock();
+ try {
+ return _gtk_widget_get_style_context(widget);
+ } finally {
+ lock.unlock();
+ }
+}
/** @param widget cast=(GtkWidget *) */
public static final native long /*int*/ _gtk_widget_get_style(long /*int*/ widget);
public static final long /*int*/ gtk_widget_get_style(long /*int*/ widget) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index d8143d2..5202b30 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -161,7 +161,14 @@ boolean drawGripper (int x, int y, int width, int height, boolean vertical) {
if (window == 0) return false;
int orientation = vertical ? OS.GTK_ORIENTATION_HORIZONTAL : OS.GTK_ORIENTATION_VERTICAL;
if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - width - x;
- OS.gtk_paint_handle (OS.gtk_widget_get_style (paintHandle), window, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_OUT, null, paintHandle, new byte [1], x, y, width, height, orientation);
+ 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(paintHandle);
+ OS.gtk_render_handle(context, cairo, x, y, width, height);
+ Cairo.cairo_destroy (cairo);
+ } else {
+ OS.gtk_paint_handle (OS.gtk_widget_get_style (paintHandle), window, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_OUT, null, paintHandle, new byte [1], x, y, width, height, orientation);
+ }
return true;
}