summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-10-03 12:15:10 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-10-03 12:15:10 -0400
commite816491177fc4e519333c61d79029c488780096c (patch)
treefa3cced0595ca7436c8454503b5fb3e74ad4c157
parentffe5186c17b22da6dd8ec55ad2dd5f424adf803a (diff)
downloadeclipse.platform.swt-cairo_region_create_64.tar.gz
eclipse.platform.swt-cairo_region_create_64.tar.xz
eclipse.platform.swt-cairo_region_create_64.zip
Replace GdkRegion with Cairo methods for GTK + 3.0 and highercairo_region_create_64
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java167
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c174
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h16
-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.java60
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java41
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java189
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java135
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java70
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java56
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java24
18 files changed, 893 insertions, 140 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..3223a5877f 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_1create
+JNIEXPORT jintLong JNICALL Cairo_NATIVE(_1cairo_1region_1create)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ Cairo_NATIVE_ENTER(env, that, _1cairo_1region_1create_FUNC);
+ rc = (jintLong)cairo_region_create();
+ Cairo_NATIVE_EXIT(env, that, _1cairo_1region_1create_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 dce4e6c014..46df8f06e8 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
@@ -115,6 +115,20 @@ char * Cairo_nativeFunctionNames[] = {
"_1cairo_1push_1group",
"_1cairo_1rectangle",
"_1cairo_1reference",
+ "_1cairo_1region_1contains_1point",
+ "_1cairo_1region_1contains_1rectangle",
+ "_1cairo_1region_1create",
+ "_1cairo_1region_1create_1rectangle",
+ "_1cairo_1region_1destroy",
+ "_1cairo_1region_1get_1extents",
+ "_1cairo_1region_1get_1rectangle",
+ "_1cairo_1region_1intersect",
+ "_1cairo_1region_1is_1empty",
+ "_1cairo_1region_1num_1rectangles",
+ "_1cairo_1region_1subtract",
+ "_1cairo_1region_1translate",
+ "_1cairo_1region_1union",
+ "_1cairo_1region_1union_1rectangle",
"_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..0888303e02 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,20 @@ typedef enum {
_1cairo_1push_1group_FUNC,
_1cairo_1rectangle_FUNC,
_1cairo_1reference_FUNC,
+ _1cairo_1region_1contains_1point_FUNC,
+ _1cairo_1region_1contains_1rectangle_FUNC,
+ _1cairo_1region_1create_FUNC,
+ _1cairo_1region_1create_1rectangle_FUNC,
+ _1cairo_1region_1destroy_FUNC,
+ _1cairo_1region_1get_1extents_FUNC,
+ _1cairo_1region_1get_1rectangle_FUNC,
+ _1cairo_1region_1intersect_FUNC,
+ _1cairo_1region_1is_1empty_FUNC,
+ _1cairo_1region_1num_1rectangles_FUNC,
+ _1cairo_1region_1subtract_FUNC,
+ _1cairo_1region_1translate_FUNC,
+ _1cairo_1region_1union_FUNC,
+ _1cairo_1region_1union_1rectangle_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 79a3c48820..3f9a06c165 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
@@ -21,6 +21,7 @@
package org.eclipse.swt.internal.cairo;
import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.GdkRectangle;
public class Cairo extends Platform {
static {
@@ -1697,6 +1698,172 @@ public static final int cairo_xlib_surface_get_width(long /*int*/ surface) {
lock.unlock();
}
}
+public static final native long /*int*/ _cairo_region_create();
+public static final long /*int*/cairo_region_create() {
+ lock.lock();
+ try {
+ return _cairo_region_create();
+ } finally {
+ lock.unlock();
+ }
+}
+/** @param region cast=(cairo_region_t *) */
+public static final native void _cairo_region_destroy(long /*int*/ region);
+public static final void cairo_region_destroy(long /*int*/ region) {
+ lock.lock();
+ try {
+ _cairo_region_destroy(region);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @param region cast=(const cairo_region_t *) */
+public static final native boolean _cairo_region_is_empty(long /*int*/ region);
+public static final boolean cairo_region_is_empty(long /*int*/ region) {
+ lock.lock();
+ try {
+ return _cairo_region_is_empty (region);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param dst cast=(cairo_region_t *)
+ * @param other cast=(const cairo_region_t *)
+ */
+public static final native long /*int*/ _cairo_region_subtract(long /*int*/ dst, long /*int*/ other);
+public static final long /*int*/ cairo_region_subtract(long /*int*/ dst, long /*int*/ other) {
+ lock.lock();
+ try {
+ return _cairo_region_subtract(dst, other);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param region cast=(cairo_region_t *)
+ */
+public static final native void _cairo_region_translate(long /*int*/ region, int dx, int dy);
+public static final void cairo_region_translate(long /*int*/ region, int dx, int dy) {
+ lock.lock();
+ try {
+ _cairo_region_translate(region, dx, dy);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param dst cast=(cairo_region_t *)
+ * @param other cast=(const cairo_region_t *)
+ */
+public static final native long /*int*/ _cairo_region_union(long /*int*/ dst, long /*int*/ other);
+public static final long /*int*/ cairo_region_union(long /*int*/ dst, long /*int*/ other) {
+ lock.lock();
+ try {
+ return _cairo_region_union(dst,other);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param dst cast=(cairo_region_t *)
+ * @param other cast=(const cairo_region_t *)
+ */
+public static final native long /*int*/ _cairo_region_intersect(long /*int*/ dst, long /*int*/ other);
+public static final long /*int*/ cairo_region_intersect(long /*int*/ dst, long /*int*/ other) {
+ lock.lock();
+ try {
+ return _cairo_region_intersect(dst,other);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @param rectangle cast=(GdkRectangle *),flags=no_out */
+public static final native long /*int*/ _cairo_region_create_rectangle(GdkRectangle rectangle);
+public static final long /*int*/ cairo_region_create_rectangle(GdkRectangle rectangle) {
+ lock.lock();
+ try {
+ return _cairo_region_create_rectangle(rectangle);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param region cast=( const cairo_region_t *)
+ * @param rectangle cast=(GdkRectangle *),flags=no_out
+ */
+public static final native long /*int*/ _cairo_region_contains_rectangle(long /*int*/ region, GdkRectangle rectangle);
+public static final long /*int*/ cairo_region_contains_rectangle(long /*int*/ region, GdkRectangle rectangle) {
+ lock.lock();
+ try {
+ return _cairo_region_contains_rectangle(region,rectangle);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param dst cast=( const cairo_region_t *)
+ * @param rectangle cast=(GdkRectangle *),flags=no_out
+ */
+public static final native long /*int*/ _cairo_region_union_rectangle(long /*int*/ dst, GdkRectangle rectangle);
+public static final long /*int*/ cairo_region_union_rectangle(long /*int*/ dst, GdkRectangle rectangle) {
+ lock.lock();
+ try {
+ return _cairo_region_union_rectangle(dst,rectangle);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param region cast=( const cairo_region_t *)
+ * @param extents cast=(GdkRectangle *),flags=no_in
+ */
+public static final native void _cairo_region_get_extents(long /*int*/ region, GdkRectangle extents);
+public static final void cairo_region_get_extents(long /*int*/ region, GdkRectangle extents) {
+ lock.lock();
+ try {
+ _cairo_region_contains_rectangle(region,extents);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param region cast=(const cairo_region_t *)
+ */
+public static final native boolean _cairo_region_contains_point(long /*int*/ region, int x, int y);
+public static final boolean cairo_region_contains_point(long /*int*/ region, int x, int y) {
+ lock.lock();
+ try {
+ return _cairo_region_contains_point(region, x, y);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param region cast=(const cairo_region_t *)
+ */
+public static final native int _cairo_region_num_rectangles(long /*int*/ region);
+public static final int cairo_region_num_rectangles(long /*int*/ region) {
+ lock.lock();
+ try {
+ return _cairo_region_num_rectangles(region);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param region cast=( const cairo_region_t *)
+ * @param rectangle cast=(GdkRectangle *)
+ */
+public static final native void _cairo_region_get_rectangle(long /*int*/ region, int nth, long /*int*/ rectangle);
+public static final void cairo_region_get_rectangle(long /*int*/ region, int nth, long /*int*/ rectangle) {
+ lock.lock();
+ try {
+ _cairo_region_get_rectangle(region,nth,rectangle);
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @param dest cast=(void *)
* @param src cast=(const void *)
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 9693360a8c..2c2f6df64f 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
@@ -4655,6 +4655,26 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1cairo_1region)
}
#endif
+#ifndef NO__1gdk_1cairo_1region_1create_1from_1surface
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1cairo_1region_1create_1from_1surface)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gdk_1cairo_1region_1create_1from_1surface_FUNC);
+/*
+ rc = (jintLong)gdk_cairo_region_create_from_surface(arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_cairo_region_create_from_surface)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gdk_1cairo_1region_1create_1from_1surface_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1cairo_1reset_1clip
JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1cairo_1reset_1clip)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
@@ -6301,7 +6321,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1region_1destroy)
(JNIEnv *env, jclass that, jintLong arg0)
{
OS_NATIVE_ENTER(env, that, _1gdk_1region_1destroy_FUNC);
- gdk_region_destroy((GdkRegion *)arg0);
+/*
+ gdk_region_destroy(arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_destroy)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1region_1destroy_FUNC);
}
#endif
@@ -6312,7 +6340,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;
}
@@ -6325,7 +6361,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1region_1get_1clipbox)
GdkRectangle _arg1, *lparg1=NULL;
OS_NATIVE_ENTER(env, that, _1gdk_1region_1get_1clipbox_FUNC);
if (arg1) if ((lparg1 = &_arg1) == NULL) goto fail;
- gdk_region_get_clipbox((GdkRegion *)arg0, (GdkRectangle *)lparg1);
+/*
+ gdk_region_get_clipbox(arg0, (GdkRectangle *)lparg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_get_clipbox)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, GdkRectangle *))fp)(arg0, (GdkRectangle *)lparg1);
+ }
+ }
fail:
if (arg1 && lparg1) setGdkRectangleFields(env, arg1, lparg1);
OS_NATIVE_EXIT(env, that, _1gdk_1region_1get_1clipbox_FUNC);
@@ -6341,7 +6385,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1region_1get_1rectangles)
OS_NATIVE_ENTER(env, that, _1gdk_1region_1get_1rectangles_FUNC);
if (arg1) if ((lparg1 = (*env)->GetIntLongArrayElements(env, arg1, NULL)) == NULL) goto fail;
if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
- gdk_region_get_rectangles((GdkRegion *)arg0, (GdkRectangle **)lparg1, (gint *)lparg2);
+/*
+ gdk_region_get_rectangles(arg0, (GdkRectangle **)lparg1, (gint *)lparg2);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_get_rectangles)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, GdkRectangle **, gint *))fp)(arg0, (GdkRectangle **)lparg1, (gint *)lparg2);
+ }
+ }
fail:
if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
if (arg1 && lparg1) (*env)->ReleaseIntLongArrayElements(env, arg1, lparg1, 0);
@@ -6354,7 +6406,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1region_1intersect)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
{
OS_NATIVE_ENTER(env, that, _1gdk_1region_1intersect_FUNC);
- gdk_region_intersect((GdkRegion *)arg0, (GdkRegion *)arg1);
+/*
+ gdk_region_intersect(arg0, arg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_intersect)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1region_1intersect_FUNC);
}
#endif
@@ -6365,7 +6425,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1region_1new)
{
jintLong rc = 0;
OS_NATIVE_ENTER(env, that, _1gdk_1region_1new_FUNC);
+/*
rc = (jintLong)gdk_region_new();
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_new)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)();
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1region_1new_FUNC);
return rc;
}
@@ -6376,7 +6444,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1region_1offset)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2)
{
OS_NATIVE_ENTER(env, that, _1gdk_1region_1offset_FUNC);
- gdk_region_offset((GdkRegion *)arg0, (gint)arg1, (gint)arg2);
+/*
+ gdk_region_offset(arg0, (gint)arg1, (gint)arg2);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_offset)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, gint, gint))fp)(arg0, (gint)arg1, (gint)arg2);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1region_1offset_FUNC);
}
#endif
@@ -6387,7 +6463,15 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1gdk_1region_1point_1in)
{
jboolean rc = 0;
OS_NATIVE_ENTER(env, that, _1gdk_1region_1point_1in_FUNC);
- rc = (jboolean)gdk_region_point_in((GdkRegion *)arg0, (gint)arg1, (gint)arg2);
+/*
+ rc = (jboolean)gdk_region_point_in(arg0, (gint)arg1, (gint)arg2);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_point_in)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong, gint, gint))fp)(arg0, (gint)arg1, (gint)arg2);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1region_1point_1in_FUNC);
return rc;
}
@@ -6401,7 +6485,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1region_1polygon)
jintLong rc = 0;
OS_NATIVE_ENTER(env, that, _1gdk_1region_1polygon_FUNC);
if (arg0) if ((lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL)) == NULL) goto fail;
- rc = (jintLong)gdk_region_polygon((GdkPoint *)lparg0, arg1, (GdkFillRule)arg2);
+/*
+ rc = (jintLong)gdk_region_polygon(lparg0, arg1, arg2);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_polygon)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jint *, jint, jint))fp)(lparg0, arg1, arg2);
+ }
+ }
fail:
if (arg0 && lparg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0);
OS_NATIVE_EXIT(env, that, _1gdk_1region_1polygon_FUNC);
@@ -6417,7 +6509,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1region_1rect_1in)
jintLong rc = 0;
OS_NATIVE_ENTER(env, that, _1gdk_1region_1rect_1in_FUNC);
if (arg1) if ((lparg1 = getGdkRectangleFields(env, arg1, &_arg1)) == NULL) goto fail;
- rc = (jintLong)gdk_region_rect_in((GdkRegion *)arg0, (GdkRectangle *)lparg1);
+/*
+ rc = (jintLong)gdk_region_rect_in(arg0, (GdkRectangle *)lparg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_rect_in)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, GdkRectangle *))fp)(arg0, (GdkRectangle *)lparg1);
+ }
+ }
fail:
OS_NATIVE_EXIT(env, that, _1gdk_1region_1rect_1in_FUNC);
return rc;
@@ -6432,7 +6532,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1region_1rectangle)
jintLong rc = 0;
OS_NATIVE_ENTER(env, that, _1gdk_1region_1rectangle_FUNC);
if (arg0) if ((lparg0 = getGdkRectangleFields(env, arg0, &_arg0)) == NULL) goto fail;
+/*
rc = (jintLong)gdk_region_rectangle(lparg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_rectangle)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkRectangle *))fp)(lparg0);
+ }
+ }
fail:
OS_NATIVE_EXIT(env, that, _1gdk_1region_1rectangle_FUNC);
return rc;
@@ -6444,7 +6552,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1region_1subtract)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
{
OS_NATIVE_ENTER(env, that, _1gdk_1region_1subtract_FUNC);
- gdk_region_subtract((GdkRegion *)arg0, (GdkRegion *)arg1);
+/*
+ gdk_region_subtract(arg0, arg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_subtract)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1region_1subtract_FUNC);
}
#endif
@@ -6454,7 +6570,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1region_1union)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
{
OS_NATIVE_ENTER(env, that, _1gdk_1region_1union_FUNC);
- gdk_region_union((GdkRegion *)arg0, (GdkRegion *)arg1);
+/*
+ gdk_region_union(arg0, arg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_union)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1region_1union_FUNC);
}
#endif
@@ -6466,7 +6590,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1region_1union_1with_1rect)
GdkRectangle _arg1, *lparg1=NULL;
OS_NATIVE_ENTER(env, that, _1gdk_1region_1union_1with_1rect_FUNC);
if (arg1) if ((lparg1 = getGdkRectangleFields(env, arg1, &_arg1)) == NULL) goto fail;
- gdk_region_union_with_rect((GdkRegion *)arg0, (GdkRectangle *)lparg1);
+/*
+ gdk_region_union_with_rect(arg0, (GdkRectangle *)lparg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_union_with_rect)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, GdkRectangle *))fp)(arg0, (GdkRectangle *)lparg1);
+ }
+ }
fail:
OS_NATIVE_EXIT(env, that, _1gdk_1region_1union_1with_1rect_FUNC);
}
@@ -16649,6 +16781,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1visible)
}
#endif
+#ifndef NO__1gtk_1widget_1shape_1combine_1region
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1shape_1combine_1region)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1widget_1shape_1combine_1region_FUNC);
+/*
+ gtk_widget_shape_combine_region(arg0, arg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_widget_shape_combine_region)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1widget_1shape_1combine_1region_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1widget_1show
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1show)
(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 1408fbcb78..1b56ded3f1 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
@@ -165,6 +165,7 @@
#define gtk_entry_set_icon_from_stock_LIB LIB_GTK
#define gtk_entry_set_icon_sensitive_LIB LIB_GTK
#define gtk_tooltips_new_LIB LIB_GTK
+#define gdk_cairo_region_create_from_surface_LIB LIB_GDK
#define gdk_cursor_new_from_pixbuf_LIB LIB_GDK
#define gdk_cursor_unref_LIB LIB_GDK
#define gdk_device_manager_get_client_pointer_LIB LIB_GDK
@@ -199,6 +200,20 @@
#define gdk_pixbuf_save_to_bufferv_LIB LIB_GDK
#define gdk_pointer_grab_LIB LIB_GDK
#define gdk_pointer_ungrab_LIB LIB_GDK
+#define gdk_region_new_LIB LIB_GDK
+#define gdk_region_rectangle_LIB LIB_GDK
+#define gdk_region_destroy_LIB LIB_GDK
+#define gdk_region_empty_LIB LIB_GDK
+#define gdk_region_subtract_LIB LIB_GDK
+#define gdk_region_offset_LIB LIB_GDK
+#define gdk_region_union_LIB LIB_GDK
+#define gdk_region_intersect_LIB LIB_GDK
+#define gdk_region_rect_in_LIB LIB_GDK
+#define gdk_region_get_clipbox_LIB LIB_GDK
+#define gdk_region_union_with_rect_LIB LIB_GDK
+#define gdk_region_point_in_LIB LIB_GDK
+#define gdk_region_polygon_LIB LIB_GDK
+#define gdk_region_get_rectangles_LIB LIB_GDK
#define gdk_screen_get_default_LIB LIB_GDK
#define gdk_screen_get_monitor_at_point_LIB LIB_GDK
#define gdk_screen_get_monitor_at_window_LIB LIB_GDK
@@ -232,6 +247,7 @@
#define gtk_window_set_opacity_LIB LIB_GTK
#define gtk_window_set_skip_taskbar_hint_LIB LIB_GTK
#define gtk_widget_is_composited_LIB LIB_GTK
+#define gtk_widget_shape_combine_region_LIB LIB_GTK
#define gtk_widget_get_allocation_LIB LIB_GTK
#define gtk_widget_get_tooltip_text_LIB LIB_GTK
#define gtk_widget_get_visible_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 6a35c3348e..61471627e4 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
@@ -405,6 +405,7 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1bitmap_1create_1from_1data",
"_1gdk_1cairo_1create",
"_1gdk_1cairo_1region",
+ "_1gdk_1cairo_1region_1create_1from_1surface",
"_1gdk_1cairo_1reset_1clip",
"_1gdk_1cairo_1set_1source_1color",
"_1gdk_1cairo_1set_1source_1pixbuf",
@@ -1288,6 +1289,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1widget_1set_1state",
"_1gtk_1widget_1set_1tooltip_1text",
"_1gtk_1widget_1set_1visible",
+ "_1gtk_1widget_1shape_1combine_1region",
"_1gtk_1widget_1show",
"_1gtk_1widget_1size_1allocate",
"_1gtk_1widget_1size_1request",
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 5f796ceff3..006a03079a 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
@@ -415,6 +415,7 @@ typedef enum {
_1gdk_1bitmap_1create_1from_1data_FUNC,
_1gdk_1cairo_1create_FUNC,
_1gdk_1cairo_1region_FUNC,
+ _1gdk_1cairo_1region_1create_1from_1surface_FUNC,
_1gdk_1cairo_1reset_1clip_FUNC,
_1gdk_1cairo_1set_1source_1color_FUNC,
_1gdk_1cairo_1set_1source_1pixbuf_FUNC,
@@ -1298,6 +1299,7 @@ typedef enum {
_1gtk_1widget_1set_1state_FUNC,
_1gtk_1widget_1set_1tooltip_1text_FUNC,
_1gtk_1widget_1set_1visible_FUNC,
+ _1gtk_1widget_1shape_1combine_1region_FUNC,
_1gtk_1widget_1show_FUNC,
_1gtk_1widget_1size_1allocate_FUNC,
_1gtk_1widget_1size_1request_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 44a8f8a613..7c37057fb7 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
@@ -4728,7 +4728,7 @@ public static final boolean gdk_property_get(long /*int*/ window, long /*int*/ p
lock.unlock();
}
}
-/** @param region cast=(GdkRegion *) */
+/** @method flags=dynamic */
public static final native void _gdk_region_destroy(long /*int*/ region);
public static final void gdk_region_destroy(long /*int*/ region) {
lock.lock();
@@ -4738,7 +4738,7 @@ public static final void gdk_region_destroy(long /*int*/ region) {
lock.unlock();
}
}
-/** @param region cast=(GdkRegion *) */
+/** @method flags=dynamic */
public static final native boolean _gdk_region_empty(long /*int*/ region);
public static final boolean gdk_region_empty(long /*int*/ region) {
lock.lock();
@@ -4749,7 +4749,7 @@ public static final boolean gdk_region_empty(long /*int*/ region) {
}
}
/**
- * @param region cast=(GdkRegion *)
+ * @method flags=dynamic
* @param rectangle cast=(GdkRectangle *),flags=no_in
*/
public static final native void _gdk_region_get_clipbox(long /*int*/ region, GdkRectangle rectangle);
@@ -4762,7 +4762,7 @@ public static final void gdk_region_get_clipbox(long /*int*/ region, GdkRectangl
}
}
/**
- * @param region cast=(GdkRegion *)
+ * @method flags=dynamic
* @param rectangles cast=(GdkRectangle **)
* @param n_rectangles cast=(gint *)
*/
@@ -4775,10 +4775,7 @@ public static final void gdk_region_get_rectangles(long /*int*/ region, long /*i
lock.unlock();
}
}
-/**
- * @param source1 cast=(GdkRegion *)
- * @param source2 cast=(GdkRegion *)
- */
+/** @method flags=dynamic */
public static final native void _gdk_region_intersect(long /*int*/ source1, long /*int*/ source2);
public static final void gdk_region_intersect(long /*int*/ source1, long /*int*/ source2) {
lock.lock();
@@ -4788,6 +4785,27 @@ public static final void gdk_region_intersect(long /*int*/ source1, long /*int*/
lock.unlock();
}
}
+/** @method flags=dynamic */
+public static final native long /*int*/ _gdk_cairo_region_create_from_surface(long /*int*/ surface);
+public static final long /*int*/ gdk_cairo_region_create_from_surface(long /*int*/ surface) {
+ lock.lock();
+ try {
+ return _gdk_cairo_region_create_from_surface(surface);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic */
+public static final native void _gtk_widget_shape_combine_region(long /*int*/ widget, long /*int*/ region);
+public static final void gtk_widget_shape_combine_region(long /*int*/ widget, long /*int*/ region) {
+ lock.lock();
+ try {
+ _gtk_widget_shape_combine_region(widget,region);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic */
public static final native long /*int*/ _gdk_region_new();
public static final long /*int*/ gdk_region_new() {
lock.lock();
@@ -4798,7 +4816,7 @@ public static final long /*int*/ gdk_region_new() {
}
}
/**
- * @param region cast=(GdkRegion *)
+ * @method flags=dynamic
* @param dx cast=(gint)
* @param dy cast=(gint)
*/
@@ -4812,7 +4830,7 @@ public static final void gdk_region_offset(long /*int*/ region, int dx, int dy)
}
}
/**
- * @param region cast=(GdkRegion *)
+ * @method flags=dynamic
* @param x cast=(gint)
* @param y cast=(gint)
*/
@@ -4826,8 +4844,7 @@ public static final boolean gdk_region_point_in(long /*int*/ region, int x, int
}
}
/**
- * @param points cast=(GdkPoint *)
- * @param fill_rule cast=(GdkFillRule)
+ * @method flags=dynamic
*/
public static final native long /*int*/ _gdk_region_polygon(int[] points, int npoints, int fill_rule);
public static final long /*int*/ gdk_region_polygon(int[] points, int npoints, int fill_rule) {
@@ -4838,7 +4855,10 @@ public static final long /*int*/ gdk_region_polygon(int[] points, int npoints, i
lock.unlock();
}
}
-/** @param rectangle flags=no_out */
+/**
+ * @method flags=dynamic
+ * @param rectangle flags=no_out
+ */
public static final native long /*int*/ _gdk_region_rectangle(GdkRectangle rectangle);
public static final long /*int*/ gdk_region_rectangle(GdkRectangle rectangle) {
lock.lock();
@@ -4849,7 +4869,7 @@ public static final long /*int*/ gdk_region_rectangle(GdkRectangle rectangle) {
}
}
/**
- * @param region cast=(GdkRegion *)
+ * @method flags=dynamic
* @param rect cast=(GdkRectangle *),flags=no_out
*/
public static final native long /*int*/ _gdk_region_rect_in(long /*int*/ region, GdkRectangle rect);
@@ -4861,10 +4881,7 @@ public static final long /*int*/ gdk_region_rect_in(long /*int*/ region, GdkRect
lock.unlock();
}
}
-/**
- * @param source1 cast=(GdkRegion *)
- * @param source2 cast=(GdkRegion *)
- */
+/** @method flags=dynamic */
public static final native void _gdk_region_subtract(long /*int*/ source1, long /*int*/ source2);
public static final void gdk_region_subtract(long /*int*/ source1, long /*int*/ source2) {
lock.lock();
@@ -4874,10 +4891,7 @@ public static final void gdk_region_subtract(long /*int*/ source1, long /*int*/
lock.unlock();
}
}
-/**
- * @param source1 cast=(GdkRegion *)
- * @param source2 cast=(GdkRegion *)
- */
+/** @method flags=dynamic */
public static final native void _gdk_region_union(long /*int*/ source1, long /*int*/ source2);
public static final void gdk_region_union(long /*int*/ source1, long /*int*/ source2) {
lock.lock();
@@ -4888,7 +4902,7 @@ public static final void gdk_region_union(long /*int*/ source1, long /*int*/ sou
}
}
/**
- * @param region cast=(GdkRegion *)
+ * @method flags=dynamic
* @param rect cast=(GdkRectangle *),flags=no_out
*/
public static final native void _gdk_region_union_with_rect(long /*int*/ region, GdkRectangle rect);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java
index 0d384038be..387f21536f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.internal.theme;
import org.eclipse.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 Theme {
@@ -187,9 +188,9 @@ void transferClipping(GC gc, long /*int*/ style) {
long /*int*/ clipping = clipRgn;
if (damageRgn != 0) {
if (clipping != 0) {
- clipping = OS.gdk_region_new();
- OS.gdk_region_union(clipping, clipRgn);
- OS.gdk_region_intersect(clipping, damageRgn);
+ clipping = cairo_region_create ();
+ cairo_region_union (clipping, clipRgn);
+ cairo_region_intersect (clipping, damageRgn);
} else {
clipping = damageRgn;
}
@@ -216,7 +217,39 @@ void transferClipping(GC gc, long /*int*/ style) {
OS.gtk_style_get_white_gc (style, curGC);
if (curGC[0] != 0) OS.gdk_gc_set_clip_region (curGC[0], clipping);
if (clipping != clipRgn && clipping != damageRgn) {
- OS.gdk_region_destroy(clipping);
+ cairo_region_destroy (clipping);
+ }
+}
+
+long /*int*/ cairo_region_create () {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return Cairo.cairo_region_create ();
+ } else {
+ return OS.gdk_region_new ();
+ }
+}
+
+void cairo_region_destroy (long /*int*/ region) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_destroy ( region);
+ } else {
+ OS.gdk_region_destroy (region);
+ }
+}
+
+void cairo_region_union (long /*int*/ dst, long /*int*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_union (dst, other);
+ } else {
+ OS.gdk_region_union (dst, other);
+ }
+}
+
+void cairo_region_intersect (long /*int*/ dst, long /*int*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_intersect (dst, other);
+ } else {
+ OS.gdk_region_intersect (dst, other);
}
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
index d1963ec87a..a265e1fcdf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
@@ -425,10 +425,10 @@ void checkGC (int mask) {
}
long /*int*/ convertRgn(long /*int*/ rgn, double[] matrix) {
- long /*int*/ newRgn = OS.gdk_region_new();
+ long /*int*/ newRgn = cairo_region_create ();
int[] nRects = new int[1];
long /*int*/[] rects = new long /*int*/[1];
- OS.gdk_region_get_rectangles(rgn, rects, nRects);
+ cairo_region_get_rectangles (rgn, rects, nRects);
GdkRectangle rect = new GdkRectangle();
int[] pointArray = new int[8];
double[] x = new double[1], y = new double[1];
@@ -455,8 +455,8 @@ long /*int*/ convertRgn(long /*int*/ rgn, double[] matrix) {
pointArray[6] = (int)x[0];
pointArray[7] = (int)Math.round(y[0]);
long /*int*/ polyRgn = OS.gdk_region_polygon(pointArray, pointArray.length / 2, OS.GDK_EVEN_ODD_RULE);
- OS.gdk_region_union(newRgn, polyRgn);
- OS.gdk_region_destroy(polyRgn);
+ cairo_region_union (newRgn, polyRgn);
+ cairo_region_destroy (polyRgn);
}
if (rects[0] != 0) OS.g_free(rects[0]);
return newRgn;
@@ -586,15 +586,15 @@ public void copyArea(int srcX, int srcY, int width, int height, int destX, int d
srcRect.y = srcY;
srcRect.width = width;
srcRect.height = height;
- long /*int*/ copyRegion = OS.gdk_region_rectangle (srcRect);
- OS.gdk_region_intersect(copyRegion, visibleRegion);
- long /*int*/ invalidateRegion = OS.gdk_region_rectangle (srcRect);
- OS.gdk_region_subtract (invalidateRegion, visibleRegion);
- OS.gdk_region_offset (invalidateRegion, deltaX, deltaY);
+ long /*int*/ copyRegion = cairo_region_create_rectangle (srcRect);
+ cairo_region_intersect (copyRegion, visibleRegion);
+ long /*int*/ invalidateRegion = cairo_region_create_rectangle (srcRect);
+ cairo_region_subtract (invalidateRegion, visibleRegion);
+ cairo_region_translate (invalidateRegion, deltaX, deltaY);
OS.gdk_window_invalidate_region(drawable, invalidateRegion, false);
- OS.gdk_region_destroy (visibleRegion);
- OS.gdk_region_destroy (copyRegion);
- OS.gdk_region_destroy (invalidateRegion);
+ cairo_region_destroy (visibleRegion);
+ cairo_region_destroy (copyRegion);
+ cairo_region_destroy (invalidateRegion);
}
}
} else {
@@ -673,7 +673,7 @@ void destroy() {
/* Free resources */
long /*int*/ clipRgn = data.clipRgn;
- if (clipRgn != 0) OS.gdk_region_destroy(clipRgn);
+ if (clipRgn != 0) cairo_region_destroy (clipRgn);
Image image = data.image;
if (image != null) {
image.memGC = null;
@@ -1118,9 +1118,9 @@ void drawImageMask(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeig
long /*int*/ mask = OS.gdk_bitmap_create_from_data(0, maskData, newWidth, newHeight);
if (mask != 0) {
long /*int*/ gc = OS.gdk_gc_new(mask);
- OS.gdk_region_offset(data.clipRgn, -destX + srcX, -destY + srcY);
+ cairo_region_translate (data.clipRgn, -destX + srcX, -destY + srcY);
OS.gdk_gc_set_clip_region(gc, data.clipRgn);
- OS.gdk_region_offset(data.clipRgn, destX - srcX, destY - srcY);
+ cairo_region_translate (data.clipRgn, destX - srcX, destY - srcY);
GdkColor color = new GdkColor();
color.pixel = 1;
OS.gdk_gc_set_foreground(gc, color);
@@ -1190,15 +1190,15 @@ void drawImageXRender(Image srcImage, int srcX, int srcY, int srcWidth, int srcH
if (clipping == 0) {
clipping = data.damageRgn;
} else {
- clipping = OS.gdk_region_new();
- OS.gdk_region_union(clipping, data.clipRgn);
- OS.gdk_region_intersect(clipping, data.damageRgn);
+ clipping = cairo_region_create ();
+ cairo_region_union (clipping, data.clipRgn);
+ cairo_region_intersect (clipping, data.damageRgn);
}
}
if (clipping != 0) {
int[] nRects = new int[1];
long /*int*/[] rects = new long /*int*/[1];
- OS.gdk_region_get_rectangles(clipping, rects, nRects);
+ cairo_region_get_rectangles (clipping, rects, nRects);
GdkRectangle rect = new GdkRectangle();
short[] xRects = new short[nRects[0] * 4];
for (int i=0, j=0; i<nRects[0]; i++, j+=4) {
@@ -1210,7 +1210,7 @@ void drawImageXRender(Image srcImage, int srcX, int srcY, int srcWidth, int srcH
}
OS.XRenderSetPictureClipRectangles(xDisplay, destPict, 0, 0, xRects, nRects[0]);
if (clipping != data.clipRgn && clipping != data.damageRgn) {
- OS.gdk_region_destroy(clipping);
+ cairo_region_destroy (clipping);
}
if (rects[0] != 0) OS.g_free(rects[0]);
}
@@ -2407,23 +2407,23 @@ public Rectangle getClipping() {
long /*int*/ clipRgn = data.clipRgn;
long /*int*/ damageRgn = data.damageRgn;
if (clipRgn != 0 || damageRgn != 0 || cairo != 0) {
- long /*int*/ rgn = OS.gdk_region_new();
+ long /*int*/ rgn = cairo_region_create ();
GdkRectangle rect = new GdkRectangle();
rect.width = width;
rect.height = height;
- OS.gdk_region_union_with_rect(rgn, rect);
+ cairo_region_union_rectangle (rgn, rect);
if (damageRgn != 0) {
- OS.gdk_region_intersect (rgn, damageRgn);
+ cairo_region_intersect (rgn, damageRgn);
}
/* Intersect visible bounds with clipping */
if (clipRgn != 0) {
/* Convert clipping to device space if needed */
if (data.clippingTransform != null) {
clipRgn = convertRgn(clipRgn, data.clippingTransform);
- OS.gdk_region_intersect(rgn, clipRgn);
- OS.gdk_region_destroy(clipRgn);
+ cairo_region_intersect (rgn, clipRgn);
+ cairo_region_destroy (clipRgn);
} else {
- OS.gdk_region_intersect(rgn, clipRgn);
+ cairo_region_intersect (rgn, clipRgn);
}
}
/* Convert to user space */
@@ -2432,11 +2432,11 @@ public Rectangle getClipping() {
Cairo.cairo_get_matrix(cairo, matrix);
Cairo.cairo_matrix_invert(matrix);
clipRgn = convertRgn(rgn, matrix);
- OS.gdk_region_destroy(rgn);
+ cairo_region_destroy (rgn);
rgn = clipRgn;
}
- OS.gdk_region_get_clipbox(rgn, rect);
- OS.gdk_region_destroy(rgn);
+ cairo_region_get_extents (rgn, rect);
+ cairo_region_destroy (rgn);
x = rect.x;
y = rect.y;
width = rect.width;
@@ -2464,7 +2464,7 @@ public void getClipping(Region region) {
if (region == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
long /*int*/ clipping = region.handle;
- OS.gdk_region_subtract(clipping, clipping);
+ cairo_region_subtract (clipping, clipping);
long /*int*/ cairo = data.cairo;
long /*int*/ clipRgn = data.clipRgn;
if (clipRgn == 0) {
@@ -2473,19 +2473,19 @@ public void getClipping(Region region) {
getSize(width, height);
rect.width = width[0];
rect.height = height[0];
- OS.gdk_region_union_with_rect(clipping, rect);
+ cairo_region_union_rectangle (clipping, rect);
} else {
/* Convert clipping to device space if needed */
if (data.clippingTransform != null) {
long /*int*/ rgn = convertRgn(clipRgn, data.clippingTransform);
- OS.gdk_region_union(clipping, rgn);
- OS.gdk_region_destroy(rgn);
+ cairo_region_union (clipping, rgn);
+ cairo_region_destroy (rgn);
} else {
- OS.gdk_region_union(clipping, clipRgn);
+ cairo_region_union (clipping, clipRgn);
}
}
if (data.damageRgn != 0) {
- OS.gdk_region_intersect(clipping, data.damageRgn);
+ cairo_region_intersect (clipping, data.damageRgn);
}
/* Convert to user space */
if (cairo != 0) {
@@ -2493,9 +2493,9 @@ public void getClipping(Region region) {
Cairo.cairo_get_matrix(cairo, matrix);
Cairo.cairo_matrix_invert(matrix);
long /*int*/ rgn = convertRgn(clipping, matrix);
- OS.gdk_region_subtract(clipping, clipping);
- OS.gdk_region_union(clipping, rgn);
- OS.gdk_region_destroy(rgn);
+ cairo_region_subtract (clipping, clipping);
+ cairo_region_union (clipping, rgn);
+ cairo_region_destroy (rgn);
}
}
@@ -3291,7 +3291,14 @@ static void setCairoRegion(long /*int*/ cairo, long /*int*/ rgn) {
} else {
int[] nRects = new int[1];
long /*int*/[] rects = new long /*int*/[1];
- OS.gdk_region_get_rectangles(rgn, rects, nRects);
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ int num = Cairo.cairo_region_num_rectangles (rgn);
+ for (int n = 0; n < num; n++) {
+ Cairo.cairo_region_get_rectangle (rgn, n, rects[n]);
+ }
+ } else {
+ OS.gdk_region_get_rectangles (rgn, rects, nRects);
+ }
GdkRectangle rect = new GdkRectangle();
for (int i=0; i<nRects[0]; i++) {
OS.memmove(rect, rects[0] + (i * GdkRectangle.sizeof), GdkRectangle.sizeof);
@@ -3337,7 +3344,7 @@ void setClipping(long /*int*/ clipRgn) {
long /*int*/ cairo = data.cairo;
if (clipRgn == 0) {
if (data.clipRgn != 0) {
- OS.gdk_region_destroy(data.clipRgn);
+ cairo_region_destroy (data.clipRgn);
data.clipRgn = 0;
}
if (cairo != 0) {
@@ -3348,9 +3355,9 @@ void setClipping(long /*int*/ clipRgn) {
OS.gdk_gc_set_clip_region(handle, clipping);
}
} else {
- if (data.clipRgn == 0) data.clipRgn = OS.gdk_region_new();
- OS.gdk_region_subtract(data.clipRgn, data.clipRgn);
- OS.gdk_region_union(data.clipRgn, clipRgn);
+ if (data.clipRgn == 0) data.clipRgn = cairo_region_create ();
+ cairo_region_subtract (data.clipRgn, data.clipRgn);
+ cairo_region_union (data.clipRgn, clipRgn);
if (cairo != 0) {
if (data.clippingTransform == null) data.clippingTransform = new double[6];
Cairo.cairo_get_matrix(cairo, data.clippingTransform);
@@ -3358,12 +3365,12 @@ void setClipping(long /*int*/ clipRgn) {
} else {
long /*int*/ clipping = clipRgn;
if (data.damageRgn != 0) {
- clipping = OS.gdk_region_new();
- OS.gdk_region_union(clipping, clipRgn);
- OS.gdk_region_intersect(clipping, data.damageRgn);
+ clipping = cairo_region_create ();
+ cairo_region_union (clipping, clipRgn);
+ cairo_region_intersect (clipping, data.damageRgn);
}
OS.gdk_gc_set_clip_region(handle, clipping);
- if (clipping != clipRgn) OS.gdk_region_destroy(clipping);
+ if (clipping != clipRgn) cairo_region_destroy (clipping);
}
}
}
@@ -3397,10 +3404,10 @@ public void setClipping(int x, int y, int width, int height) {
rect.y = y;
rect.width = width;
rect.height = height;
- long /*int*/ clipRgn = OS.gdk_region_new();
- OS.gdk_region_union_with_rect(clipRgn, rect);
+ long /*int*/ clipRgn = cairo_region_create ();
+ cairo_region_union_rectangle (clipRgn, rect);
setClipping(clipRgn);
- OS.gdk_region_destroy(clipRgn);
+ cairo_region_destroy (clipRgn);
}
/**
@@ -4204,4 +4211,86 @@ public String toString () {
return "GC {" + handle + "}";
}
+long /*int*/ cairo_region_create () {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return Cairo.cairo_region_create ();
+ } else {
+ return OS.gdk_region_new ();
+ }
+}
+
+void cairo_region_destroy (long /*int*/ region) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_destroy (region);
+ } else {
+ OS.gdk_region_destroy (region);
+ }
+}
+
+void cairo_region_subtract (long /*int*/ dst, long /*int*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_subtract (dst, other);
+ } else {
+ OS.gdk_region_subtract (dst, other);
+ }
+}
+
+void cairo_region_translate (long /*int*/ region, int dx, int dy) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_translate (region, dx, dy);
+ } else {
+ OS.gdk_region_offset (region, dx, dy);
+ }
+}
+
+void cairo_region_union (long /*int*/ dst, long /*int*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_union (dst, other);
+ } else {
+ OS.gdk_region_union (dst, other);
+ }
+}
+
+void cairo_region_intersect (long /*int*/ dst, long /*int*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_intersect (dst, other);
+ } else {
+ OS.gdk_region_intersect (dst, other);
+ }
+}
+
+long /*int*/ cairo_region_create_rectangle (GdkRectangle rectangle) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return Cairo.cairo_region_create_rectangle (rectangle);
+ } else {
+ return OS.gdk_region_rectangle (rectangle);
+ }
+}
+
+void cairo_region_get_extents (long /*int*/ region, GdkRectangle extents) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_get_extents (region, extents);
+ } else {
+ OS.gdk_region_get_clipbox (region, extents);
+ }
+}
+
+void cairo_region_union_rectangle (long /*int*/ dst, GdkRectangle rectangle) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_union_rectangle (dst, rectangle);
+ } else {
+ OS.gdk_region_union_with_rect (dst, rectangle);
+ }
+}
+
+void cairo_region_get_rectangles (long /*int*/ region, long /*int*/[] rectangles, int[] n_rectangles) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ int num = Cairo.cairo_region_num_rectangles (region);
+ for (int n = 0; n < num; n++) {
+ Cairo.cairo_region_get_rectangle (region, n, rectangles[n]);
+ }
+ } else {
+ OS.gdk_region_get_rectangles (region, rectangles, n_rectangles);
+ }
+}
}
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 e4e069953d..9582e80726 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.*;
@@ -74,7 +75,7 @@ public Region() {
*/
public Region(Device device) {
super(device);
- handle = OS.gdk_region_new();
+ handle = cairo_region_create ();
if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
init();
}
@@ -110,8 +111,8 @@ public void add (int[] pointArray) {
*/
if (pointArray.length < 6) return;
long /*int*/ polyRgn = OS.gdk_region_polygon(pointArray, pointArray.length / 2, OS.GDK_EVEN_ODD_RULE);
- OS.gdk_region_union(handle, polyRgn);
- OS.gdk_region_destroy(polyRgn);
+ cairo_region_union (handle, polyRgn);
+ cairo_region_destroy (polyRgn);
}
/**
@@ -160,7 +161,7 @@ public void add(int x, int y, int width, int height) {
gdkRect.y = y;
gdkRect.width = width;
gdkRect.height = height;
- OS.gdk_region_union_with_rect(handle, gdkRect);
+ cairo_region_union_rectangle (handle, gdkRect);
}
/**
@@ -182,7 +183,7 @@ public void add(Region region) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (region == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- OS.gdk_region_union(handle, region.handle);
+ cairo_region_union (handle, region.handle);
}
/**
@@ -200,7 +201,7 @@ public void add(Region region) {
*/
public boolean contains(int x, int y) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return OS.gdk_region_point_in(handle, x, y);
+ return cairo_region_contains_point(handle, x, y);
}
/**
@@ -224,7 +225,7 @@ public boolean contains(Point pt) {
}
void destroy() {
- OS.gdk_region_destroy(handle);
+ cairo_region_destroy (handle);
handle = 0;
}
@@ -261,7 +262,7 @@ public boolean equals(Object object) {
public Rectangle getBounds() {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
GdkRectangle gdkRect = new GdkRectangle();
- OS.gdk_region_get_clipbox(handle, gdkRect);
+ cairo_region_get_extents (handle, gdkRect);
return new Rectangle(gdkRect.x, gdkRect.y, gdkRect.width, gdkRect.height);
}
@@ -347,9 +348,9 @@ public void intersect(int x, int y, int width, int height) {
gdkRect.y = y;
gdkRect.width = width;
gdkRect.height = height;
- long /*int*/ rectRgn = OS.gdk_region_rectangle(gdkRect);
- OS.gdk_region_intersect(handle, rectRgn);
- OS.gdk_region_destroy(rectRgn);
+ long /*int*/ rectRgn = cairo_region_create_rectangle (gdkRect);
+ cairo_region_intersect (handle, rectRgn);
+ cairo_region_destroy (rectRgn);
}
/**
@@ -373,7 +374,7 @@ public void intersect(Region region) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (region == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- OS.gdk_region_intersect(handle, region.handle);
+ cairo_region_intersect (handle, region.handle);
}
/**
@@ -400,7 +401,7 @@ public boolean intersects (int x, int y, int width, int height) {
gdkRect.y = y;
gdkRect.width = width;
gdkRect.height = height;
- return OS.gdk_region_rect_in(handle, gdkRect) != OS.GDK_OVERLAP_RECTANGLE_OUT;
+ return cairo_region_contains_rectangle (handle, gdkRect) != OS.GDK_OVERLAP_RECTANGLE_OUT;
}
/**
* Returns <code>true</code> if the given rectangle intersects
@@ -451,7 +452,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);
+ }
}
/**
@@ -479,8 +484,8 @@ public void subtract (int[] pointArray) {
*/
if (pointArray.length < 6) return;
long /*int*/ polyRgn = OS.gdk_region_polygon(pointArray, pointArray.length / 2, OS.GDK_EVEN_ODD_RULE);
- OS.gdk_region_subtract(handle, polyRgn);
- OS.gdk_region_destroy(polyRgn);
+ cairo_region_subtract (handle, polyRgn);
+ cairo_region_destroy (polyRgn);
}
/**
@@ -531,9 +536,9 @@ public void subtract(int x, int y, int width, int height) {
gdkRect.y = y;
gdkRect.width = width;
gdkRect.height = height;
- long /*int*/ rectRgn = OS.gdk_region_rectangle(gdkRect);
- OS.gdk_region_subtract(handle, rectRgn);
- OS.gdk_region_destroy(rectRgn);
+ long /*int*/ rectRgn = cairo_region_create_rectangle (gdkRect);
+ cairo_region_subtract (handle, rectRgn);
+ cairo_region_destroy (rectRgn);
}
/**
@@ -557,7 +562,7 @@ public void subtract(Region region) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (region == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- OS.gdk_region_subtract(handle, region.handle);
+ cairo_region_subtract (handle, region.handle);
}
/**
@@ -575,7 +580,7 @@ public void subtract(Region region) {
*/
public void translate (int x, int y) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- OS.gdk_region_offset (handle, x, y);
+ cairo_region_translate (handle, x, y);
}
/**
@@ -609,4 +614,92 @@ public String toString () {
if (isDisposed()) return "Region {*DISPOSED*}";
return "Region {" + handle + "}";
}
+
+long /*int*/ cairo_region_create () {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return Cairo.cairo_region_create ();
+ } else {
+ return OS.gdk_region_new ();
+ }
+}
+
+void cairo_region_destroy (long /*int*/ region) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_destroy ( region);
+ } else {
+ OS.gdk_region_destroy (region);
+ }
+}
+
+void cairo_region_subtract (long /*int*/ dst, long /*int*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_subtract (dst, other);
+ } else {
+ OS.gdk_region_subtract (dst, other);
+ }
+}
+
+void cairo_region_translate (long /*int*/ region, int dx, int dy) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_translate (region, dx, dy);
+ } else {
+ OS.gdk_region_offset (region, dx, dy);
+ }
+}
+
+void cairo_region_union (long /*int*/ dst, long /*int*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_union (dst, other);
+ } else {
+ OS.gdk_region_union (dst, other);
+ }
+}
+
+void cairo_region_intersect (long /*int*/ dst, long /*int*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_intersect (dst, other);
+ } else {
+ OS.gdk_region_intersect (dst, other);
+ }
+}
+
+long /*int*/ cairo_region_create_rectangle (GdkRectangle rectangle) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return Cairo.cairo_region_create_rectangle (rectangle);
+ } else {
+ return OS.gdk_region_rectangle (rectangle);
+ }
+}
+
+long /*int*/ cairo_region_contains_rectangle (long /*int*/ region, GdkRectangle rectangle) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return Cairo.cairo_region_contains_rectangle (region, rectangle);
+ } else {
+ return OS.gdk_region_rect_in (region, rectangle);
+ }
+}
+
+void cairo_region_get_extents (long /*int*/ region, GdkRectangle extents) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_get_extents (region, extents);
+ } else {
+ OS.gdk_region_get_clipbox (region, extents);
+ }
+}
+
+void cairo_region_union_rectangle (long /*int*/ dst, GdkRectangle rectangle) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_union_rectangle (dst, rectangle);
+ } else {
+ OS.gdk_region_union_with_rect (dst, rectangle);
+ }
+}
+
+boolean cairo_region_contains_point(long /*int*/ region, int x, int y) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return Cairo.cairo_region_contains_point (region, x, y);
+ } else {
+ return OS.gdk_region_point_in (region, x, y);
+ }
+}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java
index c61fadbe30..fe03bcbe51 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java
@@ -571,7 +571,7 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo
long /*int*/ rgn = OS.gdk_pango_layout_get_clip_region(layout, x, y, ranges, ranges.length / 2);
if (rgn != 0) {
OS.gdk_gc_set_clip_region(gc.handle, rgn);
- OS.gdk_region_destroy(rgn);
+ cairo_region_destroy (rgn);
}
OS.gdk_draw_layout_with_colors(data.drawable, gc.handle, x, y, layout, selectionForeground.handle, selectionBackground.handle);
drawBorder(gc, x, y, selectionForeground.handle);
@@ -601,7 +601,7 @@ void drawWithCairo(GC gc, int x, int y, int start, int end, boolean fullSelectio
Cairo.cairo_clip(cairo);
Cairo.cairo_set_source_rgba(cairo, (bg.red & 0xFFFF) / (float)0xFFFF, (bg.green & 0xFFFF) / (float)0xFFFF, (bg.blue & 0xFFFF) / (float)0xFFFF, data.alpha / (float)0xFF);
Cairo.cairo_paint(cairo);
- OS.gdk_region_destroy(rgn);
+ cairo_region_destroy (rgn);
}
Cairo.cairo_set_source_rgba(cairo, (fg.red & 0xFFFF) / (float)0xFFFF, (fg.green & 0xFFFF) / (float)0xFFFF, (fg.blue & 0xFFFF) / (float)0xFFFF, data.alpha / (float)0xFF);
Cairo.cairo_move_to(cairo, x, y);
@@ -640,7 +640,7 @@ void drawBorder(GC gc, int x, int y, GdkColor selectionColor) {
if (rgn != 0) {
int[] nRects = new int[1];
long /*int*/[] rects = new long /*int*/[1];
- OS.gdk_region_get_rectangles(rgn, rects, nRects);
+ cairo_region_get_rectangles (rgn, rects, nRects);
GdkRectangle rect = new GdkRectangle();
GdkColor color = null;
if (color == null && style.borderColor != null) color = style.borderColor.handle;
@@ -697,7 +697,7 @@ void drawBorder(GC gc, int x, int y, GdkColor selectionColor) {
}
}
if (rects[0] != 0) OS.g_free(rects[0]);
- OS.gdk_region_destroy(rgn);
+ cairo_region_destroy (rgn);
}
}
}
@@ -837,7 +837,7 @@ public Rectangle getBounds(int start, int end) {
PangoRectangle pangoRect = new PangoRectangle();
long /*int*/ iter = OS.pango_layout_get_iter(layout);
if (iter == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- long /*int*/ linesRegion = OS.gdk_region_new();
+ long /*int*/ linesRegion = cairo_region_create ();
if (linesRegion == 0) SWT.error(SWT.ERROR_NO_HANDLES);
int lineEnd = 0;
do {
@@ -852,14 +852,14 @@ public Rectangle getBounds(int start, int end) {
rect.y = OS.PANGO_PIXELS(pangoRect.y);
rect.width = OS.PANGO_PIXELS(pangoRect.width);
rect.height = OS.PANGO_PIXELS(pangoRect.height);
- OS.gdk_region_union_with_rect(linesRegion, rect);
+ cairo_region_union_rectangle (linesRegion, rect);
} while (lineEnd + 1 <= byteEnd);
- OS.gdk_region_intersect(clipRegion, linesRegion);
- OS.gdk_region_destroy(linesRegion);
+ cairo_region_intersect (clipRegion, linesRegion);
+ cairo_region_destroy (linesRegion);
OS.pango_layout_iter_free(iter);
- OS.gdk_region_get_clipbox(clipRegion, rect);
- OS.gdk_region_destroy(clipRegion);
+ cairo_region_get_extents (clipRegion, rect);
+ cairo_region_destroy (clipRegion);
if (OS.pango_context_get_base_dir(context) == OS.PANGO_DIRECTION_RTL) {
rect.x = width() - rect.x - rect.width;
}
@@ -2223,4 +2223,54 @@ int width () {
return OS.PANGO_PIXELS(w[0]);
}
+long /*int*/ cairo_region_create () {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return Cairo.cairo_region_create ();
+ } else {
+ return OS.gdk_region_new ();
+ }
+}
+
+void cairo_region_destroy (long /*int*/ region) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_destroy (region);
+ } else {
+ OS.gdk_region_destroy (region);
+ }
+}
+
+void cairo_region_intersect (long /*int*/ dst, long /*int*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_intersect (dst, other);
+ } else {
+ OS.gdk_region_intersect (dst, other);
+ }
+}
+
+void cairo_region_get_extents (long /*int*/ region, GdkRectangle extents) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_get_extents (region, extents);
+ } else {
+ OS.gdk_region_get_clipbox (region, extents);
+ }
+}
+
+void cairo_region_union_rectangle (long /*int*/ dst, GdkRectangle rectangle) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_union_rectangle (dst, rectangle);
+ } else {
+ OS.gdk_region_union_with_rect (dst, rectangle);
+ }
+}
+
+void cairo_region_get_rectangles(long /*int*/ region, long /*int*/[] rectangles, int[] n_rectangles) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ int num = Cairo.cairo_region_num_rectangles (region);
+ for (int n = 0; n < num; n++) {
+ Cairo.cairo_region_get_rectangle (region, n, rectangles[n]);
+ }
+ } else {
+ OS.gdk_region_get_rectangles (region, rectangles, n_rectangles);
+ }
+}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
index f45d8438fd..f539b35c8c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.cairo.Cairo;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.*;
@@ -256,13 +257,13 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b
srcRect.y = y;
srcRect.width = width;
srcRect.height = height;
- long /*int*/ copyRegion = OS.gdk_region_rectangle (srcRect);
- OS.gdk_region_intersect(copyRegion, visibleRegion);
- long /*int*/ invalidateRegion = OS.gdk_region_rectangle (srcRect);
- OS.gdk_region_subtract (invalidateRegion, visibleRegion);
- OS.gdk_region_offset (invalidateRegion, deltaX, deltaY);
+ long /*int*/ copyRegion = cairo_region_create_rectangle (srcRect);
+ cairo_region_intersect (copyRegion, visibleRegion);
+ long /*int*/ invalidateRegion = cairo_region_create_rectangle (srcRect);
+ cairo_region_subtract (invalidateRegion, visibleRegion);
+ cairo_region_translate (invalidateRegion, deltaX, deltaY);
GdkRectangle copyRect = new GdkRectangle();
- OS.gdk_region_get_clipbox (copyRegion, copyRect);
+ cairo_region_get_extents (copyRegion, copyRect);
if (copyRect.width != 0 && copyRect.height != 0) {
update ();
}
@@ -287,7 +288,7 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b
rect.y = y;
rect.width = width;
rect.height = height;
- OS.gdk_region_union_with_rect (invalidateRegion, rect);
+ cairo_region_union_rectangle (invalidateRegion, rect);
} else {
GdkRectangle rect = new GdkRectangle ();
if (deltaX != 0) {
@@ -297,7 +298,7 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b
rect.y = y;
rect.width = Math.abs(deltaX);
rect.height = height;
- OS.gdk_region_union_with_rect (invalidateRegion, rect);
+ cairo_region_union_rectangle (invalidateRegion, rect);
}
if (deltaY != 0) {
int newY = destY - deltaY;
@@ -306,13 +307,13 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b
rect.y = newY;
rect.width = width;
rect.height = Math.abs(deltaY);
- OS.gdk_region_union_with_rect (invalidateRegion, rect);
+ cairo_region_union_rectangle (invalidateRegion, rect);
}
}
OS.gdk_window_invalidate_region(window, invalidateRegion, all);
- OS.gdk_region_destroy (visibleRegion);
- OS.gdk_region_destroy (copyRegion);
- OS.gdk_region_destroy (invalidateRegion);
+ cairo_region_destroy (visibleRegion);
+ cairo_region_destroy (copyRegion);
+ cairo_region_destroy (invalidateRegion);
}
if (all) {
Control [] children = _getChildren ();
@@ -408,4 +409,35 @@ void updateCaret () {
OS.gtk_im_context_set_cursor_location (imHandle, rect);
}
+void cairo_region_subtract (long /*int*/ dst, long /*int*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_subtract(dst, other);
+ } else {
+ OS.gdk_region_subtract(dst, other);
+ }
+}
+
+void cairo_region_translate (long /*int*/ region, int dx, int dy) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_translate (region, dx, dy);
+ } else {
+ OS.gdk_region_offset (region, dx, dy);
+ }
+}
+
+void cairo_region_intersect (long /*int*/ dst, long /*int*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_intersect (dst, other);
+ } else {
+ OS.gdk_region_intersect (dst, other);
+ }
+}
+
+void cairo_region_get_extents (long /*int*/ region, GdkRectangle extents) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_get_extents (region, extents);
+ } else {
+ OS.gdk_region_get_clipbox (region, extents);
+ }
+}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 872c010852..a632aa7fe9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -730,7 +730,7 @@ long /*int*/ gtk_expose_event (long /*int*/ widget, long /*int*/ eventPtr) {
OS.memmove(gdkEvent, eventPtr, GdkEventExpose.sizeof);
long /*int*/ [] rectangles = new long /*int*/ [1];
int [] n_rectangles = new int [1];
- OS.gdk_region_get_rectangles (gdkEvent.region, rectangles, n_rectangles);
+ cairo_region_get_rectangles (gdkEvent.region, rectangles, n_rectangles);
GdkRectangle rect = new GdkRectangle ();
for (int i=0; i<n_rectangles[0]; i++) {
Event event = new Event ();
@@ -740,14 +740,14 @@ long /*int*/ gtk_expose_event (long /*int*/ widget, long /*int*/ eventPtr) {
event.width = rect.width;
event.height = rect.height;
if ((style & SWT.MIRRORED) != 0) event.x = getClientWidth () - event.width - event.x;
- long /*int*/ damageRgn = OS.gdk_region_new ();
- OS.gdk_region_union_with_rect (damageRgn, rect);
+ long /*int*/ damageRgn = cairo_region_create ();
+ cairo_region_union_rectangle (damageRgn, rect);
GCData data = new GCData ();
data.damageRgn = damageRgn;
GC gc = event.gc = GC.gtk_new (this, data);
sendEvent (SWT.Paint, event);
gc.dispose ();
- OS.gdk_region_destroy (damageRgn);
+ cairo_region_destroy (damageRgn);
event.gc = null;
}
OS.g_free (rectangles [0]);
@@ -1593,4 +1593,23 @@ void updateLayout (boolean all) {
}
}
}
+
+long /*int*/ cairo_region_create () {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return Cairo.cairo_region_create ();
+ } else {
+ return OS.gdk_region_new ();
+ }
+}
+
+void cairo_region_get_rectangles (long /*int*/ region, long /*int*/[] rectangles, int[] n_rectangles) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ int num = Cairo.cairo_region_num_rectangles (region);
+ for (int n = 0; n < num; n++) {
+ Cairo.cairo_region_get_rectangle (region, n, rectangles[n]);
+ }
+ } else {
+ OS.gdk_region_get_rectangles(region, rectangles, n_rectangles);
+ }
+}
}
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 98260057c0..2c7ed48f67 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
@@ -424,7 +424,7 @@ void printWindow (boolean first, Control control, GC gc, long /*int*/ drawable,
event.window = OS.g_object_ref (window);
event.area_width = rect.width;
event.area_height = rect.height;
- event.region = OS.gdk_region_rectangle (rect);
+ event.region = cairo_region_create_rectangle (rect);
OS.memmove (eventPtr, event, GdkEventExpose.sizeof);
OS.gtk_widget_send_expose (userData [0], eventPtr);
OS.gdk_event_free (eventPtr);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
index 92ec814d9e..f4192f45a4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
@@ -249,11 +249,33 @@ void configure () {
OS.gtk_window_move (handle, Math.min(dest.width - w, x - w + 17), y - h - TIP_HEIGHT);
}
}
- long /*int*/ rgn = OS.gdk_region_polygon (polyline, polyline.length / 2, OS.GDK_EVEN_ODD_RULE);
OS.gtk_widget_realize (handle);
long /*int*/ window = gtk_widget_get_window (handle);
- OS.gdk_window_shape_combine_region (window, rgn, 0, 0);
- OS.gdk_region_destroy (rgn);
+ /*
+ As methods required to replicate gdk_window_shape_combine_region ()
+ are available starting from GTK+ 3, Cairo implementation that replicates
+ gdk_region_polygon () should be also available to GTK+ 3.0 and higher.
+ */
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ long /*int*/ cairo = OS.gdk_cairo_create (window);
+ int count = polyline.length / 2;
+ if (count == 0) return;
+ Cairo.cairo_move_to (cairo, polyline[0], polyline[1]);
+ for (int i=1,j=2; i<count; i++,j+=2) {
+ Cairo.cairo_move_to (cairo, polyline[j]+0.5, polyline[j+1]+0.5);
+ }
+ Cairo.cairo_close_path (cairo);
+ Cairo.cairo_set_fill_rule (cairo, Cairo.CAIRO_FILL_RULE_EVEN_ODD);
+ Cairo.cairo_fill (cairo);
+ long /*int*/ surface = Cairo.cairo_get_target (cairo);
+ long /*int*/ region = OS.gdk_cairo_region_create_from_surface (surface);
+ OS.gtk_widget_shape_combine_region (window, region);
+ Cairo.cairo_destroy (cairo);
+ } else {
+ long /*int*/ rgn = OS.gdk_region_polygon (polyline, polyline.length / 2, OS.GDK_EVEN_ODD_RULE);
+ OS.gdk_window_shape_combine_region (window, rgn, 0, 0);
+ OS.gdk_region_destroy (rgn);
+ }
}
void createHandle (int index) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index 02a53662e1..99df9be3bd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.cairo.Cairo;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.events.*;
@@ -2014,4 +2015,27 @@ void gdk_cursor_unref (long /*int*/ cursor) {
}
}
+void cairo_region_destroy (long /*int*/ region) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_destroy ( region);
+ } else {
+ OS.gdk_region_destroy (region);
+ }
+}
+
+long /*int*/ cairo_region_create_rectangle (GdkRectangle rectangle) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return Cairo.cairo_region_create_rectangle(rectangle);
+ } else {
+ return OS.gdk_region_rectangle(rectangle);
+ }
+}
+
+void cairo_region_union_rectangle (long /*int*/ dst, GdkRectangle rectangle) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_union_rectangle (dst, rectangle);
+ } else {
+ OS.gdk_region_union_with_rect (dst, rectangle);
+ }
+}
}