diff options
author | Arun Thondapu | 2013-10-25 19:21:37 +0000 |
---|---|---|
committer | Bogdan Gheorghe | 2013-10-25 19:22:18 +0000 |
commit | 2d8f8190f028427bab88fdbd0fa258fbb0893019 (patch) | |
tree | 2fe93c103a608d2fa1889b73cb30165681ba502b | |
parent | bccc68c5828d2c053f6e7cbaa816077c400ed3cc (diff) | |
download | eclipse.platform.swt-2d8f81.tar.gz eclipse.platform.swt-2d8f81.tar.xz eclipse.platform.swt-2d8f81.zip |
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.java | 32 |
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 */ |