diff options
10 files changed, 2422 insertions, 20 deletions
diff --git a/bundles/org.eclipse.swt/.classpath_motif b/bundles/org.eclipse.swt/.classpath_motif index f0e012af37..ba88793b87 100755 --- a/bundles/org.eclipse.swt/.classpath_motif +++ b/bundles/org.eclipse.swt/.classpath_motif @@ -9,6 +9,7 @@ <classpathentry kind="src" path="Eclipse SWT/common"/> <classpathentry kind="src" path="Eclipse SWT/common_j2se"/> <classpathentry kind="src" path="Eclipse SWT PI/motif"/> + <classpathentry kind="src" path="Eclipse SWT PI/motif_gtk"/> <classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/> <classpathentry kind="src" path="Eclipse SWT Accessibility/emulated"/> <classpathentry kind="src" path="Eclipse SWT Accessibility/common"/> @@ -23,5 +24,7 @@ <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/> <classpathentry kind="src" path="Eclipse SWT Browser/common"/> <classpathentry kind="src" path="Eclipse SWT Browser/motif"/> + <classpathentry kind="src" path="Eclipse SWT Mozilla/gtk"/> + <classpathentry kind="src" path="Eclipse SWT Mozilla/common"/> <classpathentry kind="output" path="bin"/> -</classpath> +</classpath>
\ No newline at end of file diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/AppFileLocProvider.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/AppFileLocProvider.java new file mode 100644 index 0000000000..befdc4ff7c --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/AppFileLocProvider.java @@ -0,0 +1,219 @@ +/******************************************************************************* + * Copyright (c) 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.browser; + +import org.eclipse.swt.*; +import org.eclipse.swt.internal.mozilla.*; + +class AppFileLocProvider { + + static final String NS_GRE_DIR = "GreD"; //$NON-NLS-1$ + static final String NS_GRE_COMPONENT_DIR = "GreComsD"; //$NON-NLS-1$ + static final String NS_APP_DEFAULTS_50_DIR = "DefRt"; //$NON-NLS-1$ + static final String NS_APP_PREF_DEFAULTS_50_DIR = "PrfDef"; //$NON-NLS-1$ + static final String NS_APP_PROFILE_DEFAULTS_50_DIR = "profDef"; //$NON-NLS-1$ + static final String NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR = "ProfDefNoLoc"; //$NON-NLS-1$ + static final String NS_APP_USER_PROFILES_ROOT_DIR = "DefProfRt"; //$NON-NLS-1$ + static final String NS_APP_RES_DIR = "ARes"; //$NON-NLS-1$ + static final String NS_APP_CHROME_DIR = "AChrom"; //$NON-NLS-1$ + static final String NS_APP_PLUGINS_DIR = "APlugns"; //$NON-NLS-1$ + static final String NS_APP_SEARCH_DIR = "SrchPlugns"; //$NON-NLS-1$ + static final String NS_APP_PLUGINS_DIR_LIST = "APluginsDL"; //$NON-NLS-1$ + static final String DEFAULTS_DIR_NAME = "defaults"; //$NON-NLS-1$ + static final String DEFAULTS_PREF_DIR_NAME = "pref"; //$NON-NLS-1$ + static final String DEFAULTS_PROFILE_DIR_NAME = "profile"; //$NON-NLS-1$ + static final String RES_DIR_NAME = "res"; //$NON-NLS-1$ + static final String CHROME_DIR_NAME ="chrome"; //$NON-NLS-1$ + static final String PLUGINS_DIR_NAME = "plugins"; //$NON-NLS-1$ + static final String SEARCH_DIR_NAME = "searchplugins"; //$NON-NLS-1$ + static final String COMPONENTS_DIR_NAME = "components"; //$NON-NLS-1$ + static final String NS_XPCOM_INIT_CURRENT_PROCESS_DIR = "MozBinD"; //$NON-NLS-1$ + static final String NS_XPCOM_CURRENT_PROCESS_DIR = "XCurProcD"; //$NON-NLS-1$ + static final String NS_XPCOM_COMPONENT_DIR = "ComsD"; //$NON-NLS-1$ + static final String NS_OS_CURRENT_PROCESS_DIR = "CurProcD"; //$NON-NLS-1$ + + XPCOMObject supports; + XPCOMObject directoryServiceProvider; + XPCOMObject directoryServiceProvider2; + int refCount = 0; + String mozillaPath; + String grePath; + +public AppFileLocProvider() { + mozillaPath = GRE.mozillaPath; + grePath = GRE.grePath; + if (mozillaPath == null) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_FAILURE)); + createCOMInterfaces(); +} + +int AddRef() { + refCount++; + return refCount; +} + +void createCOMInterfaces() { + /* Create each of the interfaces that this object implements */ + supports = new XPCOMObject(new int[]{2, 0, 0}){ + public int method0(int[] args) {return queryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + }; + + directoryServiceProvider = new XPCOMObject(new int[]{2, 0, 0, 3}){ + public int method0(int[] args) {return queryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + public int method3(int[] args) {return getFile(args[0], args[1], args[2]);} + }; + + directoryServiceProvider2 = new XPCOMObject(new int[]{2, 0, 0, 3, 2}){ + public int method0(int[] args) {return queryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + public int method3(int[] args) {return getFile(args[0], args[1], args[2]);} + public int method4(int[] args) {return getFiles(args[0], args[1]);} + }; +} + +void disposeCOMInterfaces() { + if (supports != null) { + supports.dispose(); + supports = null; + } + if (directoryServiceProvider != null) { + directoryServiceProvider.dispose(); + directoryServiceProvider = null; + } + if (directoryServiceProvider2 != null) { + directoryServiceProvider2.dispose(); + directoryServiceProvider2 = null; + } +} + +int getAddress() { + return directoryServiceProvider.getAddress(); +} + +int queryInterface(int riid, int ppvObject) { + if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; + nsID guid = new nsID(); + XPCOM.memmove(guid, riid, nsID.sizeof); + + if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) { + XPCOM.memmove(ppvObject, new int[] {supports.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + if (guid.Equals(nsIDirectoryServiceProvider.NS_IDIRECTORYSERVICEPROVIDER_IID)) { + XPCOM.memmove(ppvObject, new int[] {directoryServiceProvider.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + if (guid.Equals(nsIDirectoryServiceProvider2.NS_IDIRECTORYSERVICEPROVIDER2_IID)) { + XPCOM.memmove(ppvObject, new int[] {directoryServiceProvider2.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + + XPCOM.memmove(ppvObject, new int[] {0}, 4); + return XPCOM.NS_ERROR_NO_INTERFACE; +} + +int Release() { + refCount--; + if (refCount == 0) disposeCOMInterfaces(); + return refCount; +} + +/* nsIDirectoryServiceProvider2 implementation */ + +int getFiles(int str, int nsISimpleEnumerator) { + int rc = XPCOM.NS_ERROR_FAILURE; + int length = XPCOM.strlen(str); + byte[] dest = new byte[length]; + XPCOM.memmove(dest, str, length); + String prop = new String(dest); + XPCOM.memmove(nsISimpleEnumerator, new int[] {0}, 4); + nsILocalFile localFile = null; + if (NS_APP_PLUGINS_DIR_LIST.equals(prop)) { + if (mozillaPath == null) return XPCOM.NS_ERROR_FAILURE; + if (mozillaPath.length() <= 0) return XPCOM.NS_ERROR_FAILURE; + String path = new String(mozillaPath); + int[] retVal = new int[1]; + rc = XPCOM.NS_NewLocalFile(path, true, retVal); + if (rc == XPCOM.NS_OK && retVal[0] == 0) rc = XPCOM.NS_ERROR_NULL_POINTER; + if (rc == XPCOM.NS_OK) localFile = new nsILocalFile(retVal[0]); + nsString node = new nsString(PLUGINS_DIR_NAME); + rc = localFile.Append(node.getAddress()); + node.dispose(); + } + if (rc == XPCOM.NS_OK) { + int[] retVal = new int[1]; + rc = XPCOM.NS_NewSingletonEnumerator(localFile.getAddress(), retVal); + if (rc == XPCOM.NS_OK && retVal[0] == 0) rc = XPCOM.NS_ERROR_NULL_POINTER; + if (rc == XPCOM.NS_OK) XPCOM.memmove(nsISimpleEnumerator, retVal, 4); + } + if (localFile != null) localFile.Release(); + return rc; +} + +/* nsIDirectoryServiceProvider implementation */ + +int getFile(int str, int persistent, int nsFile) { + int rc = XPCOM.NS_ERROR_FAILURE; + int length = XPCOM.strlen(str); + byte[] dest = new byte[length]; + XPCOM.memmove(dest, str, length); + String prop = new String(dest); + XPCOM.memmove(persistent, new int[] {1}, 4); + XPCOM.memmove(nsFile, new int[] {0}, 4); + nsILocalFile localFile = null; + if (NS_GRE_DIR.equals(prop) || NS_GRE_COMPONENT_DIR.equals(prop)) { + if (grePath == null || grePath.length() == 0) return XPCOM.NS_ERROR_FAILURE; + int[] retVal = new int[1]; + rc = XPCOM.NS_NewLocalFile(grePath,true,retVal); + if (rc == XPCOM.NS_OK && retVal[0] == 0) rc = XPCOM.NS_ERROR_NULL_POINTER; + if (rc == XPCOM.NS_OK) { + localFile = new nsILocalFile(retVal[0]); + if (NS_GRE_COMPONENT_DIR.equals(prop)) { + nsString node = new nsString(COMPONENTS_DIR_NAME); + rc = localFile.Append(node.getAddress()); + node.dispose(); + } + } + } + else if (NS_XPCOM_INIT_CURRENT_PROCESS_DIR.equals(prop) || + NS_OS_CURRENT_PROCESS_DIR.equals(prop) || + NS_XPCOM_COMPONENT_DIR.equals(prop)) { + if (mozillaPath == null || mozillaPath.length() == 0) return XPCOM.NS_ERROR_FAILURE; + int[] retVal = new int[1]; + rc = XPCOM.NS_NewLocalFile(mozillaPath,true,retVal); + if (rc == XPCOM.NS_OK && retVal[0] == 0) rc = XPCOM.NS_ERROR_NULL_POINTER; + if (rc == XPCOM.NS_OK) { + localFile = new nsILocalFile(retVal[0]); + if (NS_XPCOM_COMPONENT_DIR.equals(prop)) { + nsString node = new nsString(COMPONENTS_DIR_NAME); + rc = localFile.Append(node.getAddress()); + node.dispose(); + } + } + } + if (localFile != null && XPCOM.NS_OK == rc) { + int[] result = new int[1]; + int rc1 = localFile.QueryInterface(nsIFile.NS_IFILE_IID, result); + if (rc1 != XPCOM.NS_OK || result[0] == 0) rc1 = XPCOM.NS_NOINTERFACE; + else XPCOM.memmove(nsFile, result, 4); + } + if (localFile != null) localFile.Release(); + + return rc; +} +}
\ No newline at end of file diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Browser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Browser.java index dc980d5310..44bd9fbd9c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Browser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Browser.java @@ -12,37 +12,280 @@ package org.eclipse.swt.browser; import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.gtk.*; +import org.eclipse.swt.internal.mozilla.*; public class Browser extends Composite { + nsIWebBrowser webBrowser; + int gtkHandle; + /* Interfaces for this Mozilla embedding notification */ + XPCOMObject supports; + XPCOMObject weakReference; + XPCOMObject webProgressListener; + XPCOMObject webBrowserChrome; + XPCOMObject webBrowserChromeFocus; + XPCOMObject embeddingSiteWindow; + XPCOMObject interfaceRequestor; + XPCOMObject supportsWeakReference; + XPCOMObject contextMenuListener; + XPCOMObject uriContentListener; + int chromeFlags = nsIWebBrowserChrome.CHROME_DEFAULT; + int refCount = 0; + + /* External Listener management */ + LocationListener[] locationListeners = new LocationListener[0]; + ProgressListener[] progressListeners = new ProgressListener[0]; + StatusTextListener[] statusTextListeners = new StatusTextListener[0]; + + static nsIAppShell appShell; + static AppFileLocProvider locProvider; + static int browserCount; + static boolean isLinux; + + static final byte[] size_allocate = signal("size_allocate"); //$NON-NLS-1$ + /* Package Name */ static final String PACKAGE_PREFIX = "org.eclipse.swt.browser."; //$NON-NLS-1$ +static { + String osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$ + isLinux = osName.startsWith("linux"); + + if (isLinux) { + Library.loadLibrary("swt-gtk"); //$NON-NLS-1$ + Library.loadLibrary ("swt-mozilla"); //$NON-NLS-1$ + } +} + public Browser(Composite parent, int style) { - super(parent, style); + super(parent, style | SWT.EMBEDDED); + if (!isLinux) return; + browserCount++; + GTK.gtk_init_check(new int[1], null); + if (browserCount == 1) { + final Display display = getDisplay(); + display.asyncExec(new Runnable() { + public void run() { + while (GTK.gtk_events_pending() != 0) { + GTK.gtk_main_iteration(); + } + if (browserCount == 0) return; + display.timerExec(25, this); + } + }); + } + gtkHandle = GTK.gtk_plug_new(embeddedHandle); + + int[] result = new int[1]; + if (browserCount == 1) { + String mozillaPath = GRE.mozillaPath; + if (mozillaPath == null) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_FAILURE)); + + locProvider = new AppFileLocProvider(); + locProvider.AddRef(); + + int[] retVal = new int[1]; + int rc = XPCOM.NS_NewLocalFile(mozillaPath, true, retVal); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (retVal[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NULL_POINTER)); + + nsILocalFile localFile = new nsILocalFile(retVal[0]); + rc = XPCOM.NS_InitEmbedding(localFile.getAddress(), locProvider.getAddress()); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + localFile.Release(); + + rc = XPCOM.NS_GetComponentManager(result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_NOINTERFACE)); + + nsIComponentManager componentManager = new nsIComponentManager(result[0]); + result[0] = 0; + rc = componentManager.CreateInstance(XPCOM.NS_APPSHELL_CID, 0, nsIAppShell.NS_IAPPSHELL_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_NOINTERFACE)); + componentManager.Release(); + + appShell = new nsIAppShell(result[0]); + rc = appShell.Create(null, null); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + rc = appShell.Spinup(); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + } + int rc = XPCOM.NS_GetComponentManager(result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_NOINTERFACE)); + + nsIComponentManager componentManager = new nsIComponentManager(result[0]); + result[0] = 0; + nsID NS_IWEBBROWSER_CID = new nsID("F1EAC761-87E9-11d3-AF80-00A024FFC08C"); //$NON-NLS-1$ + rc = componentManager.CreateInstance(NS_IWEBBROWSER_CID, 0, nsIWebBrowser.NS_IWEBBROWSER_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_NOINTERFACE)); + componentManager.Release(); + + webBrowser = new nsIWebBrowser(result[0]); + + createCOMInterfaces(); + AddRef(); + + rc = webBrowser.SetContainerWindow(webBrowserChrome.getAddress()); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + + rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + + final nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]); + rc = baseWindow.InitWindow(gtkHandle, 0, 0, 0, 2, 2); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_FAILURE)); + rc = baseWindow.Create(); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_FAILURE)); + rc = baseWindow.SetVisibility(true); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_FAILURE)); + baseWindow.Release(); + + rc = webBrowser.AddWebBrowserListener(weakReference.getAddress(), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + + rc = webBrowser.SetParentURIContentListener(uriContentListener.getAddress()); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + + Listener listener = new Listener() { + public void handleEvent(Event event) { + switch (event.type) { + case SWT.Dispose: onDispose(); break; + case SWT.Resize: onResize(); break; + case SWT.FocusIn: onFocusGained(event); break; + case SWT.FocusOut: onFocusLost(event); break; + } + } + }; + int[] folderEvents = new int[]{ + SWT.Dispose, + SWT.Resize, + SWT.FocusIn, + SWT.FocusOut, + }; + for (int i = 0; i < folderEvents.length; i++) { + addListener(folderEvents[i], listener); + } + + GTK.gtk_widget_show(gtkHandle); +} + +static byte [] signal(String name) { + int length = name.length(); + char[] chars = new char[length]; + name.getChars(0, length, chars, 0); + byte[] buffer = new byte[length + 1]; + for (int i=0; i<length; i++) { + buffer [i] = (byte)chars[i]; + } + return buffer; } +/** + * Adds the listener to receive events. + * <p> + * + * @param listener the listener + * + * @exception SWTError <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * <li>ERROR_NULL_ARGUMENT when listener is null</li> + * </ul> + * + * @since 3.0 + */ public void addLocationListener(LocationListener listener) { checkWidget(); - if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + LocationListener[] newLocationListeners = new LocationListener[locationListeners.length + 1]; + System.arraycopy(locationListeners, 0, newLocationListeners, 0, locationListeners.length); + locationListeners = newLocationListeners; + locationListeners[locationListeners.length - 1] = listener; } +/** + * Adds the listener to receive events. + * <p> + * + * @param listener the listener + * + * @exception SWTError <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * <li>ERROR_NULL_ARGUMENT when listener is null</li> + * </ul> + * + * @since 3.0 + */ public void addProgressListener(ProgressListener listener) { checkWidget(); - if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + ProgressListener[] newProgressListeners = new ProgressListener[progressListeners.length + 1]; + System.arraycopy(progressListeners, 0, newProgressListeners, 0, progressListeners.length); + progressListeners = newProgressListeners; + progressListeners[progressListeners.length - 1] = listener; } +/** + * Adds the listener to receive events. + * <p> + * + * @param listener the listener + * + * @exception SWTError <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * <li>ERROR_NULL_ARGUMENT when listener is null</li> + * </ul> + * + * @since 3.0 + */ public void addStatusTextListener(StatusTextListener listener) { checkWidget(); - if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + StatusTextListener[] newStatusTextListeners = new StatusTextListener[statusTextListeners.length + 1]; + System.arraycopy(statusTextListeners, 0, newStatusTextListeners, 0, statusTextListeners.length); + statusTextListeners = newStatusTextListeners; + statusTextListeners[statusTextListeners.length - 1] = listener; } +/** + * Navigate to the previous session history item. + * + * @return <code>true</code> if the operation was successful and <code>false</code> otherwise + * + * @exception SWTError <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @see #forward + * + * @since 3.0 + */ public boolean back() { checkWidget(); - return false; + if (!isLinux) return false; + int[] result = new int[1]; + int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + + nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]); + webNavigation.GoBack(); + rc = webNavigation.GoBack(); + webNavigation.Release(); + return rc == XPCOM.NS_OK; } -protected void checkSubclass () { +protected void checkSubclass() { String name = getClass().getName(); int index = name.lastIndexOf('.'); if (!name.substring(0, index + 1).equals(PACKAGE_PREFIX)) { @@ -50,41 +293,811 @@ protected void checkSubclass () { } } +void createCOMInterfaces() { + // Create each of the interfaces that this object implements + supports = new XPCOMObject(new int[]{2, 0, 0}){ + public int method0(int[] args) {return QueryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + }; + + weakReference = new XPCOMObject(new int[]{2, 0, 0, 2}){ + public int method0(int[] args) {return QueryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + public int method3(int[] args) {return QueryReferent(args[0], args[1]);} + }; + + webProgressListener = new XPCOMObject(new int[]{2, 0, 0, 4, 6, 3, 4, 3}){ + public int method0(int[] args) {return QueryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + public int method3(int[] args) {return OnStateChange(args[0], args[1], args[2],args[3]);} + public int method4(int[] args) {return OnProgressChange(args[0], args[1], args[2],args[3],args[4],args[5]);} + public int method5(int[] args) {return OnLocationChange(args[0], args[1], args[2]);} + public int method6(int[] args) {return OnStatusChange(args[0], args[1], args[2],args[3]);} + public int method7(int[] args) {return OnSecurityChange(args[0], args[1], args[2]);} + }; + + webBrowserChrome = new XPCOMObject(new int[]{2, 0, 0, 2, 1, 1, 1, 1, 0, 2, 0, 1, 1}){ + public int method0(int[] args) {return QueryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + public int method3(int[] args) {return SetStatus(args[0], args[1]);} + public int method4(int[] args) {return GetWebBrowser(args[0]);} + public int method5(int[] args) {return SetWebBrowser(args[0]);} + public int method6(int[] args) {return GetChromeFlags(args[0]);} + public int method7(int[] args) {return SetChromeFlags(args[0]);} + public int method8(int[] args) {return DestroyBrowserWindow();} + public int method9(int[] args) {return SizeBrowserTo(args[0], args[1]);} + public int method10(int[] args) {return ShowAsModal();} + public int method11(int[] args) {return IsWindowModal(args[0]);} + public int method12(int[] args) {return ExitModalEventLoop(args[0]);} + }; + + webBrowserChromeFocus = new XPCOMObject(new int[]{2, 0, 0, 0, 0}){ + public int method0(int[] args) {return QueryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + public int method3(int[] args) {return FocusNextElement();} + public int method4(int[] args) {return FocusPrevElement();} + }; + + embeddingSiteWindow = new XPCOMObject(new int[]{2, 0, 0, 5, 5, 0, 1, 1, 1, 1, 1}){ + public int method0(int[] args) {return QueryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + public int method3(int[] args) {return SetDimensions(args[0], args[1], args[2], args[3], args[4]);} + public int method4(int[] args) {return GetDimensions(args[0], args[1], args[2], args[3], args[4]);} + public int method5(int[] args) {return SetFocus();} + public int method6(int[] args) {return GetVisibility(args[0]);} + public int method7(int[] args) {return SetVisibility(args[0]);} + public int method8(int[] args) {return GetTitle(args[0]);} + public int method9(int[] args) {return SetTitle(args[0]);} + public int method10(int[] args) {return GetSiteWindow(args[0]);} + }; + + interfaceRequestor = new XPCOMObject(new int[]{2, 0, 0, 2}){ + public int method0(int[] args) {return QueryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + public int method3(int[] args) {return GetInterface(args[0], args[1]);} + }; + + supportsWeakReference = new XPCOMObject(new int[]{2, 0, 0, 1}){ + public int method0(int[] args) {return QueryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + public int method3(int[] args) {return GetWeakReference(args[0]);} + }; + + contextMenuListener = new XPCOMObject(new int[]{2, 0, 0, 3}){ + public int method0(int[] args) {return QueryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + public int method3(int[] args) {return OnShowContextMenu(args[0],args[1],args[2]);} + }; + + uriContentListener = new XPCOMObject(new int[]{2, 0, 0, 2, 5, 3, 4, 1, 1, 1, 1}) { + public int method0(int[] args) {return QueryInterface(args[0], args[1]);} + public int method1(int[] args) {return AddRef();} + public int method2(int[] args) {return Release();} + public int method3(int[] args) {return OnStartURIOpen(args[0], args[1]);} + public int method4(int[] args) {return DoContent(args[0], args[1], args[2], args[3], args[4]);} + public int method5(int[] args) {return IsPreferred(args[0], args[1], args[2]);} + public int method6(int[] args) {return CanHandleContent(args[0], args[1], args[2], args[3]);} + public int method7(int[] args) {return GetLoadCookie(args[0]);} + public int method8(int[] args) {return SetLoadCookie(args[0]);} + public int method9(int[] args) {return GetParentContentListener(args[0]);} + public int method10(int[] args) {return SetParentContentListener(args[0]);} + }; +} + +void disposeCOMInterfaces() { + if (supports != null) { + supports.dispose(); + supports = null; + } + if (weakReference != null) { + weakReference.dispose(); + weakReference = null; + } + if (webProgressListener != null) { + webProgressListener.dispose(); + webProgressListener = null; + } + if (webBrowserChrome != null) { + webBrowserChrome.dispose(); + webBrowserChrome = null; + } + if (webBrowserChromeFocus != null) { + webBrowserChromeFocus.dispose(); + webBrowserChromeFocus = null; + } + if (embeddingSiteWindow != null) { + embeddingSiteWindow.dispose(); + embeddingSiteWindow = null; + } + if (interfaceRequestor != null) { + interfaceRequestor.dispose(); + interfaceRequestor = null; + } + if (supportsWeakReference != null) { + supportsWeakReference.dispose(); + supportsWeakReference = null; + } + if (contextMenuListener != null) { + contextMenuListener.dispose(); + contextMenuListener = null; + } + if (uriContentListener != null) { + uriContentListener.dispose(); + uriContentListener = null; + } +} + +/** + * Navigate to the next session history item. + * + * @return <code>true</code> if the operation was successful and <code>false</code> otherwise + * + * @exception SWTError <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @see #back + * + * @since 3.0 + */ public boolean forward() { checkWidget(); - return false; + if (!isLinux) return false; + int[] result = new int[1]; + int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + + nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]); + rc = webNavigation.GoForward(); + webNavigation.Release(); + + return rc == XPCOM.NS_OK; } +/** + * Returns the current URL. + * + * @return the current URL or an empty <code>String</code> if there is no current URL + * + * @exception SWTError <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @see #setUrl + * + * @since 3.0 + */ public String getUrl() { checkWidget(); - return null; + if (!isLinux) return ""; + int[] aContentDOMWindow = new int[1]; + int rc = webBrowser.GetContentDOMWindow(aContentDOMWindow); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (aContentDOMWindow[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + + nsIDOMWindow domWindow = new nsIDOMWindow(aContentDOMWindow[0]); + int[] result = new int[1]; + rc = domWindow.QueryInterface(nsIDOMWindowInternal.NS_IDOMWINDOWINTERNAL_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + domWindow.Release(); + + nsIDOMWindowInternal domWindowInternal = new nsIDOMWindowInternal(result[0]); + int[] aLocation = new int[1]; + rc = domWindowInternal.GetLocation(aLocation); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (aLocation[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + domWindowInternal.Release(); + + nsIDOMLocation domLocation = new nsIDOMLocation(aLocation[0]); + nsString _retval = new nsString(); + rc = domLocation.ToString(_retval.getAddress()); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + domLocation.Release(); + + String url = _retval.toString(); + _retval.dispose(); + return url; +} + +void onDispose() { + int[] result = new int[1]; + int rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + + nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]); + rc = baseWindow.Destroy(); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + baseWindow.Release(); + + Release(); + webBrowser.Release(); + + GTK.gtk_widget_destroy(gtkHandle); + gtkHandle = 0; + + browserCount--; + if (browserCount == 0) { + if (appShell != null) { + // Shutdown the appshell service. + rc = appShell.Spindown(); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + appShell.Release(); + appShell = null; + } + locProvider.Release(); + locProvider = null; + XPCOM.NS_TermEmbedding(); + } +} + +void onFocusGained(Event e) { + int[] result = new int[1]; + int rc = webBrowser.QueryInterface(nsIWebBrowserFocus.NS_IWEBBROWSERFOCUS_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + + nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus(result[0]); + rc = webBrowserFocus.Activate(); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + webBrowserFocus.Release(); +} + +void onFocusLost(Event e) { + int[] result = new int[1]; + int rc = webBrowser.QueryInterface(nsIWebBrowserFocus.NS_IWEBBROWSERFOCUS_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + + nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus(result[0]); + rc = webBrowserFocus.Deactivate(); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + webBrowserFocus.Release(); +} + +void onResize() { + final Rectangle rect = getClientArea(); + int width = Math.max(2, rect.width); + int height = Math.max(2, rect.height); + + int[] result = new int[1]; + int rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + + nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]); + rc = baseWindow.SetPositionAndSize(0, 0, width, height, true); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + baseWindow.Release(); } +/** + * Refresh the current page. + * + * @exception SWTError <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ public void refresh() { checkWidget(); + if (!isLinux) return; + int[] result = new int[1]; + int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + + nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]); + rc = webNavigation.Reload(nsIWebNavigation.LOAD_FLAGS_NONE); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + webNavigation.Release(); } +/** + * Removes the listener. + * + * @param listener the listener + * + * @exception SWTError + * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul> + * + * @since 3.0 + */ public void removeLocationListener(LocationListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (locationListeners.length == 0) return; + int index = -1; + for (int i = 0; i < locationListeners.length; i++) { + if (listener == locationListeners[i]){ + index = i; + break; + } + } + if (index == -1) return; + if (locationListeners.length == 1) { + locationListeners = new LocationListener[0]; + return; + } + LocationListener[] newLocationListeners = new LocationListener[locationListeners.length - 1]; + System.arraycopy(locationListeners, 0, newLocationListeners, 0, index); + System.arraycopy(locationListeners, index + 1, newLocationListeners, index, locationListeners.length - index - 1); + locationListeners = newLocationListeners; } +/** + * Removes the listener. + * + * @param listener the listener + * + * @exception SWTError + * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul> + * + * @since 3.0 + */ public void removeProgressListener(ProgressListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (progressListeners.length == 0) return; + int index = -1; + for (int i = 0; i < progressListeners.length; i++) { + if (listener == progressListeners[i]){ + index = i; + break; + } + } + if (index == -1) return; + if (progressListeners.length == 1) { + progressListeners = new ProgressListener[0]; + return; + } + ProgressListener[] newProgressListeners = new ProgressListener[progressListeners.length - 1]; + System.arraycopy(progressListeners, 0, newProgressListeners, 0, index); + System.arraycopy(progressListeners, index + 1, newProgressListeners, index, progressListeners.length - index - 1); + progressListeners = newProgressListeners; } +/** + * Removes the listener. + * + * @param listener the listener + * + * @exception SWTError + * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul> + * + * @since 3.0 + */ public void removeStatusTextListener(StatusTextListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (statusTextListeners.length == 0) return; + int index = -1; + for (int i = 0; i < statusTextListeners.length; i++) { + if (listener == statusTextListeners[i]){ + index = i; + break; + } + } + if (index == -1) return; + if (statusTextListeners.length == 1) { + statusTextListeners = new StatusTextListener[0]; + return; + } + StatusTextListener[] newStatusTextListeners = new StatusTextListener[statusTextListeners.length - 1]; + System.arraycopy(statusTextListeners, 0, newStatusTextListeners, 0, index); + System.arraycopy(statusTextListeners, index + 1, newStatusTextListeners, index, statusTextListeners.length - index - 1); + statusTextListeners = newStatusTextListeners; } +/** + * Loads a URL. + * + * @param url the URL to be loaded + * + * @return true if the operation was successfull and false otherwise. + * + * @exception SWTError <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @see #getUrl + * + * @since 3.0 + */ public boolean setUrl(String url) { checkWidget(); - return false; + if (!isLinux) return false; + int[] result = new int[1]; + int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + + nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]); + char[] arg = url.toCharArray(); + char[] c = new char[arg.length+1]; + System.arraycopy(arg,0,c,0,arg.length); + rc = webNavigation.LoadURI(c, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + onFocusGained(null); // Fixes the keyboard INput Tag issues + webNavigation.Release(); + + return true; } +/** + * Stop any loading and rendering activity. + * + * @exception SWTError <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ public void stop() { checkWidget(); + if (!isLinux) return; + int[] result = new int[1]; + int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + if (result[0] == 0) throw new SWTError(XPCOM.errorMsg(XPCOM.NS_ERROR_NO_INTERFACE)); + + nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]); + rc = webNavigation.Stop(nsIWebNavigation.STOP_ALL); + if (rc != XPCOM.NS_OK) throw new SWTError(XPCOM.errorMsg(rc)); + webNavigation.Release(); +} + +/* nsISupports */ + +int QueryInterface(int riid, int ppvObject) { + if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; + + nsID guid = new nsID(); + XPCOM.memmove(guid, riid, nsID.sizeof); + + if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) { + XPCOM.memmove(ppvObject, new int[] {supports.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + if (guid.Equals(nsIWeakReference.NS_IWEAKREFERENCE_IID)) { + XPCOM.memmove(ppvObject, new int[] {weakReference.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + if (guid.Equals(nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) { + XPCOM.memmove(ppvObject, new int[] {webProgressListener.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + if (guid.Equals(nsIWebBrowserChrome.NS_IWEBBROWSERCHROME_IID)) { + XPCOM.memmove(ppvObject, new int[] {webBrowserChrome.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + if (guid.Equals(nsIWebBrowserChromeFocus.NS_IWEBBROWSERCHROMEFOCUS_IID)) { + XPCOM.memmove(ppvObject, new int[] {webBrowserChromeFocus.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + if (guid.Equals(nsIEmbeddingSiteWindow.NS_IEMBEDDINGSITEWINDOW_IID)) { + XPCOM.memmove(ppvObject, new int[] {embeddingSiteWindow.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + if (guid.Equals(nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID)) { + XPCOM.memmove(ppvObject, new int[] {interfaceRequestor.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + if (guid.Equals(nsISupportsWeakReference.NS_ISUPPORTSWEAKREFERENCE_IID)) { + XPCOM.memmove(ppvObject, new int[] {supportsWeakReference.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + if (guid.Equals(nsIContextMenuListener.NS_ICONTEXTMENULISTENER_IID)) { + XPCOM.memmove(ppvObject, new int[] {contextMenuListener.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + if (guid.Equals(nsIURIContentListener.NS_IURICONTENTLISTENER_IID)) { + XPCOM.memmove(ppvObject, new int[] {uriContentListener.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; + } + XPCOM.memmove(ppvObject, new int[] {0}, 4); + return XPCOM.NS_ERROR_NO_INTERFACE; +} + +int AddRef() { + refCount++; + return refCount; +} + +int Release() { + refCount--; + if (refCount == 0) disposeCOMInterfaces(); + return refCount; +} + +/* nsIWeakReference */ + +int QueryReferent(int riid, int ppvObject) { + return QueryInterface(riid,ppvObject); +} + +/* nsIInterfaceRequestor */ + +int GetInterface(int riid,int ppvObject) { + return QueryInterface(riid,ppvObject); +} + +int GetWeakReference(int ppvObject) { + XPCOM.memmove(ppvObject, new int[] {weakReference.getAddress()}, 4); + AddRef(); + return XPCOM.NS_OK; +} + +/* nsIWebProgressListener */ + +int OnStateChange(int aWebProgress, int aRequest, int aStateFlags, int aStatus) { + if (((aStateFlags & nsIWebProgressListener.STATE_STOP) != 0) && ((aStateFlags & nsIWebProgressListener.STATE_IS_DOCUMENT) != 0)) { + /* navigation completed */ + ProgressEvent event = new ProgressEvent(this); + for (int i = 0; i < progressListeners.length; i++) + progressListeners[i].completed(event); + StatusTextEvent event2 = new StatusTextEvent(this); + event2.text = ""; //$NON-NLS-1$ + for (int i = 0; i < statusTextListeners.length; i++) + statusTextListeners[i].changed(event2); + + } + return XPCOM.NS_OK; +} + +int OnProgressChange(int aWebProgress, int aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { + if (progressListeners.length == 0) return XPCOM.NS_OK; + + int total = aMaxTotalProgress; + if (total <= 0) total = Integer.MAX_VALUE; + ProgressEvent event = new ProgressEvent(this); + event.current = aCurTotalProgress; + event.total = aMaxTotalProgress; + + for (int i = 0; i < progressListeners.length; i++) + progressListeners[i].changed(event); + return XPCOM.NS_OK; +} + +int OnLocationChange(int aWebProgress, int aRequest, int aLocation) { + if (locationListeners.length == 0) return XPCOM.NS_OK; + + nsIURI location = new nsIURI(aLocation); + int aSpec = XPCOM.nsCString_new(); + location.GetSpec(aSpec); + int length = XPCOM.nsCString_Length(aSpec); + int buffer = XPCOM.nsCString_get(aSpec); + buffer = XPCOM.nsCString_get(aSpec); + byte[] dest = new byte[length]; + XPCOM.memmove(dest, buffer, length); + XPCOM.nsCString_delete(aSpec); + + LocationEvent event = new LocationEvent(this); + event.location = new String(dest); + for (int i = 0; i < locationListeners.length; i++) + locationListeners[i].changed(event); + return XPCOM.NS_OK; +} + +int OnStatusChange(int aWebProgress, int aRequest, int aStatus, int aMessage) { + if (statusTextListeners.length == 0) return XPCOM.NS_OK; + + StatusTextEvent event = new StatusTextEvent(this); + int length = XPCOM.nsCRT_strlen_PRUnichar(aMessage); + char[] dest = new char[length]; + XPCOM.memmove(dest, aMessage, length * 2); + event.text = new String(dest); + for (int i = 0; i < statusTextListeners.length; i++) + statusTextListeners[i].changed(event); + + return XPCOM.NS_OK; +} + +int OnSecurityChange(int aWebProgress, int aRequest, int state) { + return XPCOM.NS_OK; +} + +/* nsIWebBrowserChrome */ + +int SetStatus(int statusType, int status) { + StatusTextEvent event = new StatusTextEvent(this); + int length = XPCOM.nsCRT_strlen_PRUnichar(status); + char[] dest = new char[length]; + XPCOM.memmove(dest, status, length * 2); + String string = new String(dest); + if (string == null) string = ""; //$NON-NLS-1$ + event.text = string; + for (int i = 0; i < statusTextListeners.length; i++) + statusTextListeners[i].changed(event); + return XPCOM.NS_OK; +} + +int GetWebBrowser(int aWebBrowser) { + int[] ret = new int[1]; + if (webBrowser != null) { + webBrowser.AddRef(); + ret[0] = webBrowser.getAddress(); + } + XPCOM.memmove(aWebBrowser, ret, 4); + return XPCOM.NS_OK; +} + +int SetWebBrowser(int aWebBrowser) { + if (webBrowser != null) webBrowser.Release(); + webBrowser = aWebBrowser != 0 ? new nsIWebBrowser(aWebBrowser) : null; + return XPCOM.NS_OK; +} + +int GetChromeFlags(int aChromeFlags) { + int[] ret = new int[1]; + ret[0] = chromeFlags; + XPCOM.memmove(aChromeFlags, ret, 4); + return XPCOM.NS_OK; +} + +int SetChromeFlags(int aChromeFlags) { + chromeFlags = aChromeFlags; + return XPCOM.NS_OK; +} + +int DestroyBrowserWindow() { + return XPCOM.NS_OK; +} + +int SizeBrowserTo(int aCX, int aCY) { + return XPCOM.NS_OK; +} + +int ShowAsModal() { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} + +int IsWindowModal(int retval) { + // no modal loop + XPCOM.memmove(retval, new int[] {0}, 4); + return XPCOM.NS_OK; +} + +int ExitModalEventLoop(int aStatus) { + return XPCOM.NS_OK; +} + +/* nsIEmbeddingSiteWindow */ + +int SetDimensions(int flags, int x, int y, int cx, int cy) { + return XPCOM.NS_OK; +} + +int GetDimensions(int flags, int x, int y, int cx, int cy) { + return XPCOM.NS_OK; +} + +int SetFocus() { + return XPCOM.NS_OK; +} + +int GetVisibility(int value) { + return XPCOM.NS_OK; +} + +int SetVisibility(int value) { + return XPCOM.NS_OK; +} + +int GetTitle(int value) { + return XPCOM.NS_OK; +} + +int SetTitle(int value) { + return XPCOM.NS_OK; +} + +int GetSiteWindow(int siteWindow) { + return XPCOM.NS_OK; +} + +/* nsIWebBrowserChromeFocus */ + +int FocusNextElement() { + traverse(SWT.TRAVERSE_TAB_NEXT); + return XPCOM.NS_OK; +} + +int FocusPrevElement() { + traverse(SWT.TRAVERSE_TAB_PREVIOUS); + return XPCOM.NS_OK; +} + +/* nsIContextMenuListener */ + +int OnShowContextMenu(int aContextFlags, int aEvent, int aNode) { + return XPCOM.NS_OK; +} + +/* nsIURIContentListener */ + +int OnStartURIOpen(int aURI, int retval) { + if (locationListeners.length == 0) return XPCOM.NS_OK; + + nsIURI location = new nsIURI(aURI); + int aSpec = XPCOM.nsCString_new(); + location.GetSpec(aSpec); + int length = XPCOM.nsCString_Length(aSpec); + int buffer = XPCOM.nsCString_get(aSpec); + buffer = XPCOM.nsCString_get(aSpec); + byte[] dest = new byte[length]; + XPCOM.memmove(dest, buffer, length); + XPCOM.nsCString_delete(aSpec); + + LocationEvent event = new LocationEvent(this); + event.location = new String(dest); + for (int i = 0; i < locationListeners.length; i++) + locationListeners[i].changing(event); + + XPCOM.memmove(retval, new int[] {event.cancel ? 1 : 0}, 4); + return XPCOM.NS_OK; +} + +int DoContent(int aContentType, int aIsContentPreferred, int aRequest, int aContentHandler, int retval) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} + +int IsPreferred(int aContentType, int aDesiredContentType, int retval) { + XPCOM.memmove(retval, new int[] {1}, 4); + return XPCOM.NS_OK; +} + +int CanHandleContent(int aContentType, int aIsContentPreferred, int aDesiredContentType, int retval) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} + +int GetLoadCookie(int aLoadCookie) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} + +int SetLoadCookie(int aLoadCookie) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} + +int GetParentContentListener(int aParentContentListener) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} + +int SetParentContentListener(int aParentContentListener) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } } +
\ No newline at end of file diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/internal/mozilla/XPCOMObject.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/internal/mozilla/XPCOMObject.java new file mode 100644 index 0000000000..e9a2c89259 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/internal/mozilla/XPCOMObject.java @@ -0,0 +1,1020 @@ +/******************************************************************************* + * Copyright (c) 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.internal.mozilla; + +import java.util.Hashtable; +import org.eclipse.swt.internal.Callback; + +public class XPCOMObject { + + private int ppVtable; + + static private final int MAX_ARG_COUNT = 12; + static private final int MAX_VTABLE_LENGTH = 80; + static private Callback[][] Callbacks = new Callback[MAX_VTABLE_LENGTH][MAX_ARG_COUNT]; + static private Hashtable ObjectMap = new Hashtable(); + +public XPCOMObject(int[] argCounts) { + int[] callbackAddresses = new int[argCounts.length]; + for (int i = 0, length = argCounts.length; i < length; i++){ + if ((Callbacks[i][argCounts[i]]) == null) { + Callbacks[i][argCounts[i]] = new Callback(this.getClass(), "callback"+i, argCounts[i] + 1, true); //$NON-NLS-1$ + } + callbackAddresses[i] = Callbacks[i][argCounts[i]].getAddress(); + } + + int pVtable = XPCOM.PR_Malloc(4 * argCounts.length); + XPCOM.memmove(pVtable, callbackAddresses, 4 * argCounts.length); + ppVtable = XPCOM.PR_Malloc(4); + XPCOM.memmove(ppVtable, new int[] {pVtable}, 4); + ObjectMap.put(new Integer(ppVtable), this); +} + +static int callback0(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method0(args); +} +static int callback1(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method1(args); +} +static int callback10(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method10(args); +} +static int callback11(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method11(args); +} +static int callback12(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method12(args); +} +static int callback13(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method13(args); +} +static int callback14(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method14(args); +} +static int callback15(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method15(args); +} +static int callback16(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method16(args); +} +static int callback17(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method17(args); +} +static int callback18(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method18(args); +} +static int callback19(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method19(args); +} +static int callback2(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method2(args); +} +static int callback20(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method20(args); +} +static int callback21(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method21(args); +} +static int callback22(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method22(args); +} +static int callback23(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method23(args); +} +static int callback24(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method24(args); +} +static int callback25(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method25(args); +} +static int callback26(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method26(args); +} +static int callback27(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method27(args); +} +static int callback28(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method28(args); +} +static int callback29(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method29(args); +} +static int callback3(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method3(args); +} +static int callback30(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method30(args); +} +static int callback31(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method31(args); +} +static int callback32(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method32(args); +} +static int callback33(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method33(args); +} +static int callback34(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method34(args); +} +static int callback35(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method35(args); +} +static int callback36(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method36(args); +} +static int callback37(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method37(args); +} +static int callback38(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method38(args); +} +static int callback39(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method39(args); +} +static int callback4(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method4(args); +} +static int callback40(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method40(args); +} +static int callback41(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method41(args); +} +static int callback42(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method42(args); +} +static int callback43(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method43(args); +} +static int callback44(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method44(args); +} +static int callback45(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method45(args); +} +static int callback46(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method46(args); +} +static int callback47(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method47(args); +} +static int callback48(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method48(args); +} +static int callback49(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method49(args); +} +static int callback5(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method5(args); +} +static int callback50(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method50(args); +} +static int callback51(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method51(args); +} +static int callback52(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method52(args); +} +static int callback53(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method53(args); +} +static int callback54(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method54(args); +} +static int callback55(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method55(args); +} +static int callback56(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method56(args); +} +static int callback57(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method57(args); +} +static int callback58(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method58(args); +} +static int callback59(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method59(args); +} +static int callback6(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method6(args); +} +static int callback60(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method60(args); +} +static int callback61(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method61(args); +} +static int callback62(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method62(args); +} +static int callback63(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method63(args); +} +static int callback64(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method64(args); +} +static int callback65(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method65(args); +} +static int callback66(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method66(args); +} +static int callback67(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method67(args); +} +static int callback68(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method68(args); +} +static int callback69(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method69(args); +} +static int callback7(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method7(args); +} +static int callback70(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method70(args); +} +static int callback71(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method71(args); +} +static int callback72(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method72(args); +} +static int callback73(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method73(args); +} +static int callback74(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method74(args); +} +static int callback75(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method75(args); +} +static int callback76(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method76(args); +} +static int callback77(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method77(args); +} +static int callback78(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method78(args); +} +static int callback79(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method79(args); +} +static int callback8(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method8(args); +} +static int callback9(int[] callbackArgs) { + // find the object on which this call was invoked + int address = callbackArgs[0]; + Object object = ObjectMap.get(new Integer(address)); + if (object == null) return XPCOM.NS_ERROR_FAILURE; + int[] args = new int[callbackArgs.length - 1]; + System.arraycopy(callbackArgs, 1, args, 0, args.length); + return ((XPCOMObject) object).method9(args); +} + +public void dispose() { + // free the memory for this reference + int[] pVtable = new int[1]; + XPCOM.memmove(pVtable, ppVtable, 4); + XPCOM.PR_Free(pVtable[0]); + XPCOM.PR_Free(ppVtable); + + // remove this ppVtable from the list + ObjectMap.remove(new Integer(ppVtable)); + + ppVtable = 0; +} + +public int getAddress () { + return ppVtable; +} + +public int method0(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method1(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method10(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method11(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method12(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method13(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method14(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method15(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method16(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method17(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method18(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method19(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method2(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method20(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method21(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method22(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method23(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method24(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method25(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method26(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method27(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method28(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method29(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method3(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method30(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method31(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method32(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method33(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method34(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method35(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method36(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method37(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method38(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method39(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method4(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method40(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method41(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method42(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method43(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method44(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method45(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method46(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method47(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method48(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method49(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method5(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method50(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method51(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method52(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method53(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method54(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method55(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method56(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method57(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method58(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method59(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method6(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method60(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method61(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method62(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method63(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method64(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method65(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method66(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method67(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method68(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method69(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method7(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method70(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method71(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method72(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method73(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method74(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method75(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method76(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method77(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method78(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method79(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method8(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +public int method9(int[] args) { + return XPCOM.NS_ERROR_NOT_IMPLEMENTED; +} +} + diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Browser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Browser.java index 7508bc2d99..61435ab2ce 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Browser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Browser.java @@ -63,6 +63,10 @@ public class Browser extends Composite { /* Package Name */ static final String PACKAGE_PREFIX = "org.eclipse.swt.browser."; //$NON-NLS-1$ +static { + Library.loadLibrary ("swt-mozilla"); //$NON-NLS-1$ +} + /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance. diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java index 60d9fa8081..4c727bcc22 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java @@ -27,19 +27,12 @@ * ***** END LICENSE BLOCK ***** */ package org.eclipse.swt.internal.mozilla; -import org.eclipse.swt.internal.*; - public class XPCOM { /* Mozilla version */ static final int MAJOR = 1; static final int MINOR = 4; static final String SUPPORTED_VERSION = MAJOR + "." + MINOR; //$NON-NLS-1$ - - static { - /* Load the SWT Mozilla library */ - Library.loadLibrary ("swt-mozilla"); //$NON-NLS-1$ - } /* NsWidgetCID constants */ public static final nsID NS_APPSHELL_CID = new nsID("2d96b3df-c051-11d1-a827-0040959a28c9"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/build.sh b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/build.sh index 6a7bc43026..c7f06e500d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/build.sh +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/build.sh @@ -34,7 +34,7 @@ case $OS in make -f make_linux.mak clean else echo "Building Linux version of SWT and GNOME DLLs." - make -f make_linux.mak make_swt make_awt make_gnome + make -f make_linux.mak make_swt make_awt make_gnome make_gtk build_kde=`rpm -q kdebase | grep "not installed"` if [ "$build_kde" = "" ]; then diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak index fd51292a9c..e4e28c399b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak @@ -50,6 +50,12 @@ AWT_DLL = lib$(AWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so AWT_OBJ = swt_awt.o AWT_LIB = -L$(JAVA_HOME)/jre/bin -ljawt -shared +GTK_PREFIX = swt-gtk +GTK_DLL = lib$(GTK_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +GTK_OBJ = gtk.o +GTK_CFLAGS = `pkg-config --cflags gtk+-2.0` +GTK_LIB = -x -shared `pkg-config --libs gtk+-2.0` + # # The following CFLAGS are for compiling both the SWT library and the GNOME # library. The KDE library uses its own (C++) flags. @@ -63,8 +69,7 @@ CFLAGS = -O -s \ -I$(MOTIF_HOME)/include \ -I/usr/X11R6/include - -all: make_swt make_awt make_gnome +all: make_swt make_awt make_gnome make_gtk kde: make_kde @@ -95,6 +100,14 @@ make_awt: $(AWT_DLL) $(AWT_DLL): $(AWT_OBJ) ld -o $@ $(AWT_OBJ) $(AWT_LIB) +make_gtk: $(GTK_DLL) + +$(GTK_DLL): $(GTK_OBJ) + ld -o $@ $(GTK_OBJ) $(GTK_LIB) + +$(GTK_OBJ): gtk.c + $(CC) $(CFLAGS) $(GTK_CFLAGS) -c -o gtk.o gtk.c + clean: rm -f *.so *.o diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif_gtk/library/gtk.c b/bundles/org.eclipse.swt/Eclipse SWT PI/motif_gtk/library/gtk.c new file mode 100644 index 0000000000..5c29c1ee4a --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif_gtk/library/gtk.c @@ -0,0 +1,120 @@ +#include "swt.h" + +#include <stdio.h> +#include <assert.h> + +#include <gtk/gtk.h> +#include <gdk/gdk.h> + +#define OS_NATIVE(func) Java_org_eclipse_swt_internal_gtk_GTK_##func + +JNIEXPORT jint JNICALL OS_NATIVE(GTK_1WIDGET_1HEIGHT) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc; + rc = (jint)((GtkWidget *)arg0)->allocation.height; + return rc; +} + +JNIEXPORT jint JNICALL OS_NATIVE(GTK_1WIDGET_1WIDTH) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc; + rc = (jint)((GtkWidget *)arg0)->allocation.width; + return rc; +} + +#ifndef NO_g_1signal_1connect +JNIEXPORT jint JNICALL OS_NATIVE(g_1signal_1connect) + (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jint arg3) +{ + jbyte *lparg1=NULL; + jint rc; + if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL); + rc = (jint)g_signal_connect((gpointer)arg0, (const gchar *)lparg1, (GCallback)arg2, (gpointer)arg3); + if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + return rc; +} +#endif + +#ifndef NO_gtk_1events_1pending +JNIEXPORT jint JNICALL OS_NATIVE(gtk_1events_1pending) + (JNIEnv *env, jclass that) +{ + return (jint)gtk_events_pending(); +} +#endif + +#ifndef NO_gtk_1init_1check +JNIEXPORT jboolean JNICALL OS_NATIVE(gtk_1init_1check) + (JNIEnv *env, jclass that, jintArray arg0, jintArray arg1) +{ + jint *lparg0=NULL; + jint *lparg1=NULL; + jboolean rc; + if (arg0) lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL); + if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL); + rc = (jboolean)gtk_init_check((int *)lparg0, (char ***)lparg1); + if (arg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0); + if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + return rc; +} +#endif + +JNIEXPORT void JNICALL OS_NATIVE(gtk_1main) + (JNIEnv *env, jclass that) +{ + gtk_main(); +} + +#ifndef NO_gtk_1main_1iteration +JNIEXPORT jint JNICALL OS_NATIVE(gtk_1main_1iteration) + (JNIEnv *env, jclass that) +{ + return (jint)gtk_main_iteration(); +} +#endif + +#ifndef NO_gtk_1plug_1new +JNIEXPORT jint JNICALL OS_NATIVE(gtk_1plug_1new) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc; + rc = (jint)gtk_plug_new(arg0); + return rc; +} +#endif + +#ifndef NO_gtk_1widget_1destroy +JNIEXPORT void JNICALL OS_NATIVE(gtk_1widget_1destroy) + (JNIEnv *env, jclass that, jint arg0) +{ + gtk_widget_destroy((GtkWidget *)arg0); +} +#endif + +#ifndef NO_gtk_1widget_1show +JNIEXPORT void JNICALL OS_NATIVE(gtk_1widget_1show) + (JNIEnv *env, jclass that, jint arg0) +{ + gtk_widget_show((GtkWidget *)arg0); +} +#endif + +#ifndef NO_gtk_1widget_1show_1now +JNIEXPORT void JNICALL OS_NATIVE(gtk_1widget_1show_1now) + (JNIEnv *env, jclass that, jint arg0) +{ + gtk_widget_show_now((GtkWidget *)arg0); +} +#endif + +#ifndef NO_gtk_1window_1new +JNIEXPORT jint JNICALL OS_NATIVE(gtk_1window_1new) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc; + rc = (jint)gtk_window_new((GtkWindowType)arg0); + return rc; +} +#endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif_gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif_gtk/org/eclipse/swt/internal/gtk/GTK.java new file mode 100644 index 0000000000..9f4cfc90d6 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif_gtk/org/eclipse/swt/internal/gtk/GTK.java @@ -0,0 +1,17 @@ +package org.eclipse.swt.internal.gtk; + +public class GTK { + +public static final synchronized native int GTK_WIDGET_HEIGHT(int widget); +public static final synchronized native int GTK_WIDGET_WIDTH(int widget); +public static final synchronized native int g_signal_connect(int instance, byte[] detailed_signal, int proc, int data); +public static final synchronized native int gtk_events_pending(); +public static final synchronized native boolean gtk_init_check(int[] argc, int[] argv); +public static final synchronized native void gtk_main(); +public static final synchronized native int gtk_main_iteration(); +public static final synchronized native int gtk_plug_new(int socket_id); +public static final synchronized native void gtk_widget_destroy(int widget); +public static final synchronized native void gtk_widget_show(int widget); +public static final synchronized native void gtk_widget_show_now(int widget); +public static final synchronized native int gtk_window_new(int type); +} |