diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-09-07 14:36:56 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-09-07 14:36:56 -0400 |
commit | be5f37640ae6d57949d830fa1e989290d57294a0 (patch) | |
tree | a322fcf1a63c005fa598d9c21bcb0539a2e91ae8 | |
parent | eda05e5e1bfd7a8e6860cccbab7bfcd105765ca8 (diff) | |
download | eclipse.platform.swt-gtk3_region_empty.tar.gz eclipse.platform.swt-gtk3_region_empty.tar.xz eclipse.platform.swt-gtk3_region_empty.zip |
Use cairo_region_is_empty () instead of gdk_region_empty () for GTK+3gtk3_region_empty
This patch substitutes deprecated gdk_region_empty with GTK+3 API method
cairo_region_is_empty.
8 files changed, 43 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c index 72220cf07f..0c1e57b057 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c @@ -1179,6 +1179,18 @@ JNIEXPORT jintLong JNICALL Cairo_NATIVE(_1cairo_1reference) } #endif +#ifndef NO__1cairo_1region_1is_1empty +JNIEXPORT jboolean JNICALL Cairo_NATIVE(_1cairo_1region_1is_1empty) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + Cairo_NATIVE_ENTER(env, that, _1cairo_1region_1is_1empty_FUNC); + rc = (jboolean)cairo_region_is_empty((const cairo_region_t *)arg0); + Cairo_NATIVE_EXIT(env, that, _1cairo_1region_1is_1empty_FUNC); + return rc; +} +#endif + #ifndef NO__1cairo_1rel_1curve_1to JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1rel_1curve_1to) (JNIEnv *env, jclass that, jintLong arg0, jdouble arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5, jdouble arg6) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c index 67b21fe5c2..76194f19c3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c @@ -24,8 +24,8 @@ #ifdef NATIVE_STATS -int Cairo_nativeFunctionCount = 157; -int Cairo_nativeFunctionCallCount[157]; +int Cairo_nativeFunctionCount = 158; +int Cairo_nativeFunctionCallCount[158]; char * Cairo_nativeFunctionNames[] = { "CAIRO_1VERSION_1ENCODE", "_1cairo_1append_1path", @@ -117,6 +117,7 @@ char * Cairo_nativeFunctionNames[] = { "_1cairo_1push_1group", "_1cairo_1rectangle", "_1cairo_1reference", + "_1cairo_1region_1is_1empty", "_1cairo_1rel_1curve_1to", "_1cairo_1rel_1line_1to", "_1cairo_1rel_1move_1to", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h index 62206dc2a8..d33f6836d9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h @@ -125,6 +125,7 @@ typedef enum { _1cairo_1push_1group_FUNC, _1cairo_1rectangle_FUNC, _1cairo_1reference_FUNC, + _1cairo_1region_1is_1empty_FUNC, _1cairo_1rel_1curve_1to_FUNC, _1cairo_1rel_1line_1to_FUNC, _1cairo_1rel_1move_1to_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java index 8f342be036..60c2cc4991 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java @@ -1039,6 +1039,16 @@ public static final int /*long*/ cairo_reference(int /*long*/ cr) { lock.unlock(); } } +/** @param region cast=(const cairo_region_t *) */ +public static final native boolean _cairo_region_is_empty(int /*long*/ region); +public static final boolean cairo_region_is_empty(int /*long*/ region) { + lock.lock(); + try { + return _cairo_region_is_empty (region); + } finally { + lock.unlock(); + } +} /** @param cr cast=(cairo_t *) */ public static final native void _cairo_rel_curve_to(int /*long*/ cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3); public static final void cairo_rel_curve_to(int /*long*/ cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3) { 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..b05834416a 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 @@ -6166,7 +6166,15 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1gdk_1region_1empty) { jboolean rc = 0; OS_NATIVE_ENTER(env, that, _1gdk_1region_1empty_FUNC); - rc = (jboolean)gdk_region_empty((GdkRegion *)arg0); +/* + rc = (jboolean)gdk_region_empty(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_region_empty) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } OS_NATIVE_EXIT(env, that, _1gdk_1region_1empty_FUNC); return rc; } 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..7d523cd960 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 @@ -230,6 +230,7 @@ #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 gdk_region_empty_LIB LIB_GDK #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/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..77105c8b60 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 @@ -4647,7 +4647,7 @@ public static final void gdk_region_destroy(int /*long*/ region) { lock.unlock(); } } -/** @param region cast=(GdkRegion *) */ +/** @method flags=dynamic */ public static final native boolean _gdk_region_empty(int /*long*/ region); public static final boolean gdk_region_empty(int /*long*/ region) { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java index a2b8995ec7..9ab96e718b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java @@ -11,6 +11,7 @@ package org.eclipse.swt.graphics; +import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.*; @@ -435,7 +436,11 @@ public boolean isDisposed() { */ public boolean isEmpty() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - return OS.gdk_region_empty(handle); + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + return Cairo.cairo_region_is_empty(handle); + } else { + return OS.gdk_region_empty(handle); + } } /** |