summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-09-05 16:37:51 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-09-05 16:37:51 -0400
commit520aee0fdf0c33f9b9959544dcaf3ed79272d4cd (patch)
tree61303a36c32e4954d395796f58d7c92dd2e89d32
parenteda05e5e1bfd7a8e6860cccbab7bfcd105765ca8 (diff)
downloadeclipse.platform.swt-gtk3_redner_option.tar.gz
eclipse.platform.swt-gtk3_redner_option.tar.xz
eclipse.platform.swt-gtk3_redner_option.zip
Use gtk_render_option instead of gtk_paint_option for GTK+3 and highergtk3_redner_option
This patch implements GTK+ 3 API method gtk_render_option() instead of deprecated gtk_paint_option() for GTK+ 3 and higher.
-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.c6
-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 Theme/gtk/org/eclipse/swt/internal/theme/ButtonDrawData.java11
6 files changed, 97 insertions, 5 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 90c1ebac16..b263841de8 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
@@ -11073,7 +11073,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1option)
OS_NATIVE_ENTER(env, that, _1gtk_1paint_1option_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_option((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, arg9, arg10);
+/*
+ gtk_paint_option(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (const gchar *)lparg6, arg7, arg8, arg9, arg10);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_paint_option)
+ 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);
@@ -12317,6 +12325,24 @@ fail:
}
#endif
+#ifndef NO__1gtk_1render_1option
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1option)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1render_1option_FUNC);
+/*
+ gtk_render_option(arg0, (cairo_t *)arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_render_option)
+ 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_1option_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1scale_1set_1digits
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1scale_1set_1digits)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
@@ -15780,6 +15806,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 09073e9c3e..8a75dff161 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
@@ -226,10 +226,13 @@
#define gtk_widget_set_can_focus_LIB LIB_GTK
#define gtk_widget_set_mapped_LIB LIB_GTK
#define gtk_widget_set_sensitive_LIB LIB_GTK
+#define gtk_widget_get_style_context_LIB LIB_GTK
#define gtk_widget_set_receives_default_LIB LIB_GTK
#define gtk_widget_set_visible_LIB LIB_GTK
#define gtk_range_get_slider_range_LIB LIB_GTK
+#define gtk_render_option_LIB LIB_GTK LIB_GTK
#define gdk_pango_context_set_colormap_LIB LIB_GDK
+#define gtk_paint_option_LIB LIB_GTK LIB_GTK
#define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK
#define gdk_x11_screen_lookup_visual_LIB LIB_GDK
#define gdk_x11_window_lookup_for_display_LIB LIB_GDK
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 119f1c66aa..97a4c6c7f6 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
@@ -18,8 +18,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1335;
-int OS_nativeFunctionCallCount[1335];
+int OS_nativeFunctionCount = 1337;
+int OS_nativeFunctionCallCount[1337];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -938,6 +938,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1rc_1style_1set_1color_1flags",
"_1gtk_1rc_1style_1set_1fg",
"_1gtk_1rc_1style_1set_1text",
+ "_1gtk_1render_1option",
"_1gtk_1scale_1set_1digits",
"_1gtk_1scale_1set_1draw_1value",
"_1gtk_1scrolled_1window_1add_1with_1viewport",
@@ -1239,6 +1240,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 20250dbe2b..e8986d8143 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
@@ -946,6 +946,7 @@ typedef enum {
_1gtk_1rc_1style_1set_1color_1flags_FUNC,
_1gtk_1rc_1style_1set_1fg_FUNC,
_1gtk_1rc_1style_1set_1text_FUNC,
+ _1gtk_1render_1option_FUNC,
_1gtk_1scale_1set_1digits_FUNC,
_1gtk_1scale_1set_1draw_1value_FUNC,
_1gtk_1scrolled_1window_1add_1with_1viewport_FUNC,
@@ -1247,6 +1248,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 c2310b7878..7e13712cdc 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
@@ -8331,7 +8331,7 @@ public static final void gtk_paint_focus(int /*long*/ style, int /*long*/ window
}
}
/**
- * @param style cast=(GtkStyle *)
+ * @method flags=dynamic
* @param window cast=(GdkWindow *)
* @param widget cast=(GtkWidget *)
* @param detail cast=(const gchar *)
@@ -8377,6 +8377,36 @@ public static final void gtk_paint_box(int /*long*/ style, int /*long*/ window,
}
}
/**
+ * @method flags=dynamic
+ * @param widget cast=(GtkWidget *)
+ */
+public static final native int /*long*/ _gtk_widget_get_style_context(int /*long*/ widget);
+public static final int /*long*/ gtk_widget_get_style_context(int /*long*/ widget) {
+ lock.lock();
+ try {
+ return _gtk_widget_get_style_context(widget);
+ } finally {
+ 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_option(int /*long*/ context, int /*long*/ cr, double x , double y, double width, double height);
+public static final void gtk_render_option(int /*long*/ context, int /*long*/ cr, double x , double y, double width, double height) {
+ lock.lock();
+ try {
+ _gtk_render_option(context, cr, x , y, width, height);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
* @param style cast=(GtkStyle *)
* @param window cast=(GdkWindow *)
* @param widget cast=(GtkWidget *)
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 eff7bef8ac..9c05777add 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
@@ -63,7 +63,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
OS.gtk_paint_flat_box(gtkStyle, drawable, OS.GTK_STATE_PRELIGHT, OS.GTK_SHADOW_ETCHED_OUT, null, radioButtonHandle, detail, prelight_x, prelight_y, prelight_width, prelight_height);
}
int state_type = getStateType(DrawData.WIDGET_WHOLE);
- OS.gtk_paint_option(gtkStyle, drawable, state_type, shadow_type, null, radioButtonHandle, detail, x, y, indicator_size, indicator_size);
+ gtk_render_option(gtkStyle, drawable, state_type, shadow_type, null, radioButtonHandle, detail, x, y, indicator_size, indicator_size);
if (clientArea != null) {
clientArea.x = bounds.x + 2 * indicator_spacing + border_width + indicator_size;
clientArea.y = bounds.y + border_width;
@@ -219,4 +219,13 @@ int hit(Theme theme, Point position, Rectangle bounds) {
return bounds.contains(position) ? DrawData.WIDGET_WHOLE : DrawData.WIDGET_NOWHERE;
}
+void gtk_render_option (int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ int /*long */ cairo = OS.gdk_cairo_create (window);
+ int /*long*/ context = OS.gtk_widget_get_style_context (style);
+ OS.gtk_render_option (context, cairo, x, y, width, height);
+ } else {
+ OS.gtk_paint_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+ }
+}
}