Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2013-12-04 19:00:25 +0000
committerMarc-Andre Laperle2013-12-04 19:39:29 +0000
commit8f78fe793dfed9d45b51d1d632a27e3f120fa179 (patch)
tree8c6ccec8196b010ebd6e35c55da8f0da3cdebf75
parent8326467f76d4f90692e887132456e7b60373436c (diff)
downloadeclipse.platform.swt-8f78fe793dfed9d45b51d1d632a27e3f120fa179.tar.gz
eclipse.platform.swt-8f78fe793dfed9d45b51d1d632a27e3f120fa179.tar.xz
eclipse.platform.swt-8f78fe793dfed9d45b51d1d632a27e3f120fa179.zip
Bug 423220 - [GTK3] SWT_GTK3 variable has inconsistent effect between 4.3 and 4.4M20140116-0200
Check the value of the environment variable, like in the 4.4 branch but keep GTK2 as the default. Change-Id: I7bfb7f844cd4cfcd1b89fa12f5c0f44803fb7e3e Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h8
2 files changed, 26 insertions, 10 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 7e282a9250..ab17b711c3 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,19 +15,33 @@
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) {
+ 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 (gtk3 != null && gtk3.equals("1")) {
try {
Library.loadLibrary("swt-pi3");
- loaded = true;
- } catch (Throwable e) {}
+ } catch (Throwable e) {
+ Library.loadLibrary("swt-pi");
+ }
}
- if (!loaded) {
+ else {
Library.loadLibrary("swt-pi");
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h
index 894340c368..34e5f1ab26 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h
@@ -25,10 +25,12 @@
static int initialized = 0; \
static void *var = NULL; \
if (!initialized) { \
- void* handle ; \
- if (getenv("SWT_GTK3")) { \
+ void* handle = 0; \
+ char *gtk3 = getenv("SWT_GTK3"); \
+ if (gtk3 != NULL && strcmp(gtk3, "1") == 0) { \
handle = dlopen("libwebkitgtk-3.0.so.0", LOAD_FLAGS); /* webkitgtk >= 3.x lib */ \
- } else { \
+ } \
+ if (!handle) { \
handle = dlopen("libwebkit-1.0.so.2", LOAD_FLAGS); /* webkitgtk 1.2.x lib */ \
if (!handle) { \
handle = dlopen("libwebkitgtk-1.0.so.0", LOAD_FLAGS); /* webkitgtk >= 1.4.x lib */ \

Back to the top