diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-09-06 14:58:18 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-09-06 14:58:18 -0400 |
commit | fc69b019c6a5e7af13d04ebecdc6a7d321535924 (patch) | |
tree | 6fdd535161cfe1fc62bfa4b299130f2556aa9b44 | |
parent | eda05e5e1bfd7a8e6860cccbab7bfcd105765ca8 (diff) | |
download | eclipse.platform.swt-gtk3_render_frame_gap.tar.gz eclipse.platform.swt-gtk3_render_frame_gap.tar.xz eclipse.platform.swt-gtk3_render_frame_gap.zip |
Use gtk_render_frame_gap instead of gtk_paint_box_gap for GTK+ 3 gtk3_render_frame_gap
This patch omits use of deprecated gtk_paint_box_gap () method and uses
GTK+3 API method instead.
6 files changed, 99 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 90c1ebac16..5258dfb025 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 @@ -10922,7 +10922,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1box_1gap) OS_NATIVE_ENTER(env, that, _1gtk_1paint_1box_1gap_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_box_gap((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_paint_box_gap) + if (fp) { + ((void (CALLING_CONVENTION*)(GtkStyle *, GdkWindow *, jint, jint, GdkRectangle *, GtkWidget *, gchar *, jint, jint, jint, jint, jint, jint, jint))fp)((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, arg3, lparg4, (GtkWidget *)arg5, (gchar *)lparg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); + } + } 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_1frame_1gap +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1frame_1gap) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5, jint arg6, jdouble arg7, jdouble arg8) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1render_1frame_1gap_FUNC); +/* + gtk_render_frame_gap(arg0, (cairo_t *)arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5, arg6, (gdouble)arg7, (gdouble)arg8); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_render_frame_gap) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, cairo_t *, gdouble, gdouble, gdouble, gdouble, jint, gdouble, gdouble))fp)(arg0, (cairo_t *)arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5, arg6, (gdouble)arg7, (gdouble)arg8); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1render_1frame_1gap_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..5e228c0c40 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,12 @@ #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 gdk_pango_context_set_colormap_LIB LIB_GDK +#define gtk_paint_box_gap_LIB 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 @@ -333,6 +335,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_frame_gap_LIB LIB_GTK #define ubuntu_menu_proxy_get_LIB LIB_GTK #define FcConfigAppFontAddFile_LIB LIB_FONTCONFIG 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..6bc582b3c6 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_1frame_1gap", "_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..984933521a 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_1frame_1gap_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..9b6a215f68 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 @@ -8377,6 +8377,39 @@ 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) + * @param xy0_gap cast=(gdouble) + * @param xy1_gap cast=(gdouble) + */ +public static final native void _gtk_render_frame_gap(int /*long*/ context, int /*long*/ cr, double x , double y, double width, double height, int gap_side, double xy0_gap, double xy1_gap); +public static final void gtk_render_frame_gap(int /*long*/ context, int /*long*/ cr, double x , double y, double width, double height, int gap_side, double xy0_gap, double xy1_gap) { + lock.lock(); + try { + _gtk_render_frame_gap(context, cr, x, y, width, height, gap_side, xy0_gap, xy1_gap); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic * @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/TabFolderDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/TabFolderDrawData.java index a261ec40f0..d50184f899 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/TabFolderDrawData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/TabFolderDrawData.java @@ -44,7 +44,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) { y += tabsHeight; } byte[] detail = Converter.wcsToMbcs(null, "notebook", true); - OS.gtk_paint_box_gap(gtkStyle, drawable, getStateType(DrawData.WIDGET_WHOLE), OS.GTK_SHADOW_OUT, null, notebookHandle, detail, x, y, width, height, gap_side, gap_x, gap_width); + gtk_render_box_gap(gtkStyle, drawable, getStateType(DrawData.WIDGET_WHOLE), OS.GTK_SHADOW_OUT, null, notebookHandle, detail, x, y, width, height, gap_side, gap_x, gap_width); if (tabsArea != null) { tabsArea.x = bounds.x; tabsArea.y = bounds.y; @@ -64,4 +64,14 @@ int hit(Theme theme, Point position, Rectangle bounds) { return bounds.contains(position) ? DrawData.WIDGET_WHOLE : DrawData.WIDGET_NOWHERE; } +void gtk_render_box_gap (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, int gap_side, int gap_x, int gap_width) { + 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_frame_gap(context, cairo, context, y, gap_width, height, gap_side, gap_x, gap_x + gap_width); + } else { + OS.gtk_paint_box_gap(style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); + } +} + } |