aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Thondapu2013-10-25 15:21:37 (EDT)
committerBogdan Gheorghe2013-10-25 15:22:18 (EDT)
commit2d8f8190f028427bab88fdbd0fa258fbb0893019 (patch)
tree2fe93c103a608d2fa1889b73cb30165681ba502b
parentbccc68c5828d2c053f6e7cbaa816077c400ed3cc (diff)
downloadeclipse.platform.swt-2d8f8190f028427bab88fdbd0fa258fbb0893019.zip
eclipse.platform.swt-2d8f8190f028427bab88fdbd0fa258fbb0893019.tar.gz
eclipse.platform.swt-2d8f8190f028427bab88fdbd0fa258fbb0893019.tar.bz2
Bug 420182 - [GTK3] Use GTK 3.x (when available) by default on Linux/Unix instead of GTK 2.xv4410dv4410c
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java32
1 files changed, 23 insertions, 9 deletions
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 2a6705f..918543f 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
@@ -15,21 +15,35 @@
package org.eclipse.swt.internal.gtk;
-import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.C;
+import org.eclipse.swt.internal.Library;
public class OS extends C {
static {
- boolean loaded = false;
- String prop = "SWT_GTK3";
- if (System.getProperty(prop) != null || OS.getenv(ascii(prop)) != 0) {
- try {
- Library.loadLibrary("swt-pi3");
- loaded = true;
- } catch (Throwable e) {}
+ String gtk3 = System.getProperty("SWT_GTK3");
+ if (gtk3 == null) {
+ long /*int*/ ptr = OS.getenv(ascii("SWT_GTK3"));
+ if (ptr != 0) {
+ int length = OS.strlen(ptr);
+ byte[] buffer = new byte[length];
+ OS.memmove(buffer, ptr, length);
+ char[] convertedChar = new char[buffer.length];
+ for (int i = 0; i < buffer.length; i++) {
+ convertedChar[i]=(char)buffer[i];
+ }
+ gtk3 = new String(convertedChar);
+ }
}
- if (!loaded) {
+ if (gtk3 != null && gtk3.equals("0")) {
Library.loadLibrary("swt-pi");
}
+ else {
+ try {
+ Library.loadLibrary("swt-pi3");
+ } catch (Throwable e) {
+ Library.loadLibrary("swt-pi");
+ }
+ }
}
/** OS Constants */