diff --git a/mozilla/java/webclient/src/motif/BrowserControlMozillaShimStub.cpp b/mozilla/java/webclient/src/motif/BrowserControlMozillaShimStub.cpp new file mode 100644 index 00000000000..beb577bf7d5 --- /dev/null +++ b/mozilla/java/webclient/src/motif/BrowserControlMozillaShimStub.cpp @@ -0,0 +1,774 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/* + * BrowserControlMozillaShimStub.cpp + */ + +#include +#include +#include "../BrowserControlMozillaShim.h" + +void * mozWebShellDll; + +extern void locateMotifBrowserControlStubFunctions(void *); + +void (* nativeInitialize) (JNIEnv *, jobject); +void (* nativeTerminate) (JNIEnv *, jobject); +void (* nativeSendKeyDownEvent) (JNIEnv *, jobject, jint, jchar, jint, jint, jint); +void (* nativeSendKeyUpEvent) (JNIEnv *, jobject, jint, jchar, jint, jint, jint); +void (* nativeSendMouseEvent) (JNIEnv *, jobject, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint); +void (* nativeIdleEvent) (JNIEnv *, jobject, jint, jint); +void (* nativeUpdateEvent) (JNIEnv *, jobject, jint, jint); +jint (* nativeWidgetCreate) (JNIEnv *, jobject, jint, jint, jint, jint, jint); +void (* nativeWidgetDelete) (JNIEnv *, jobject, jint); +void (* nativeWidgetResize) (JNIEnv *, jobject, jint, jint, jint, jint, jint, jboolean); +void (* nativeWidgetEnable) (JNIEnv *, jobject, jint, jboolean); +void (* nativeWidgetShow) (JNIEnv *, jobject, jint, jboolean); +void (* nativeWidgetInvalidate) (JNIEnv *, jobject, jint, jboolean); +void (* nativeWidgetUpdate) (JNIEnv *, jobject, jint); +void (* nativeProcessEvents) (JNIEnv *, jobject, jint); +jint (* nativeWebShellCreate) (JNIEnv *, jobject, jint, jint, jint, jint, jint); +void (* nativeWebShellDelete) (JNIEnv *, jobject, jint); +void (* nativeWebShellLoadURL) (JNIEnv *, jobject, jint, jstring); +void (* nativeWebShellStop) (JNIEnv *, jobject, jint); +void (* nativeWebShellShow) (JNIEnv *, jobject, jint); +void (* nativeWebShellHide) (JNIEnv *, jobject, jint); +void (* nativeWebShellSetBounds) (JNIEnv *, jobject, jint, jint, jint, jint, jint); +void (* nativeWebShellMoveTo) (JNIEnv *, jobject, jint, jint, jint); +void (* nativeWebShellSetFocus) (JNIEnv *, jobject, jint); +void (* nativeWebShellRemoveFocus) (JNIEnv *, jobject, jint); +void (* nativeWebShellRepaint) (JNIEnv *, jobject, jint, jboolean); +jboolean (* nativeWebShellCanBack) (JNIEnv *, jobject, jint); +jboolean (* nativeWebShellCanForward) (JNIEnv *, jobject, jint); +jboolean (* nativeWebShellBack) (JNIEnv *, jobject, jint); +jboolean (* nativeWebShellForward) (JNIEnv *, jobject, jint); +jboolean (* nativeWebShellGoTo) (JNIEnv *, jobject, jint, jint); +jint (* nativeWebShellGetHistoryLength) (JNIEnv *, jobject, jint); +jint (* nativeWebShellGetHistoryIndex) (JNIEnv *, jobject, jint); +jstring (* nativeWebShellGetURL) (JNIEnv *, jobject, jint, jint); + +void locateBrowserControlStubFunctions(void * dll) { + nativeInitialize = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize"); + if (!nativeInitialize) { + printf("got dlsym error %s\n", dlerror()); + } + nativeTerminate = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeTerminate"); + if (!nativeTerminate) { + printf("got dlsym error %s\n", dlerror()); + } + nativeSendKeyDownEvent = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeSendKeyDownEvent"); + if (!nativeSendKeyDownEvent) { + printf("got dlsym error %s\n", dlerror()); + } + nativeSendKeyUpEvent = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeSendKeyUpEvent"); + if (!nativeSendKeyUpEvent) { + printf("got dlsym error %s\n", dlerror()); + } + nativeSendMouseEvent = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeSendMouseEvent"); + if (!nativeSendMouseEvent) { + printf("got dlsym error %s\n", dlerror()); + } + nativeIdleEvent = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeIdleEvent"); + if (!nativeIdleEvent) { + printf("got dlsym error %s\n", dlerror()); + } + nativeUpdateEvent = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeUpdateEvent"); + if (!nativeUpdateEvent) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWidgetCreate = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetCreate"); + if (!nativeWidgetCreate) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWidgetDelete = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetDelete"); + if (!nativeWidgetDelete) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWidgetResize = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetResize"); + if (!nativeWidgetResize) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWidgetEnable = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetEnable"); + if (!nativeWidgetEnable) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWidgetShow = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetShow"); + if (!nativeWidgetShow) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWidgetInvalidate = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetInvalidate"); + if (!nativeWidgetInvalidate) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWidgetUpdate = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetUpdate"); + if (!nativeWidgetUpdate) { + printf("got dlsym error %s\n", dlerror()); + } + nativeProcessEvents = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeProcessEvents"); + if (!nativeProcessEvents) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellCreate = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCreate"); + if (!nativeWebShellCreate) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellDelete = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellDelete"); + if (!nativeWebShellDelete) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellLoadURL = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellLoadURL"); + if (!nativeWebShellLoadURL) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellStop = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellStop"); + if (!nativeWebShellStop) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellShow = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellShow"); + if (!nativeWebShellShow) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellHide = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellHide"); + if (!nativeWebShellHide) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellSetBounds = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellSetBounds"); + if (!nativeWebShellSetBounds) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellMoveTo = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellMoveTo"); + if (!nativeWebShellMoveTo) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellSetFocus = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellSetFocus"); + if (!nativeWebShellSetFocus) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellRemoveFocus = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRemoveFocus"); + if (!nativeWebShellRemoveFocus) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellRepaint = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRepaint"); + if (!nativeWebShellRepaint) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellCanBack = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCanBack"); + if (!nativeWebShellCanBack) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellCanForward = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCanForward"); + if (!nativeWebShellCanForward) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellBack = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellBack"); + if (!nativeWebShellBack) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellForward = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellForward"); + if (!nativeWebShellForward) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellGoTo = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGoTo"); + if (!nativeWebShellGoTo) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellGetHistoryLength = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetHistoryLength"); + if (!nativeWebShellGetHistoryLength) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellGetHistoryIndex = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetHistoryIndex"); + if (!nativeWebShellGetHistoryIndex) { + printf("got dlsym error %s\n", dlerror()); + } + nativeWebShellGetURL = dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL"); + if (!nativeWebShellGetURL) { + printf("got dlsym error %s\n", dlerror()); + } + +} + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorInitialize + * Signature: ()V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize ( + JNIEnv * env, + jobject obj) +{ + mozWebShellDll = dlopen("libwebclient.so", RTLD_LAZY | RTLD_GLOBAL); + + if (mozWebShellDll) { + locateBrowserControlStubFunctions(mozWebShellDll); + locateMotifBrowserControlStubFunctions(mozWebShellDll); + + (* nativeInitialize) (env, obj); + } else { + printf("Got Error: %s\n", dlerror()); + } + +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeInitialize() + + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorTerminate + * Signature: ()V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeTerminate ( + JNIEnv * env, + jobject obj) +{ + (* nativeTerminate) (env, obj); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeTerminate() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorSendKeyDownEvent + * Signature: (ICIII)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeSendKeyDownEvent ( + JNIEnv * env, + jobject obj, + jint widgetPtr, + jchar keyChar, + jint keyCode, + jint modifiers, + jint eventTime) +{ + (* nativeSendKeyDownEvent) (env, obj, widgetPtr, keyChar, keyCode, modifiers, eventTime); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeSendKeyDownEvent() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorSendKeyUpEvent + * Signature: (ICIII)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeSendKeyUpEvent ( + JNIEnv * env, + jobject obj, + jint widgetPtr, + jchar keyChar, + jint keyCode, + jint modifiers, + jint eventTime) +{ + (* nativeSendKeyUpEvent) (env, obj, widgetPtr, keyChar, keyCode, modifiers, eventTime); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeSendKeyUpEvent() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorSendMouseEvent + * Signature: (IIIIIIIIIII)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeSendMouseEvent ( + JNIEnv * env, + jobject obj, + jint windowPtr, + jint widgetPtr, + jint widgetX, + jint widgetY, + jint windowX, + jint windowY, + jint mouseMessage, + jint numClicks, + jint modifiers, + jint eventTime) +{ + (* nativeSendMouseEvent) (env, obj, windowPtr, widgetPtr, widgetX, widgetY, windowX, windowY, mouseMessage, numClicks, modifiers, eventTime); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeSendMouseEvent() + + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorIdleEvent + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeIdleEvent ( + JNIEnv * env, + jobject obj, + jint windowPtr, + jint eventTime) +{ + (* nativeIdleEvent) (env, obj, windowPtr, eventTime); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeIdleEvent() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorUpdateEvent + * Signature: (II)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeUpdateEvent ( + JNIEnv * env, + jobject obj, + jint windowPtr, + jint eventTime) +{ + (* nativeUpdateEvent) (env, obj, windowPtr, eventTime); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeUpdateEvent() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWidgetCreate + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetCreate ( + JNIEnv * env, + jobject obj, + jint windowPtr, + jint x, + jint y, + jint width, + jint height) +{ + return (* nativeWidgetCreate) (env, obj, windowPtr, x, y, width, height); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetCreate() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWidgetDelete + * Signature: (I)I + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetDelete ( + JNIEnv * env, + jobject obj, + jint widgetPtr) +{ + (* nativeWidgetDelete) (env, obj, widgetPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetDelete() + + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWidgetResize + * Signature: (IIIZ)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetResize ( + JNIEnv * env, + jobject obj, + jint widgetPtr, + jint x, + jint y, + jint width, + jint height, + jboolean repaint) +{ + (* nativeWidgetResize) (env, obj, widgetPtr, x, y, width, height, repaint); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetResize() + + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWidgetEnable + * Signature: (IZ)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetEnable ( + JNIEnv * env, + jobject obj, + jint widgetPtr, + jboolean enable) +{ + (* nativeWidgetEnable) (env, obj, widgetPtr, enable); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetEnable() + + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWidgetShow + * Signature: (IZ)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetShow ( + JNIEnv * env, + jobject obj, + jint widgetPtr, + jboolean show) +{ + (* nativeWidgetShow) (env, obj, widgetPtr, show); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetShow() + + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWidgetInvalidate + * Signature: (IZ)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetInvalidate ( + JNIEnv * env, + jobject obj, + jint widgetPtr, + jboolean isSynchronous) +{ + (* nativeWidgetInvalidate) (env, obj, widgetPtr, isSynchronous); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetInvalidate() + + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWidgetUpdate + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetUpdate ( + JNIEnv * env, + jobject obj, + jint widgetPtr) +{ + (* nativeWidgetUpdate) (env, obj, widgetPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWidgetUpdate() + + + +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeProcessEvents ( + JNIEnv* env, + jobject obj, + jint theWebShell) +{ + (* nativeProcessEvents) (env, obj, theWebShell); +} + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellCreate + * Signature: (IIIIII)I + */ +JNIEXPORT jint JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCreate ( + JNIEnv * env, + jobject obj, + jint windowPtr, + jint x, + jint y, + jint width, + jint height) +{ + return (* nativeWebShellCreate) (env, obj, windowPtr, x, y, width, height); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCreate() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellDelete + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellDelete ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + (* nativeWebShellDelete) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellDelete() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellLoadURL + * Signature: (ILjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellLoadURL ( + JNIEnv * env, + jobject obj, + jint webShellPtr, + jstring urlString) +{ + (* nativeWebShellLoadURL) (env, obj, webShellPtr, urlString); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellLoadURL() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellStop + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellStop ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + (* nativeWebShellStop) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellStop() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellShow + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellShow ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + (* nativeWebShellShow) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellShow() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellHide + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellHide ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + (* nativeWebShellHide) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellHide() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellSetBounds + * Signature: (IIIII)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellSetBounds ( + JNIEnv * env, + jobject obj, + jint webShellPtr, + jint x, + jint y, + jint width, + jint height) +{ + (* nativeWebShellSetBounds) (env, obj, webShellPtr, x, y, width, height); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellSetBounds() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellMoveTo + * Signature: (III)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellMoveTo ( + JNIEnv * env, + jobject obj, + jint webShellPtr, + jint x, + jint y) +{ + (* nativeWebShellMoveTo) (env, obj, webShellPtr, x, y); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellMoveTo() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellSetFocus + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellSetFocus ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + (* nativeWebShellSetFocus) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellSetFocus() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellRemoveFocus + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRemoveFocus ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + (* nativeWebShellRemoveFocus) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRemoveFocus() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellRepaint + * Signature: (IZ)V + */ +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRepaint ( + JNIEnv * env, + jobject obj, + jint webShellPtr, + jboolean forceRepaint) +{ + (* nativeWebShellRepaint) (env, obj, webShellPtr, forceRepaint); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRepaint() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellCanBack + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCanBack ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + return (* nativeWebShellCanBack) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCanBack() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellCanForward + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCanForward ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + return (* nativeWebShellCanForward) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCanForward() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellBack + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellBack ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + return (* nativeWebShellBack) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellBack() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellForward + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellForward ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + return (* nativeWebShellForward) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellForward() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellGoTo + * Signature: (II)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGoTo ( + JNIEnv * env, + jobject obj, + jint webShellPtr, + jint historyIndex) +{ + return (* nativeWebShellGoTo) (env, obj, webShellPtr, historyIndex); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGoTo() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellGetHistoryLength + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetHistoryLength ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + return (* nativeWebShellGetHistoryLength) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetHistoryLength() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellGetHistoryIndex + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetHistoryIndex ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + return (* nativeWebShellGetHistoryIndex) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetHistoryIndex() + + +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellGetURL + * Signature: (II)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL ( + JNIEnv * env, + jobject obj, + jint webShellPtr, + jint historyIndex) +{ + return (* nativeWebShellGetURL) (env, obj, webShellPtr, historyIndex); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL() + + + +// EOF diff --git a/mozilla/java/webclient/src/motif/MotifBrowserControlCanvas.cpp b/mozilla/java/webclient/src/motif/MotifBrowserControlCanvas.cpp new file mode 100644 index 00000000000..5dc44d8749e --- /dev/null +++ b/mozilla/java/webclient/src/motif/MotifBrowserControlCanvas.cpp @@ -0,0 +1,159 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + + +/* + * MotifBrowserControlCanvas.cpp + */ + +#include +#include "MotifBrowserControlCanvas.h" + +#include + +#include +#include +#include "gtkmozilla.h" + +#include "nsIDOMDocument.h" +#include + +extern "C" void NS_SetupRegistry(); + +extern "C" { + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: createTopLevelWindow + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createTopLevelWindow +(JNIEnv * env, jobject obj) { + static GtkWidget *window = NULL; + NS_SetupRegistry(); + + /* Initialise GTK */ + gtk_set_locale (); + + gtk_init (0, NULL); + + gdk_rgb_init(); + + window = gtk_window_new (GTK_WINDOW_POPUP); + gtk_window_set_default_size(GTK_WINDOW(window), 300, 300); + gtk_window_set_title(GTK_WINDOW(window), "Simple browser"); + + return (jint) window; +} + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: createContainerWindow + * Signature: (III)I + */ +JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createContainerWindow + (JNIEnv * env, jobject obj, jint parent, jint screenWidth, jint screenHeight) { + GtkWidget * window = (GtkWidget *) parent; + GtkWidget * vbox; + GtkWidget * mozilla; + + vbox = gtk_vbox_new (FALSE, 5); + gtk_container_add (GTK_CONTAINER (window), vbox); + gtk_widget_show(vbox); + + mozilla = gtk_mozilla_new(); + gtk_box_pack_start (GTK_BOX (vbox), mozilla, TRUE, TRUE, 0); + + // HACK: javaMake sure this window doesn't appear onscreen!!!! + gtk_widget_set_uposition(window, screenWidth + 20, screenHeight + 20); + gtk_widget_show(mozilla); + + gtk_widget_show(window); + + //gtk_main(); + + return (jint) mozilla; +} + +int getWinID(GtkWidget * gtkWidgetPtr) { + //GdkWindow * gdkWindow = gtk_widget_get_parent_window(gtkWidgetPtr); + GdkWindow * gdkWindow = gtkWidgetPtr->window; + int gtkwinid = GDK_WINDOW_XWINDOW(gdkWindow); + + return gtkwinid; +} + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: getGTKWinID + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_getGTKWinID +(JNIEnv * env, jobject obj, jint gtkWinPtr) { + GtkWidget * gtkWidgetPtr = (GtkWidget *) gtkWinPtr; + + return getWinID(gtkWidgetPtr); +} + + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: reparentWindow + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_reparentWindow (JNIEnv * env, jobject obj, jint childID, jint parentID) { + XReparentWindow(GDK_DISPLAY(), childID, parentID, 0, 0); +} + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: processEvents + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_processEvents + (JNIEnv * env, jobject obj) { + //printf("process events....\n"); + //processEventLoopIntelligently(); +} + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: setGTKWindowSize + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_setGTKWindowSize + (JNIEnv * env, jobject obj, jint gtkWinPtr, jint width, jint height) { +#ifdef DEBUG_RAPTOR_CANVAS + printf("set gtk window size....width=%i, height=%i\n", width, height); +#endif + if (gtkWinPtr != 0) { + GtkWidget * gtkWidgetPtr = (GtkWidget *) gtkWinPtr; + + if (gtkWidgetPtr) { + printf("size is being set...\n"); + gtk_widget_set_usize(gtkWidgetPtr, width, height); + } + } +} + + +} // End extern "C" + + + + diff --git a/mozilla/java/webclient/src/motif/MotifBrowserControlCanvasStub.cpp b/mozilla/java/webclient/src/motif/MotifBrowserControlCanvasStub.cpp new file mode 100644 index 00000000000..1d73284668a --- /dev/null +++ b/mozilla/java/webclient/src/motif/MotifBrowserControlCanvasStub.cpp @@ -0,0 +1,128 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + + +/* + * MotifBrowserControlCanvasStub.cpp + */ + +#include +#include "MotifBrowserControlCanvas.h" + +#include + +extern void locateBrowserControlStubFunctions(void *); + +jint (* createTopLevelWindow) (JNIEnv *, jobject); +jint (* createContainerWindow) (JNIEnv *, jobject, jint, jint, jint); +jint (* getGTKWinID) (JNIEnv *, jobject, jint); +void (* reparentWindow) (JNIEnv *, jobject, jint, jint); +void (* processEvents) (JNIEnv *, jobject); +void (* setGTKWindowSize) (JNIEnv *, jobject, jint, jint, jint); + +void locateMotifBrowserControlStubFunctions(void * dll) { + createTopLevelWindow = dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createTopLevelWindow"); + if (!createTopLevelWindow) { + printf("got dlsym error %s\n", dlerror()); + } + + createContainerWindow = dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createContainerWindow"); + if (!createContainerWindow) { + printf("got dlsym error %s\n", dlerror()); + } + + reparentWindow = dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_reparentWindow"); + if (!reparentWindow) { + printf("got dlsym error %s\n", dlerror()); + } + + processEvents = dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_processEvents"); + if (!processEvents) { + printf("got dlsym error %s\n", dlerror()); + } + + setGTKWindowSize = dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_setGTKWindowSize"); + if (!setGTKWindowSize) { + printf("got dlsym error %s\n", dlerror()); + } + + getGTKWinID = dlsym(dll, "Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_getGTKWinID"); + if (!getGTKWinID) { + printf("got dlsym error %s\n", dlerror()); + } + +} + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: createTopLevelWindow + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createTopLevelWindow (JNIEnv * env, jobject obj) { + return (* createTopLevelWindow) (env, obj); +} + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: createContainerWindow + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_createContainerWindow (JNIEnv * env, jobject obj, jint parent, jint width, jint height) { + return (* createContainerWindow) (env, obj, parent, width, height); +} + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: getGTKWinID + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_getGTKWinID +(JNIEnv * env, jobject obj, jint gtkWinPtr) { + return (* getGTKWinID) (env, obj, gtkWinPtr); +} + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: reparentWindow + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_reparentWindow +(JNIEnv * env, jobject obj, jint childID, jint parentID) { + (* reparentWindow) (env, obj, childID, parentID); +} + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: processEvents + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_processEvents + (JNIEnv * env, jobject obj) { + (* processEvents) (env, obj); +} + + +/* + * Class: org_mozilla_webclient_motif_MotifBrowserControlCanvas + * Method: setGTKWindowSize + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_mozilla_webclient_motif_MotifBrowserControlCanvas_setGTKWindowSize + (JNIEnv * env, jobject obj, jint xwinID, jint width, jint height) { + (* setGTKWindowSize) (env, obj, xwinID, width, height); +} diff --git a/mozilla/java/webclient/src/motif/gtkmozilla.cpp b/mozilla/java/webclient/src/motif/gtkmozilla.cpp new file mode 100644 index 00000000000..cdd22319183 --- /dev/null +++ b/mozilla/java/webclient/src/motif/gtkmozilla.cpp @@ -0,0 +1,131 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "MPL"); you may not use this file except in + * compliance with the MPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of the Original Code is Alexander. Portions + * created by Alexander Larsson are Copyright (C) 1999 + * Alexander Larsson. All Rights Reserved. + */ + + +/* + * gtkmozilla.cpp + */ + +#include +#include "gtkmozilla.h" + +static void gtk_mozilla_realize(GtkWidget *widget); +static void gtk_mozilla_finalize (GtkObject *object); + +typedef gboolean (*GtkSignal_BOOL__POINTER_INT) (GtkObject * object, + gpointer arg1, + gint arg2, + gpointer user_data); + +extern "C" void +gtk_mozilla_marshal_BOOL__POINTER_INT (GtkObject * object, + GtkSignalFunc func, + gpointer func_data, + GtkArg * args) +{ + GtkSignal_BOOL__POINTER_INT rfunc; + gboolean *return_val; + return_val = GTK_RETLOC_BOOL (args[2]); + rfunc = (GtkSignal_BOOL__POINTER_INT) func; + *return_val = (*rfunc) (object, + GTK_VALUE_POINTER (args[0]), + GTK_VALUE_INT (args[1]), + func_data); +} + +static GtkLayoutClass *parent_class = NULL; + +static void +gtk_mozilla_class_init (GtkMozillaClass *klass) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass*) klass; + widget_class = (GtkWidgetClass*) klass; + + parent_class = (GtkLayoutClass *)gtk_type_class (GTK_TYPE_LAYOUT); + + object_class->finalize = gtk_mozilla_finalize; + widget_class->realize = gtk_mozilla_realize; + +} + +static void +gtk_mozilla_realize (GtkWidget *widget) +{ + //printf("gtk_mozilla_realize()\n"); + GtkMozilla *moz = GTK_MOZILLA(widget); + + if (GTK_WIDGET_CLASS (parent_class)->realize) + (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); +} + +static void +gtk_mozilla_init (GtkMozilla *moz) +{ + //printf("gtk_mozilla_init()\n"); + + gtk_layout_set_hadjustment (GTK_LAYOUT (moz), NULL); + gtk_layout_set_vadjustment (GTK_LAYOUT (moz), NULL); + + GTK_WIDGET_SET_FLAGS (GTK_WIDGET(moz), GTK_CAN_FOCUS); +} + +GtkType +gtk_mozilla_get_type (void) +{ + static GtkType mozilla_type = 0; + + if (!mozilla_type) { + static const GtkTypeInfo mozilla_info = { + "GtkMozilla", + sizeof (GtkMozilla), + sizeof (GtkMozillaClass), + (GtkClassInitFunc) gtk_mozilla_class_init, + (GtkObjectInitFunc) gtk_mozilla_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + mozilla_type = gtk_type_unique (GTK_TYPE_LAYOUT, &mozilla_info); + } + + return mozilla_type; +} + +GtkWidget* +gtk_mozilla_new (void) +{ + GtkMozilla *moz; + + moz = GTK_MOZILLA(gtk_type_new(GTK_TYPE_MOZILLA)); + + return GTK_WIDGET (moz); +} + +static void +gtk_mozilla_finalize (GtkObject *object) +{ + GtkMozilla *moz; + + g_return_if_fail(object != NULL); + g_return_if_fail(GTK_IS_MOZILLA(object)); + + moz = GTK_MOZILLA(object); + + GTK_OBJECT_CLASS(parent_class)->finalize (object); +} diff --git a/mozilla/java/webclient/src/motif/gtkmozilla.h b/mozilla/java/webclient/src/motif/gtkmozilla.h new file mode 100644 index 00000000000..86e9b6641d2 --- /dev/null +++ b/mozilla/java/webclient/src/motif/gtkmozilla.h @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * Copyright (C) 1999 Alexander Larsson. All Rights Reserved. + */ + +/* + * gtkmozilla.h + */ + +#ifndef GTKMOZILLA_H +#define GTKMOZILLA_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +#define GTK_TYPE_MOZILLA (gtk_mozilla_get_type ()) +#define GTK_MOZILLA(obj) GTK_CHECK_CAST ((obj), GTK_TYPE_MOZILLA, GtkMozilla) +#define GTK_MOZILLA_CLASS(klass) GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MOZILLA, GtkMozillaClass) +#define GTK_IS_MOZILLA(obj) GTK_CHECK_TYPE ((obj), GTK_TYPE_MOZILLA) +#define GTK_IS_MOZILLA_CLASS(klass) GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MOZILLA) + + +typedef struct _GtkMozilla GtkMozilla; +typedef struct _GtkMozillaClass GtkMozillaClass; + +struct _GtkMozilla +{ + GtkLayout layout; +}; + +struct _GtkMozillaClass +{ + GtkLayoutClass parent_class; +}; + +extern GtkType gtk_mozilla_get_type(void); +extern GtkWidget* gtk_mozilla_new(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* GTKMOZILLA_H */ diff --git a/mozilla/java/webclient/src/motif/nsSetupRegistry.cpp b/mozilla/java/webclient/src/motif/nsSetupRegistry.cpp new file mode 100644 index 00000000000..03a2f61ba0e --- /dev/null +++ b/mozilla/java/webclient/src/motif/nsSetupRegistry.cpp @@ -0,0 +1,289 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#define NS_IMPL_IDS +#include "nsCOMPtr.h" +#include "nsIPref.h" +#include "nsIComponentManager.h" +#include "nsWidgetsCID.h" +#include "nsViewsCID.h" +#include "nsPluginsCID.h" + +#include "nsIBrowserWindow.h" +#include "nsIWebShell.h" +#include "nsIDocumentLoader.h" +#include "nsIThrobber.h" + +#include "nsParserCIID.h" +#include "nsDOMCID.h" +#ifndef NECKO +#include "nsINetService.h" +#else +#include "nsIIOService.h" +#endif // NECKO +#ifdef OJI +#include "nsICapsManager.h" +#include "nsILiveconnect.h" +#include "nsIJVMManager.h" +#endif +#include "nsIPluginManager.h" +#include "nsIProperties.h" + +#include "nsIObserverService.h" +#include "nsIObserver.h" +#include "nsIAllocator.h" +#include "nsIEventQueue.h" +#include "nsIEventQueueService.h" +#include "nsIGenericFactory.h" +#include "nsGfxCIID.h" +#include "nsSpecialSystemDirectory.h" + +#include "nsISound.h" +#include "nsIFileSpecWithUI.h" + +#include "prprf.h" +#include "prmem.h" +#include "prlog.h" // PR_ASSERT + +#ifdef XP_PC + #define WIDGET_DLL "raptorwidget.dll" + #define GFXWIN_DLL "raptorgfxwin.dll" + #define VIEW_DLL "raptorview.dll" + #define WEB_DLL "raptorweb.dll" + #define PREF_DLL "xppref32.dll" + #define PARSER_DLL "raptorhtmlpars.dll" + #define DOM_DLL "jsdom.dll" +#ifdef NECKO + #define NECKO_DLL "necko.dll" +#else + #define NETLIB_DLL "netlib.dll" +#endif // NECKO + #define PLUGIN_DLL "raptorplugin.dll" + #define CAPS_DLL "caps.dll" + #define LIVECONNECT_DLL "jsj3250.dll" + #define OJI_DLL "oji.dll" +#elif defined(XP_MAC) + #define WIDGET_DLL "WIDGET_DLL" + #define GFXWIN_DLL "GFXWIN_DLL" + #define VIEW_DLL "VIEW_DLL" + #define WEB_DLL "WEB_DLL" + #define PREF_DLL "PREF_DLL" + #define PARSER_DLL "PARSER_DLL" + #define DOM_DLL "DOM_DLL" +#ifdef NECKO + #define NECKO_DLL "NECKO_DLL" +#else + #define NETLIB_DLL "NETLIB_DLL" +#endif // NECKO + #define PLUGIN_DLL "PLUGIN_DLL" + #define CAPS_DLL "CAPS_DLL" + #define LIVECONNECT_DLL "LIVECONNECT_DLL" + #define OJI_DLL "OJI_DLL" +#else + /** Currently CFLAGS defines WIDGET_DLL and GFXWIN_DLL. If, for some + * reason, the cflags value doesn't get defined, use gtk, + * since that is the default. + **/ + #ifndef WIDGET_DLL + #define WIDGET_DLL "libwidgetgtk"MOZ_DLL_SUFFIX + #endif + #ifndef GFXWIN_DLL + #define GFXWIN_DLL "libgfxgtk"MOZ_DLL_SUFFIX + #endif + #define VIEW_DLL "libraptorview"MOZ_DLL_SUFFIX + #define WEB_DLL "libraptorwebwidget"MOZ_DLL_SUFFIX + #define PREF_DLL "libpref"MOZ_DLL_SUFFIX + #define PARSER_DLL "libraptorhtmlpars"MOZ_DLL_SUFFIX + #define DOM_DLL "libjsdom"MOZ_DLL_SUFFIX +#ifdef NECKO + #define NECKO_DLL "libnecko"MOZ_DLL_SUFFIX +#else + #define NETLIB_DLL "libnetlib"MOZ_DLL_SUFFIX +#endif // NECKO + #define PLUGIN_DLL "libraptorplugin"MOZ_DLL_SUFFIX + #define CAPS_DLL "libcaps"MOZ_DLL_SUFFIX + #define LIVECONNECT_DLL "libliveconnect"MOZ_DLL_SUFFIX + #define OJI_DLL "liboji"MOZ_DLL_SUFFIX +#endif + +// Class ID's + +// WIDGET +static NS_DEFINE_IID(kCLookAndFeelCID, NS_LOOKANDFEEL_CID); +static NS_DEFINE_IID(kCWindowCID, NS_WINDOW_CID); +static NS_DEFINE_IID(kCVScrollbarCID, NS_VERTSCROLLBAR_CID); +static NS_DEFINE_IID(kCHScrollbarCID, NS_HORZSCROLLBAR_CID); +static NS_DEFINE_IID(kCDialogCID, NS_DIALOG_CID); +static NS_DEFINE_IID(kCLabelCID, NS_LABEL_CID); +static NS_DEFINE_IID(kCButtonCID, NS_BUTTON_CID); +static NS_DEFINE_IID(kCComboBoxCID, NS_COMBOBOX_CID); +static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID); +static NS_DEFINE_IID(kCListBoxCID, NS_LISTBOX_CID); +static NS_DEFINE_IID(kCRadioButtonCID, NS_RADIOBUTTON_CID); +static NS_DEFINE_IID(kCTextAreaCID, NS_TEXTAREA_CID); +static NS_DEFINE_IID(kCTextFieldCID, NS_TEXTFIELD_CID); +static NS_DEFINE_IID(kCCheckButtonCID, NS_CHECKBUTTON_CID); +static NS_DEFINE_IID(kCChildCID, NS_CHILD_CID); +static NS_DEFINE_IID(kCAppShellCID, NS_APPSHELL_CID); +static NS_DEFINE_IID(kCToolkitCID, NS_TOOLKIT_CID); +static NS_DEFINE_IID(kClipboardCID, NS_CLIPBOARD_CID); +static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID); +static NS_DEFINE_IID(kDataFlavorCID, NS_DATAFLAVOR_CID); +static NS_DEFINE_IID(kCXIFFormatConverterCID, NS_XIFFORMATCONVERTER_CID); +static NS_DEFINE_IID(kCDragServiceCID, NS_DRAGSERVICE_CID); +//static NS_DEFINE_IID(kCFileListTransferableCID, NS_FILELISTTRANSFERABLE_CID); +static NS_DEFINE_IID(kCFontRetrieverServiceCID, NS_FONTRETRIEVERSERVICE_CID); +static NS_DEFINE_IID(kCMenuBarCID, NS_MENUBAR_CID); +static NS_DEFINE_IID(kCMenuCID, NS_MENU_CID); +static NS_DEFINE_IID(kCMenuItemCID, NS_MENUITEM_CID); +static NS_DEFINE_IID(kCContextMenuCID, NS_CONTEXTMENU_CID); +//static NS_DEFINE_IID(kCXULCommandCID, NS_XULCOMMAND_CID); +static NS_DEFINE_IID(kSoundCID, NS_SOUND_CID); +static NS_DEFINE_CID(kFileSpecWithUICID, NS_FILESPECWITHUI_CID); + +// GFXWIN +static NS_DEFINE_IID(kCRenderingContextIID, NS_RENDERING_CONTEXT_CID); +static NS_DEFINE_IID(kCDeviceContextIID, NS_DEVICE_CONTEXT_CID); +static NS_DEFINE_IID(kCFontMetricsIID, NS_FONT_METRICS_CID); +static NS_DEFINE_IID(kCImageIID, NS_IMAGE_CID); +static NS_DEFINE_IID(kCRegionIID, NS_REGION_CID); +static NS_DEFINE_IID(kCBlenderIID, NS_BLENDER_CID); +static NS_DEFINE_IID(kCDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID); +static NS_DEFINE_IID(kCDeviceContextSpecFactoryCID, NS_DEVICE_CONTEXT_SPEC_FACTORY_CID); + + +// VIEW +static NS_DEFINE_IID(kCViewManagerCID, NS_VIEW_MANAGER_CID); +static NS_DEFINE_IID(kCViewCID, NS_VIEW_CID); +static NS_DEFINE_IID(kCScrollingViewCID, NS_SCROLLING_VIEW_CID); + +// WEB +static NS_DEFINE_IID(kCWebShellCID, NS_WEB_SHELL_CID); +static NS_DEFINE_IID(kCDocLoaderServiceCID, NS_DOCUMENTLOADER_SERVICE_CID); +static NS_DEFINE_IID(kCThrobberCID, NS_THROBBER_CID); + +// PREF +static NS_DEFINE_CID(kCPrefCID, NS_PREF_CID); + +// PARSER +static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID); +static NS_DEFINE_CID(kCWellFormedDTDCID, NS_WELLFORMEDDTD_CID); + +// DOM +static NS_DEFINE_IID(kCDOMScriptObjectFactory, NS_DOM_SCRIPT_OBJECT_FACTORY_CID); +static NS_DEFINE_IID(kCScriptNameSetRegistry, NS_SCRIPT_NAMESET_REGISTRY_CID); + +// NETLIB +#ifndef NECKO +static NS_DEFINE_CID(kCNetServiceCID, NS_NETSERVICE_CID); +#else +static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); +#endif // NECKO + +// PLUGIN +static NS_DEFINE_IID(kCPluginHostCID, NS_PLUGIN_HOST_CID); +static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); +#ifdef OJI +static NS_DEFINE_CID(kCapsManagerCID, NS_CCAPSMANAGER_CID); +static NS_DEFINE_CID(kCLiveconnectCID, NS_CLIVECONNECT_CID); +static NS_DEFINE_CID(kCJVMManagerCID, NS_JVMMANAGER_CID); +#endif + +extern "C" void +NS_SetupRegistry() +{ + // WIDGET + nsComponentManager::RegisterComponentLib(kCLookAndFeelCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCWindowCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCVScrollbarCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCHScrollbarCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCDialogCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCLabelCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCButtonCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCComboBoxCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCFileWidgetCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCListBoxCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCRadioButtonCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCTextAreaCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCTextFieldCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCCheckButtonCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCChildCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCAppShellCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCToolkitCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kClipboardCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCTransferableCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kDataFlavorCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCXIFFormatConverterCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCDragServiceCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + //nsComponentManager::RegisterComponentLib(kCFileListTransferableCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCFontRetrieverServiceCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCMenuBarCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCMenuCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCMenuItemCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCContextMenuCID, NULL, NULL, WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kSoundCID, "Sound Services", "component://netscape/sound", WIDGET_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kFileSpecWithUICID, NS_FILESPECWITHUI_CLASSNAME, NS_FILESPECWITHUI_PROGID, WIDGET_DLL, PR_FALSE, PR_FALSE); + + // GFXWIN + nsComponentManager::RegisterComponentLib(kCRenderingContextIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCDeviceContextIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCFontMetricsIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCImageIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCRegionIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCBlenderIID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCDeviceContextSpecCID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCDeviceContextSpecFactoryCID, NULL, NULL, GFXWIN_DLL, PR_FALSE, PR_FALSE); + + // VIEW + nsComponentManager::RegisterComponentLib(kCViewManagerCID, NULL, NULL, VIEW_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCViewCID, NULL, NULL, VIEW_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCScrollingViewCID, NULL, NULL, VIEW_DLL, PR_FALSE, PR_FALSE); + + // WEB + nsComponentManager::RegisterComponentLib(kCWebShellCID, NULL, NULL, WEB_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCDocLoaderServiceCID, NULL, NULL, WEB_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCThrobberCID, NULL, NULL, WEB_DLL, PR_FALSE, PR_FALSE); + + // PREF + nsComponentManager::RegisterComponentLib(kCPrefCID, "Preferences Services", "component://netscape/preferences", PREF_DLL, PR_FALSE, PR_FALSE); + + // PARSER + nsComponentManager::RegisterComponentLib(kCParserCID, NULL, NULL, PARSER_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCWellFormedDTDCID, NULL, NULL, PARSER_DLL, PR_FALSE, PR_FALSE); + + // DOM + nsComponentManager::RegisterComponentLib(kCDOMScriptObjectFactory, NULL, NULL, DOM_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCScriptNameSetRegistry, NULL, NULL, DOM_DLL, PR_FALSE, PR_FALSE); + + // NETLIB +#ifndef NECKO + nsComponentManager::RegisterComponentLib(kCNetServiceCID, NULL, NULL, NETLIB_DLL, PR_FALSE, PR_FALSE); +#else + nsComponentManager::RegisterComponentLib(kIOServiceCID, NULL, NULL, NECKO_DLL, PR_FALSE, PR_FALSE); +#endif // NECKO + + // PLUGIN + nsComponentManager::RegisterComponentLib(kCPluginHostCID, NULL, NULL, PLUGIN_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCPluginManagerCID, NULL, NULL, PLUGIN_DLL, PR_FALSE, PR_FALSE); + +#ifdef OJI + nsComponentManager::RegisterComponentLib(kCapsManagerCID, NULL, NULL, CAPS_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCLiveconnectCID, NULL, NULL, LIVECONNECT_DLL, PR_FALSE, PR_FALSE); + nsComponentManager::RegisterComponentLib(kCJVMManagerCID, NULL, NULL, OJI_DLL, PR_FALSE, PR_FALSE); +#endif +}