Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 2a6705f543..918543f907 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 */

Back to the top