summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-10-15 10:41:50 -0400
committerArun Thondapu <arunkumar.thondapu@in.ibm.com>2012-10-15 23:31:59 +0530
commitd090fa149a4cb297f7af43a248a69e342be801ae (patch)
tree64f55f3626f249ceeddf921050f32515e26be0c0
parentb76a3210e5e0d07a0578d9ae225b51140c25db20 (diff)
downloadeclipse.platform.swt-d090fa149a4cb297f7af43a248a69e342be801ae.tar.gz
eclipse.platform.swt-d090fa149a4cb297f7af43a248a69e342be801ae.tar.xz
eclipse.platform.swt-d090fa149a4cb297f7af43a248a69e342be801ae.zip
Use gtk_render_extension instead of gtk_paint_extension for GTK+ 3
This patch uses gtk_render_extension instead of deprecated gtk_paint_extension method 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.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/TabItemDrawData.java13
6 files changed, 61 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 2bc94dbde3..d3a603abea 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
@@ -11525,7 +11525,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1extension)
OS_NATIVE_ENTER(env, that, _1gtk_1paint_1extension_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_extension((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10, arg11);
+/*
+ gtk_paint_extension(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10, arg11);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_paint_extension)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, GdkWindow *, jint, jint, GdkRectangle *, GtkWidget *, gchar *, jint, jint, jint, jint, jint))fp)(arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10, arg11);
+ }
+ }
fail:
if (arg6 && lparg6) (*env)->ReleaseByteArrayElements(env, arg6, lparg6, 0);
if (arg4 && lparg4) setGdkRectangleFields(env, arg4, lparg4);
@@ -13005,6 +13013,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1expander)
}
#endif
+#ifndef NO__1gtk_1render_1extension
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1extension)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5, jint arg6)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1render_1extension_FUNC);
+/*
+ gtk_render_extension(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5, (GtkPositionType)arg6);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_render_extension)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong, gdouble, gdouble, gdouble, gdouble, GtkPositionType))fp)(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5, (GtkPositionType)arg6);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1render_1extension_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1render_1focus
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1focus)
(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 724320196f..abfce34e01 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
@@ -324,6 +324,7 @@
#define gtk_paint_handle_LIB LIB_GTK
#define gtk_paint_focus_LIB LIB_GTK
#define gtk_paint_expander_LIB LIB_GTK
+#define gtk_paint_extension_LIB LIB_GTK
#define gtk_paint_hline_LIB LIB_GTK
#define gtk_paint_vline_LIB LIB_GTK
#define gtk_paint_flat_box_LIB LIB_GTK
@@ -400,6 +401,7 @@
#define gtk_printer_get_name_LIB LIB_GTK
#define gtk_printer_is_default_LIB LIB_GTK
#define gtk_render_check_LIB LIB_GTK
+#define gtk_render_extension_LIB LIB_GTK
#define gtk_render_expander_LIB LIB_GTK
#define gtk_render_handle_LIB LIB_GTK
#define gtk_render_line_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 6cc551d742..a446b7c2a9 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
@@ -957,6 +957,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1render_1background",
"_1gtk_1render_1check",
"_1gtk_1render_1expander",
+ "_1gtk_1render_1extension",
"_1gtk_1render_1focus",
"_1gtk_1render_1frame",
"_1gtk_1render_1frame_1gap",
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 a503da0ebf..4430538a77 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
@@ -967,6 +967,7 @@ typedef enum {
_1gtk_1render_1background_FUNC,
_1gtk_1render_1check_FUNC,
_1gtk_1render_1expander_FUNC,
+ _1gtk_1render_1extension_FUNC,
_1gtk_1render_1focus_FUNC,
_1gtk_1render_1frame_FUNC,
_1gtk_1render_1frame_1gap_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 f6539a0887..0302e0a8f6 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
@@ -8683,6 +8683,23 @@ public static final void gtk_render_frame_gap(long /*int*/ context, long /*int*/
* @method flags=dynamic
* @param x cast=(gdouble)
* @param y cast=(gdouble)
+ * @param width cast=(gdouble)
+ * @param height cast=(gdouble)
+ * @param gap_side cast=(GtkPositionType)
+ */
+public static final native void _gtk_render_extension(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height, int gap_side);
+public static final void gtk_render_extension(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height, int gap_side) {
+ lock.lock();
+ try {
+ _gtk_render_extension(context, cr, x, y, width, height, gap_side);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @method flags=dynamic
+ * @param x cast=(gdouble)
+ * @param y cast=(gdouble)
* @param layout cast=(PangoLayout *)
*/
public static final native void _gtk_render_layout(long /*int*/ context, long /*int*/ cr, double x , double y, long /*int*/ layout);
@@ -8881,7 +8898,7 @@ public static final void gtk_paint_expander(long /*int*/ style, long /*int*/ win
}
}
/**
- * @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/TabItemDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/TabItemDrawData.java
index b0d74544d9..119a239e3d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/TabItemDrawData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/TabItemDrawData.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.internal.theme;
import org.eclipse.swt.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 TabItemDrawData extends DrawData {
@@ -67,7 +68,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
}
int state_type = getStateType(DrawData.WIDGET_WHOLE);
byte[] detail = Converter.wcsToMbcs(null, "tab", true);
- OS.gtk_paint_extension(gtkStyle, drawable, state_type, OS.GTK_SHADOW_OUT, null, notebookHandle, detail, x, y, width, height, gap_side);
+ gtk_render_extension (gtkStyle, drawable, state_type, OS.GTK_SHADOW_OUT, null, notebookHandle, detail, x, y, width, height, gap_side);
if (clientArea != null) {
int hborder, vborder;
if (OS.GTK_VERSION >= OS.VERSION(2, 4, 0)) {
@@ -100,4 +101,14 @@ int hit(Theme theme, Point position, Rectangle bounds) {
return bounds.contains(position) ? DrawData.WIDGET_WHOLE : DrawData.WIDGET_NOWHERE;
}
+void gtk_render_extension(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) {
+ 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_render_extension(context, cairo, x, y, width, height, gap_side);
+ Cairo.cairo_destroy (cairo);
+ } else {
+ OS.gtk_paint_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side);
+ }
+}
}