summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov <akurtako@redhat.com>2012-10-09 11:36:20 +0300
committerAlexander Kurtakov <akurtako@redhat.com>2012-10-09 11:36:20 +0300
commit8cb9404e2de2a7532f9571bd8294bf5cd1d59247 (patch)
treef127ab4681090c15ac588254af50f09d9a8d9da8
parent772eba60342f660557d66c688c0f5931749c4e89 (diff)
downloadeclipse.platform.swt-8cb9404e2de2a7532f9571bd8294bf5cd1d59247.tar.gz
eclipse.platform.swt-8cb9404e2de2a7532f9571bd8294bf5cd1d59247.tar.xz
eclipse.platform.swt-8cb9404e2de2a7532f9571bd8294bf5cd1d59247.zip
Fix for bug#391398.
Use gdk_visual_ functions instead of accessing struct members.
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java10
6 files changed, 43 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index e024baa68a..c6abfa662a 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
@@ -6751,6 +6751,26 @@ fail:
}
#endif
+#ifndef NO__1gdk_1visual_1get_1depth
+JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1visual_1get_1depth)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gdk_1visual_1get_1depth_FUNC);
+/*
+ rc = (jint)gdk_visual_get_depth((GdkVisual *)arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_visual_get_depth)
+ if (fp) {
+ rc = (jint)((jint (CALLING_CONVENTION*)(GdkVisual *))fp)((GdkVisual *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gdk_1visual_1get_1depth_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1visual_1get_1system
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1visual_1get_1system)
(JNIEnv *env, jclass that)
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 2ddaaa9dc1..53abd9c7be 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
@@ -213,6 +213,7 @@
#define gdk_screen_get_n_monitors_LIB LIB_GDK
#define gdk_screen_get_number_LIB LIB_GDK
#define gdk_pixbuf_render_to_drawable_LIB LIB_GDK
+#define gdk_visual_get_depth_LIB LIB_GDK
#define gtk_scrolled_window_get_hscrollbar_LIB LIB_GTK
#define gtk_scrolled_window_get_vscrollbar_LIB LIB_GTK
#define gtk_scale_new_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 ffdf7bc6b3..5ce3d6f20c 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
@@ -532,6 +532,7 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1unicode_1to_1keyval",
"_1gdk_1utf8_1to_1compound_1text",
"_1gdk_1utf8_1to_1string_1target",
+ "_1gdk_1visual_1get_1depth",
"_1gdk_1visual_1get_1system",
"_1gdk_1window_1add_1filter",
"_1gdk_1window_1at_1pointer",
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 1074782028..742fb58ce0 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
@@ -542,6 +542,7 @@ typedef enum {
_1gdk_1unicode_1to_1keyval_FUNC,
_1gdk_1utf8_1to_1compound_1text_FUNC,
_1gdk_1utf8_1to_1string_1target_FUNC,
+ _1gdk_1visual_1get_1depth_FUNC,
_1gdk_1visual_1get_1system_FUNC,
_1gdk_1window_1add_1filter_FUNC,
_1gdk_1window_1at_1pointer_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 f372dd1b73..475ebbe335 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
@@ -5110,6 +5110,19 @@ public static final int gdk_unicode_to_keyval(int wc) {
lock.unlock();
}
}
+/**
+ * @method flags=dynamic
+ * @param visual cast=(GdkVisual *)
+ */
+public static final native int _gdk_visual_get_depth(long /*int*/ visual);
+public static final int gdk_visual_get_depth(long /*int*/ visual) {
+ lock.lock();
+ try {
+ return _gdk_visual_get_depth(visual);
+ } finally {
+ lock.unlock();
+ }
+}
public static final native long /*int*/ _gdk_visual_get_system();
public static final long /*int*/ gdk_visual_get_system() {
lock.lock();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index 35470a7f41..dbd205081e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -1770,9 +1770,13 @@ public boolean getHighContrast () {
public int getDepth () {
checkDevice ();
- GdkVisual visual = new GdkVisual ();
- OS.memmove (visual, OS.gdk_visual_get_system());
- return visual.depth;
+ if (OS.GTK_VERSION >= OS.VERSION(2, 22, 0)) {
+ return OS.gdk_visual_get_depth(OS.gdk_visual_get_system());
+ } else {
+ GdkVisual visual = new GdkVisual ();
+ OS.memmove (visual, OS.gdk_visual_get_system());
+ return visual.depth;
+ }
}
/**