backport xulrunner 1.9 support to 3.4 maintenance stream (post-3.4.2 release)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java
index 4c639d5..9eb0169 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,15 @@
package org.eclipse.swt.browser;
import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.internal.win32.OS;
+import org.eclipse.swt.internal.Callback;
+import org.eclipse.swt.internal.mozilla.*;
+import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.widgets.*;
class MozillaDelegate {
Browser browser;
+ static int /*long*/ MozillaProc;
+ static Callback SubclassProc;
MozillaDelegate (Browser browser) {
super ();
@@ -54,10 +58,38 @@
return bytes;
}
+static int /*long*/ windowProc (int /*long*/ hwnd, int /*long*/ msg, int /*long*/ wParam, int /*long*/ lParam) {
+ switch ((int)/*64*/msg) {
+ case OS.WM_ERASEBKGND:
+ RECT rect = new RECT ();
+ OS.GetClientRect (hwnd, rect);
+ OS.FillRect (wParam, rect, OS.GetSysColorBrush (OS.COLOR_WINDOW));
+ break;
+ }
+ return OS.CallWindowProc (MozillaProc, hwnd, (int)/*64*/msg, wParam, lParam);
+}
+
+void addWindowSubclass () {
+ int /*long*/ hwndChild = OS.GetWindow (browser.handle, OS.GW_CHILD);
+ if (SubclassProc == null) {
+ SubclassProc = new Callback (MozillaDelegate.class, "windowProc", 4); //$NON-NLS-1$
+ MozillaProc = OS.GetWindowLongPtr (hwndChild, OS.GWL_WNDPROC);
+ }
+ OS.SetWindowLongPtr (hwndChild, OS.GWL_WNDPROC, SubclassProc.getAddress ());
+}
+
+int createBaseWindow (nsIBaseWindow baseWindow) {
+ return baseWindow.Create ();
+}
+
int /*long*/ getHandle () {
return browser.handle;
}
+String getJSLibraryName () {
+ return "js3250.dll"; //$NON-NLS-1$
+}
+
String getLibraryName () {
return "xpcom.dll"; //$NON-NLS-1$
}
@@ -84,10 +116,16 @@
}
void onDispose (int /*long*/ embedHandle) {
+ removeWindowSubclass ();
browser = null;
}
+void removeWindowSubclass () {
+ if (SubclassProc == null) return;
+ int /*long*/ hwndChild = OS.GetWindow (browser.handle, OS.GW_CHILD);
+ OS.SetWindowLongPtr (hwndChild, OS.GWL_WNDPROC, MozillaProc);
+}
+
void setSize (int /*long*/ embedHandle, int width, int height) {
}
-
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/Platform.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/Platform.java
index 594c2ef..d7d2f14 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/Platform.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/Platform.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,5 +13,5 @@
public class Platform {
public static final String PLATFORM = "win32"; //$NON-NLS-1$
-
+public static final Lock lock = new Lock ();
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h b/bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h
index 5404f57..e6667f9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -61,6 +61,38 @@
#endif
+#ifdef __APPLE__
+#define CALLING_CONVENTION
+#define LOAD_FUNCTION(var, name) \
+ static int initialized = 0; \
+ static void *var = NULL; \
+ if (!initialized) { \
+ CFBundleRef bundle = CFBundleGetBundleWithIdentifier(CFSTR(name##_LIB)); \
+ if (bundle) var = CFBundleGetFunctionPointerForName(bundle, CFSTR(#name)); \
+ initialized = 1; \
+ }
+#elif defined (_WIN32) || defined (_WIN32_WCE)
+#define CALLING_CONVENTION CALLBACK
+#define LOAD_FUNCTION(var, name) \
+ static int initialized = 0; \
+ static FARPROC var = NULL; \
+ if (!initialized) { \
+ HMODULE hm = LoadLibrary(name##_LIB); \
+ if (hm) var = GetProcAddress(hm, #name); \
+ initialized = 1; \
+ }
+#else
+#define CALLING_CONVENTION
+#define LOAD_FUNCTION(var, name) \
+ static int initialized = 0; \
+ static void *var = NULL; \
+ if (!initialized) { \
+ void* handle = dlopen(name##_LIB, RTLD_LAZY); \
+ if (handle) var = dlsym(handle, #name); \
+ initialized = 1; \
+ }
+#endif
+
void throwOutOfMemory(JNIEnv *env);
#define CHECK_NULL_VOID(ptr) \