summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-06-28 15:11:45 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-06-28 15:11:45 -0400
commit404d7584bf23411fc0782011ff293819d49ee74e (patch)
treecfb9f1953055df83bd79952ed2a3bec7339df415
parent6f7e9db4a5109de2cb967f8161a35ca18fee8f28 (diff)
downloadeclipse.platform.swt-gdk_get_size.tar.gz
eclipse.platform.swt-gdk_get_size.tar.xz
eclipse.platform.swt-gdk_get_size.zip
Omit use of gdk_drawable_get_size deprecated function in GCgdk_get_size
-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_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
5 files changed, 154 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 1c8c5a54fb..e8faaef706 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
@@ -6360,6 +6360,47 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1pixmap_1foreign_1new)
}
#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)
@@ -7013,6 +7054,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)
@@ -7117,6 +7178,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_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index f444a423e7..fea4b3f131 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 = 1402;
-int OS_nativeFunctionCallCount[1402];
+int OS_nativeFunctionCount = 1405;
+int OS_nativeFunctionCallCount[1405];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -519,6 +519,7 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1pixbuf_1scale",
"_1gdk_1pixbuf_1scale_1simple",
"_1gdk_1pixmap_1foreign_1new",
+ "_1gdk_1pixmap_1get_1size",
"_1gdk_1pixmap_1new",
"_1gdk_1pointer_1grab",
"_1gdk_1pointer_1is_1grabbed",
@@ -565,12 +566,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 f7321e2d6a..4729e23eef 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
@@ -527,6 +527,7 @@ typedef enum {
_1gdk_1pixbuf_1scale_FUNC,
_1gdk_1pixbuf_1scale_1simple_FUNC,
_1gdk_1pixmap_1foreign_1new_FUNC,
+ _1gdk_1pixmap_1get_1size_FUNC,
_1gdk_1pixmap_1new_FUNC,
_1gdk_1pointer_1grab_FUNC,
_1gdk_1pointer_1is_1grabbed_FUNC,
@@ -573,12 +574,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 8827bda6b3..34d0342e8d 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
@@ -3695,6 +3695,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 window cast=(GdkWindow *)
@@ -4074,7 +4100,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 94c88d6974..44401541a8 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);