aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor2012-06-29 10:31:45 (EDT)
committerSilenio Quarti2012-08-01 09:54:30 (EDT)
commit916bed68a7f416f534701e25d01d07957e5d4d12 (patch)
treecb416e6780d110a824255c00ea3837f8f17d8df7
parentb53743a0bde0bb268ed9de951eee883e9f924c4c (diff)
downloadeclipse.platform.swt-916bed68a7f416f534701e25d01d07957e5d4d12.zip
eclipse.platform.swt-916bed68a7f416f534701e25d01d07957e5d4d12.tar.gz
eclipse.platform.swt-916bed68a7f416f534701e25d01d07957e5d4d12.tar.bz2
Omit use of gdk_drawable_get_size deprecated function in GC
Conflicts: bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c81
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java42
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java30
6 files changed, 157 insertions, 9 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 3be59b8..63031a3 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
@@ -6086,6 +6086,47 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1pixbuf_1scale_1simple)
}
#endif
+#ifndef NO__1gdk_1pixmap_1get_1size
+JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1pixmap_1get_1size)
+ (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2)
+{
+ jint *lparg1=NULL;
+ jint *lparg2=NULL;
+ OS_NATIVE_ENTER(env, that, _1gdk_1pixmap_1get_1size_FUNC);
+#ifdef JNI_VERSION_1_2
+ if (IS_JNI_1_2) {
+ if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL)) == NULL) goto fail;
+ } else
+#endif
+ {
+ if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ }
+/*
+ gdk_pixmap_get_size((GdkPixmap *)arg0, (gint *)lparg1, (gint *)lparg2);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_pixmap_get_size)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GdkPixmap *, gint *, gint *))fp)((GdkPixmap *)arg0, (gint *)lparg1, (gint *)lparg2);
+ }
+ }
+fail:
+#ifdef JNI_VERSION_1_2
+ if (IS_JNI_1_2) {
+ if (arg2 && lparg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, 0);
+ } else
+#endif
+ {
+ if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
+ }
+ OS_NATIVE_EXIT(env, that, _1gdk_1pixmap_1get_1size_FUNC);
+}
+#endif
+
#ifndef NO__1gdk_1pixmap_1new
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1pixmap_1new)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3)
@@ -6707,6 +6748,26 @@ fail:
}
#endif
+#ifndef NO__1gdk_1window_1get_1height
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1window_1get_1height)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gdk_1window_1get_1height_FUNC);
+/*
+ rc = (jintLong)gdk_window_get_height((GdkWindow *)arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_window_get_height)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkWindow *))fp)((GdkWindow *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gdk_1window_1get_1height_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1window_1get_1internal_1paint_1info
JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1window_1get_1internal_1paint_1info)
(JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1, jintArray arg2, jintArray arg3)
@@ -6811,6 +6872,26 @@ fail:
}
#endif
+#ifndef NO__1gdk_1window_1get_1width
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1window_1get_1width)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gdk_1window_1get_1width_FUNC);
+/*
+ rc = (jintLong)gdk_window_get_width((GdkWindow *)arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_window_get_width)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkWindow *))fp)((GdkWindow *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gdk_1window_1get_1width_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1window_1hide
JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1window_1hide)
(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 98f4109..c2e471a 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
@@ -191,6 +191,9 @@
#define gdk_window_create_similar_surface_LIB LIB_GDK
#define gdk_window_lookup_LIB LIB_GDK
#define gdk_window_restack_LIB LIB_GDK
+#define gdk_window_get_height_LIB LIB_GDK
+#define gdk_window_get_width_LIB LIB_GDK
+#define gdk_pixmap_get_size_LIB LIB_GDK
#define gdk_window_set_keep_above_LIB LIB_GDK
#define gdk_window_set_accept_focus_LIB LIB_GDK
#define gtk_window_set_opacity_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 3164823..d82496e 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 = 1316;
-int OS_nativeFunctionCallCount[1316];
+int OS_nativeFunctionCount = 1319;
+int OS_nativeFunctionCallCount[1319];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -500,6 +500,7 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1pixbuf_1render_1to_1drawable",
"_1gdk_1pixbuf_1save_1to_1bufferv",
"_1gdk_1pixbuf_1scale_1simple",
+ "_1gdk_1pixmap_1get_1size",
"_1gdk_1pixmap_1new",
"_1gdk_1pointer_1grab",
"_1gdk_1pointer_1ungrab",
@@ -543,12 +544,14 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1window_1get_1children",
"_1gdk_1window_1get_1events",
"_1gdk_1window_1get_1frame_1extents",
+ "_1gdk_1window_1get_1height",
"_1gdk_1window_1get_1internal_1paint_1info",
"_1gdk_1window_1get_1origin",
"_1gdk_1window_1get_1parent",
"_1gdk_1window_1get_1pointer",
"_1gdk_1window_1get_1position",
"_1gdk_1window_1get_1user_1data",
+ "_1gdk_1window_1get_1width",
"_1gdk_1window_1hide",
"_1gdk_1window_1invalidate_1rect",
"_1gdk_1window_1invalidate_1region",
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 bb05798..140db9d 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
@@ -508,6 +508,7 @@ typedef enum {
_1gdk_1pixbuf_1render_1to_1drawable_FUNC,
_1gdk_1pixbuf_1save_1to_1bufferv_FUNC,
_1gdk_1pixbuf_1scale_1simple_FUNC,
+ _1gdk_1pixmap_1get_1size_FUNC,
_1gdk_1pixmap_1new_FUNC,
_1gdk_1pointer_1grab_FUNC,
_1gdk_1pointer_1ungrab_FUNC,
@@ -551,12 +552,14 @@ typedef enum {
_1gdk_1window_1get_1children_FUNC,
_1gdk_1window_1get_1events_FUNC,
_1gdk_1window_1get_1frame_1extents_FUNC,
+ _1gdk_1window_1get_1height_FUNC,
_1gdk_1window_1get_1internal_1paint_1info_FUNC,
_1gdk_1window_1get_1origin_FUNC,
_1gdk_1window_1get_1parent_FUNC,
_1gdk_1window_1get_1pointer_FUNC,
_1gdk_1window_1get_1position_FUNC,
_1gdk_1window_1get_1user_1data_FUNC,
+ _1gdk_1window_1get_1width_FUNC,
_1gdk_1window_1hide_FUNC,
_1gdk_1window_1invalidate_1rect_FUNC,
_1gdk_1window_1invalidate_1region_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 0d2d7ad..c5c40cc 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
@@ -3479,6 +3479,32 @@ public static final void gdk_cairo_set_source_color(int /*long*/ cairo, GdkColor
lock.unlock();
}
}
+/**
+ * @param window cast=(GdkWindow *)
+ * @method flags=dynamic
+ */
+public static final native int /*long*/ _gdk_window_get_width(int /*long*/ window);
+public static final int /*long*/ gdk_window_get_width(int /*long*/ window) {
+ lock.lock();
+ try {
+ return _gdk_window_get_width(window);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @param window cast=(GdkWindow *)
+ * @method flags=dynamic
+ */
+public static final native int /*long*/ _gdk_window_get_height(int /*long*/ window);
+public static final int /*long*/ gdk_window_get_height(int /*long*/ window) {
+ lock.lock();
+ try {
+ return _gdk_window_get_height(window);
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @method flags=dynamic
* @param pixbuf cast=(const GdkPixbuf *)
@@ -3849,7 +3875,21 @@ public static final int gdk_drawable_get_depth(int /*long*/ drawable) {
lock.unlock();
}
}
-
+/**
+ * @param pixmap cast=(GdkPixmap *)
+ * @param width cast=(gint *),flags=no_in critical
+ * @param height cast=(gint *),flags=no_in critical
+ * @method flags=dynamic
+ */
+public static final native void _gdk_pixmap_get_size(int /*long*/ pixmap, int[] width, int[] height);
+public static final void gdk_pixmap_get_size(int /*long*/ pixmap, int[] width, int[] height) {
+ lock.lock();
+ try {
+ _gdk_pixmap_get_size (pixmap,width,height);
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @param drawable cast=(GdkDrawable *)
* @param x cast=(gint)
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 74b744c..dc53b1a 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
@@ -849,7 +849,11 @@ void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight,
} else {
int[] width = new int[1];
int[] height = new int[1];
- OS.gdk_drawable_get_size(srcImage.pixmap, width, height);
+ if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) {
+ OS.gdk_pixmap_get_size(srcImage.pixmap, width, height);
+ } else {
+ OS.gdk_drawable_get_size(srcImage.pixmap, width, height);
+ }
imgWidth = width[0];
imgHeight = height[0];
}
@@ -2744,8 +2748,14 @@ void getSize(int[] width, int[] height) {
return;
}
if (data.drawable != 0) {
- OS.gdk_drawable_get_size(data.drawable, width, height);
- return;
+ if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) {
+ width[0] = OS.gdk_window_get_width(data.drawable);
+ height[0] = OS.gdk_window_get_height(data.drawable);
+ return;
+ } else {
+ OS.gdk_drawable_get_size(data.drawable, width, height);
+ return;
+ }
}
if (OS.USE_CAIRO) {
int /*long*/ surface = Cairo.cairo_get_target(handle);
@@ -2942,9 +2952,17 @@ void initCairo() {
translateY = -y[0];
}
}
- int[] w = new int[1], h = new int[1];
- OS.gdk_drawable_get_size(drawable, w, h);
- int width = w[0], height = h[0];
+ int width = 0;
+ int height = 0;
+ if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) {
+ width = OS.gdk_window_get_width(data.drawable);
+ height = OS.gdk_window_get_height(data.drawable);
+ } else {
+ int[] w = new int[1], h = new int[1];
+ OS.gdk_drawable_get_size(drawable, w, h);
+ width = w[0];
+ height = h[0];
+ }
int /*long*/ surface = Cairo.cairo_xlib_surface_create(xDisplay, xDrawable, xVisual, width, height);
if (surface == 0) SWT.error(SWT.ERROR_NO_HANDLES);
Cairo.cairo_surface_set_device_offset(surface, translateX, translateY);