gecko-dev/java/webclient/src_share/jni_util.h

383 строки
10 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (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/MPL/
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Mark Lin <mark.lin@eng.sun.com>
* Mark Goddard
* Ed Burns <edburns@acm.org>
* Ashutosh Kulkarni <ashuk@eng.sun.com>
* Ann Sunhachawee
* Jason Mawdsley <jason@macadamian.com>
* Louis-Philippe Gagnon <louisphilippe@macadamian.com>
*/
/**
* Util methods
*/
#ifndef jni_util_h
#define jni_util_h
#include <jni.h>
//
// added for 1.1.x compatibility
//
#ifdef JNI_VERSION_1_2
#ifndef JNI_VERSION
#define JNI_VERSION JNI_VERSION_1_2
#endif
#else
#ifndef JNI_VERSION_1_1
#define JNI_VERSION_1_1 0x00010001
#endif
#ifndef JNI_VERSION
#define JNI_VERSION JNI_VERSION_1_1
#endif
#endif // END: JNI_VERSION_1_2
//
// String constants, defined in jni_util.cpp
//
extern jobject SCREEN_X_KEY;
extern jobject SCREEN_Y_KEY;
extern jobject CLIENT_X_KEY;
extern jobject CLIENT_Y_KEY;
extern jobject ALT_KEY;
extern jobject CTRL_KEY;
extern jobject SHIFT_KEY;
extern jobject META_KEY;
extern jobject BUTTON_KEY;
extern jobject CLICK_COUNT_KEY;
extern jobject USER_NAME_KEY;
extern jobject PASSWORD_KEY;
extern jobject EDIT_FIELD_1_KEY;
extern jobject EDIT_FIELD_2_KEY;
extern jobject CHECKBOX_STATE_KEY;
extern jobject BUTTON_PRESSED_KEY;
extern jobject TRUE_VALUE;
extern jobject FALSE_VALUE;
extern jobject ONE_VALUE;
extern jobject TWO_VALUE;
extern jobject BM_ADD_DATE_VALUE;
extern jobject BM_LAST_MODIFIED_DATE_VALUE;
extern jobject BM_LAST_VISIT_DATE_VALUE;
extern jobject BM_NAME_VALUE;
extern jobject BM_URL_VALUE;
extern jobject BM_DESCRIPTION_VALUE;
extern jobject BM_IS_FOLDER_VALUE;
/**
* How to create a new listener type on the native side: <P>
* 1. add an entry in the gSupportedListenerInterfaces array defined in
* ns_util.cpp or ie_util.cpp <P>
* 2. add a corresponding entry in the LISTENER_CLASSES enum in
* jni_util.h <P>
* 3. add a jstring to the string constant list in
* jni_util.cpp, below.
* 4. Initialize this jstring constant in jni_util.cpp
* util_InitStringConstants() <P>
* 5. add an entry to the switch statement in NativeEventThread.cpp
* native{add,remove}Listener <P>
*/
/**
* We need one of these for each of the classes in
* gSupportedListenerInterfaces, defined in ns_util.cpp
*/
extern jstring DOCUMENT_LOAD_LISTENER_CLASSNAME;
extern jstring MOUSE_LISTENER_CLASSNAME;
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
//
// Listener support
//
// these index into the gSupportedListenerInterfaces array
typedef enum {
DOCUMENT_LOAD_LISTENER = 0,
MOUSE_LISTENER,
LISTENER_NOT_FOUND
} LISTENER_CLASSES;
// listener names and values, tightly correspond to java listener interfaces
#define DOCUMENT_LOAD_LISTENER_CLASSNAME_VALUE "org.mozilla.webclient.DocumentLoadListener"
#define MOUSE_LISTENER_CLASSNAME_VALUE "java.awt.event.MouseListener"
#define START_DOCUMENT_LOAD_EVENT_MASK_VALUE "START_DOCUMENT_LOAD_EVENT_MASK"
#define END_DOCUMENT_LOAD_EVENT_MASK_VALUE "END_DOCUMENT_LOAD_EVENT_MASK"
#define START_URL_LOAD_EVENT_MASK_VALUE "START_URL_LOAD_EVENT_MASK"
#define END_URL_LOAD_EVENT_MASK_VALUE "END_URL_LOAD_EVENT_MASK"
#define PROGRESS_URL_LOAD_EVENT_MASK_VALUE "PROGRESS_URL_LOAD_EVENT_MASK"
#define STATUS_URL_LOAD_EVENT_MASK_VALUE "STATUS_URL_LOAD_EVENT_MASK"
#define UNKNOWN_CONTENT_EVENT_MASK_VALUE "UNKNOWN_CONTENT_EVENT_MASK"
#define FETCH_INTERRUPT_EVENT_MASK_VALUE "FETCH_INTERRUPT_EVENT_MASK"
#define MOUSE_DOWN_EVENT_MASK_VALUE "MOUSE_DOWN_EVENT_MASK"
#define MOUSE_UP_EVENT_MASK_VALUE "MOUSE_UP_EVENT_MASK"
#define MOUSE_CLICK_EVENT_MASK_VALUE "MOUSE_CLICK_EVENT_MASK"
#define MOUSE_DOUBLE_CLICK_EVENT_MASK_VALUE "MOUSE_DOUBLE_CLICK_EVENT_MASK"
#define MOUSE_OVER_EVENT_MASK_VALUE "MOUSE_OVER_EVENT_MASK"
#define MOUSE_OUT_EVENT_MASK_VALUE "MOUSE_OUT_EVENT_MASK"
typedef enum {
START_DOCUMENT_LOAD_EVENT_MASK = 0,
END_DOCUMENT_LOAD_EVENT_MASK,
START_URL_LOAD_EVENT_MASK,
END_URL_LOAD_EVENT_MASK,
PROGRESS_URL_LOAD_EVENT_MASK,
STATUS_URL_LOAD_EVENT_MASK,
UNKNOWN_CONTENT_EVENT_MASK,
FETCH_INTERRUPT_EVENT_MASK,
NUMBER_OF_DOCUMENT_LOADER_MASK_NAMES
} DOCUMENT_LOADER_EVENT_MASK_NAMES;
typedef enum {
MOUSE_DOWN_EVENT_MASK = 0,
MOUSE_UP_EVENT_MASK,
MOUSE_CLICK_EVENT_MASK,
MOUSE_DOUBLE_CLICK_EVENT_MASK,
MOUSE_OVER_EVENT_MASK,
MOUSE_OUT_EVENT_MASK,
NUMBER_OF_DOM_MOUSE_LISTENER_MASK_NAMES
} DOM_MOUSE_LISTENER_EVENT_MASK_NAMES;
// BookmarkEntry string constants, must coincide with java
#define BM_ADD_DATE "AddDate"
#define BM_LAST_MODIFIED_DATE "LastModifiedDate"
#define BM_LAST_VISIT_DATE "LastVisitDate"
#define BM_NAME "Name"
#define BM_URL "URL"
#define BM_DESCRIPTION "Description"
#define BM_IS_FOLDER "IsFolder"
extern jlong DocumentLoader_maskValues [NUMBER_OF_DOCUMENT_LOADER_MASK_NAMES];
extern char *DocumentLoader_maskNames [NUMBER_OF_DOCUMENT_LOADER_MASK_NAMES + 1];
extern jlong DOMMouseListener_maskValues [NUMBER_OF_DOM_MOUSE_LISTENER_MASK_NAMES];
extern char *DOMMouseListener_maskNames [NUMBER_OF_DOM_MOUSE_LISTENER_MASK_NAMES + 1];
/**
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
* This struct contains all non browser specific per-window data. The
* WebShellInitContext struct, in the src_moz and src_ie directories
* contains a pointer to a ShareInitContext struct.
*/
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
struct ShareInitContext {
jclass propertiesClass;
};
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
extern JavaVM *gVm; // defined in jni_util.cpp
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
#ifndef nsnull
#define nsnull 0
#endif
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
void util_InitializeShareInitContext(void *initContext);
void util_DeallocateShareInitContext(void *initContext);
/**
* Initialize the above extern jobject string constants as jstrings
*/
jboolean util_InitStringConstants();
jboolean util_StringConstantsAreInitialized();
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
void util_ThrowExceptionToJava (JNIEnv * env, const char * message);
/**
* simply call the java method nativeEventOccurred on
* eventRegistrationImpl, passing webclientEventListener and eventType
* as arguments.
*/
void util_SendEventToJava(JNIEnv *env, jobject eventRegistrationImpl,
jobject webclientEventListener,
jstring eventListenerClassName,
jlong eventType,
jobject eventData);
char *util_GetCurrentThreadName(JNIEnv *env);
void util_DumpJavaStack(JNIEnv *env);
//
// Functions to wrap JNIEnv functions.
//
#include "jni_util_export.h"
jobject util_NewGlobalRef(JNIEnv *env, jobject toAddRef);
void util_DeleteGlobalRef(JNIEnv *env, jobject toAddRef);
jthrowable util_ExceptionOccurred(JNIEnv *env);
jint util_GetJavaVM(JNIEnv *env, JavaVM **vm);
jclass util_FindClass(JNIEnv *env, const char *fullyQualifiedClassName);
jobject util_CallStaticObjectMethodlongArg(JNIEnv *env, jclass clazz,
jmethodID methodID, jlong longArg);
jfieldID util_GetStaticFieldID(JNIEnv *env, jclass clazz,
const char *fieldName,
const char *signature);
jlong util_GetStaticLongField(JNIEnv *env, jclass clazz, jfieldID id);
jboolean util_IsInstanceOf(JNIEnv *env, jobject obj, jclass clazz);
jint util_GetIntValueFromInstance(JNIEnv *env, jobject instance,
const char *fieldName);
void util_SetIntValueForInstance(JNIEnv *env, jobject instance,
const char *fieldName, jint newValue);
bug: 20659 r=gbarney a=edburns This checkin adds java.awt.event.MouseListener support to webclient for mozilla. The following files are include in this checkin. "A" is new file "M" is modified file. A classes_spec/org/mozilla/webclient/WCMouseEvent.java A classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java A src_moz/DOMMouseListenerImpl.cpp A src_moz/DOMMouseListenerImpl.h A src_moz/dom_util.cpp A src_moz/dom_util.h M classes_spec/org/mozilla/webclient/EventRegistration.java M classes_spec/org/mozilla/webclient/test/EMWindow.java M classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java M classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java M src_moz/DocumentLoaderObserverImpl.cpp M src_moz/DocumentLoaderObserverImpl.h M src_moz/EventRegistration.cpp M src_moz/EventRegistration.h M src_moz/Makefile.solaris M src_moz/Makefile.win M src_moz/NativeEventThread.cpp M src_moz/NavigationImpl.cpp M src_moz/RDFTreeNode.cpp M src_moz/bal_util.cpp M src_moz/jni_util.cpp M src_moz/jni_util.h M src_moz/jni_util_export.cpp M src_moz/jni_util_export.h A classes_spec/org/mozilla/webclient/WCMouseEvent.java * <P> This java.awt.event.MouseEvent subclass allows the user to access the * WebclientEvent. This eventData of this WebclientEvent, if non-null, * is a java.util.Properties instance that contains information about * this event. </P> * <P>The following are some interesting keys:</P> * <UL> * <LI> href * </LI> * <LI> #text * </LI> * </UL> A classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java * This class wraps the user provided instance of * java.awt.event.MouseListener so it can be installed as a * WebclientEventListener. Note that we implement MouseListener so we * can be detected by the webclient event system. We don't do anything * with these methods here, though. A src_moz/DOMMouseListenerImpl.cpp A src_moz/DOMMouseListenerImpl.h * This class is the shim between the mozilla listener event system for * mouse events and the java MouseListener interface. * For each of the Mouse* methods, we call the appropriate method in java. * See the implementation of MouseOver for an example. * For each mouseEvent, we create a Properties object containing * information about the event. We use methods in dom_util to do this. A src_moz/dom_util.cpp A src_moz/dom_util.h /** * Methods to simplify webclient accessing the mozilla DOM. */ M classes_spec/org/mozilla/webclient/EventRegistration.java Added support for java.awt.event.MouseListener M classes_spec/org/mozilla/webclient/test/EMWindow.java Implemented simle MouseListener M classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java Added support for java.awt.event.MouseListener M classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java Added support for java.awt.event.MouseListener M src_moz/DocumentLoaderObserverImpl.cpp M src_moz/DocumentLoaderObserverImpl.h * We define a local IID to allow the addDocumentLoadListener and * addMouseListener functions in EventRegistration.{h,cpp} to * interrogate the currently installed DocumentLoaderObserver instance * in mozilla. */ #define NS_IDOCLOADEROBSERVERIMPL_IID_STR "fdadb2e0-3028-11d4-8a96-0080c7b9c5ba" #define NS_IDOCLOADEROBSERVERIMPL_IID {0xfdadb2e0, 0x3028, 0x11d4, { 0x8a, 0x96, 0x00, 0x80, 0xc7, 0xb9, 0xc5, 0xba }} /** * This class is the shim between the mozilla listener event system for * document load events and the java DocumentLoadListener interface. * For each of the On* methods, we call the appropriate method in java. * See the implementation of OnEndDocumentLoad for an example. * A DocumentLoaderObserverImpl instance has a "jobject target", which * is the Java object that should ultimately receive the events. This * target will be null if the user just wants to listen for mouse * events. It willl be non-null if the user wants to listen for * DocumentLoad events. * It also hosts a nsIDOMMouseListener instance, which piggybacks on the * nsIDocumentLoaderObserver instance. M src_moz/EventRegistration.cpp M src_moz/EventRegistration.h Add support for MouseListener M src_moz/Makefile.win Added classes for MouseListener and Dom access M src_moz/NativeEventThread.cpp Added support for MouseListener M src_moz/NavigationImpl.cpp Added call to ReleaseStringChars for bal case. M src_moz/RDFTreeNode.cpp Added call to ReleaseStringChars for bal case. M src_moz/bal_util.cpp Added #include "wchar.h" so this file compiles on Solaris. M src_moz/jni_util.cpp Added implementations for util_CreatePropertiesObject, util_DestroyPropertiesObject and util_StoreIntoPropertiesObject. M src_moz/jni_util.h /** * A JNI wrapper to create a java.util.Properties object, or the * equivalent object in the BAL case. */ jobject util_CreatePropertiesObject(JNIEnv *env, jobject reserved_NotUsed); /** * A JNI wrapper to destroy the object from CreatePropertiesObject */ void util_DestroyPropertiesObject(JNIEnv *env, jobject propertiesObject, jobject reserved_NotUsed); /** * A JNI wrapper for storing a name/value pair into the Properties * object created by CreatePropertiesObject */ void util_StoreIntoPropertiesObject(JNIEnv *env, jobject propertiesObject, jobject name, jobject value); M src_moz/jni_util_export.cpp M src_moz/jni_util_export.h Added functions for allowing the BAL user to specify functions for {creating, destroying, setting values into} properties objects.
2000-05-26 03:51:51 +04:00
/**
* A JNI wrapper to create a java.util.Properties object, or the
* equivalent object in the BAL case.
*/
jobject util_CreatePropertiesObject(JNIEnv *env, jobject reserved_NotUsed);
/**
* A JNI wrapper to destroy the object from CreatePropertiesObject
*/
void util_DestroyPropertiesObject(JNIEnv *env, jobject propertiesObject,
jobject reserved_NotUsed);
bug 40330 a=edburns This checkin mainly does two things: 1. Correctly populates the java.awt.event.MouseEvent subclass with the correct modifiers, x, y, and clickCount for the mozilla mouse event. 2. Adds a performance optimization: previously, every mouse event was causing a new instance of java.util.Properties to be created. Now, only one Properties instance is created per-page, and it is cleared on each mouse event. Also, I made the DOMMouseListenerImpl constructor initialize the refCount to 0. This allows the object to be correctly deleted. M classes_spec/org/mozilla/webclient/test/EMWindow.java M classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java M src_moz/DOMMouseListenerImpl.cpp M src_moz/DOMMouseListenerImpl.h M src_moz/WindowControlImpl.cpp M src_moz/jni_util.cpp M src_moz/jni_util.h M src_moz/jni_util_export.cpp M src_moz/jni_util_export.h M classes_spec/org/mozilla/webclient/test/EMWindow.java * Added test code for MouseListener properties: buttons, modifiers, etc. M classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java * Added support for mouse modifiers. Pull values out of the hash table, put them in the MouseEvent constructor. M src_moz/DOMMouseListenerImpl.cpp * Modified constructors so they initialize all ivars. * changed usage model of properties object to share the lifetime of the DOMMouseListenerImpl instance. Needed to make use of the new function util_ClearPropertiesObject() to do this. Now we have only one call to util_DestroyPropertiesObject(), in the DOMMouseListenerImpl destructor. M src_moz/DOMMouseListenerImpl.h > virtual ~DOMMouseListenerImpl(); > 98a101 > protected: 100a104,105 > > void JNICALL addMouseEventDataToProperties(nsIDOMEvent *aMouseEvent); M src_moz/WindowControlImpl.cpp * Initialize new WebShellInitConext member propertiesClass to nsnull M src_moz/jni_util.cpp * Added util_ClearPropertiesObject() an optimization. * Store the jclass for java/util/Properties in an element in WebShellInitContext. This prevents us from having to do FindClass each time a mouse event occurs. * Added a parameter to util_StoreIntoPropertiesObject. M src_moz/jni_util.h * Added propertiesClass to WebShellInitContext * Added new method ClearPropertiesObject * Added new last argument to DestroyPropertiesObject M src_moz/jni_util_export.cpp M src_moz/jni_util_export.h * Added function pointer for util_ClearPropertiesObject.
2000-06-08 06:16:06 +04:00
/**
* A JNI wrapper to clear the object from CreatePropertiesObject
*/
void util_ClearPropertiesObject(JNIEnv *env, jobject propertiesObject,
jobject reserved_NotUsed);
bug: 20659 r=gbarney a=edburns This checkin adds java.awt.event.MouseListener support to webclient for mozilla. The following files are include in this checkin. "A" is new file "M" is modified file. A classes_spec/org/mozilla/webclient/WCMouseEvent.java A classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java A src_moz/DOMMouseListenerImpl.cpp A src_moz/DOMMouseListenerImpl.h A src_moz/dom_util.cpp A src_moz/dom_util.h M classes_spec/org/mozilla/webclient/EventRegistration.java M classes_spec/org/mozilla/webclient/test/EMWindow.java M classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java M classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java M src_moz/DocumentLoaderObserverImpl.cpp M src_moz/DocumentLoaderObserverImpl.h M src_moz/EventRegistration.cpp M src_moz/EventRegistration.h M src_moz/Makefile.solaris M src_moz/Makefile.win M src_moz/NativeEventThread.cpp M src_moz/NavigationImpl.cpp M src_moz/RDFTreeNode.cpp M src_moz/bal_util.cpp M src_moz/jni_util.cpp M src_moz/jni_util.h M src_moz/jni_util_export.cpp M src_moz/jni_util_export.h A classes_spec/org/mozilla/webclient/WCMouseEvent.java * <P> This java.awt.event.MouseEvent subclass allows the user to access the * WebclientEvent. This eventData of this WebclientEvent, if non-null, * is a java.util.Properties instance that contains information about * this event. </P> * <P>The following are some interesting keys:</P> * <UL> * <LI> href * </LI> * <LI> #text * </LI> * </UL> A classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java * This class wraps the user provided instance of * java.awt.event.MouseListener so it can be installed as a * WebclientEventListener. Note that we implement MouseListener so we * can be detected by the webclient event system. We don't do anything * with these methods here, though. A src_moz/DOMMouseListenerImpl.cpp A src_moz/DOMMouseListenerImpl.h * This class is the shim between the mozilla listener event system for * mouse events and the java MouseListener interface. * For each of the Mouse* methods, we call the appropriate method in java. * See the implementation of MouseOver for an example. * For each mouseEvent, we create a Properties object containing * information about the event. We use methods in dom_util to do this. A src_moz/dom_util.cpp A src_moz/dom_util.h /** * Methods to simplify webclient accessing the mozilla DOM. */ M classes_spec/org/mozilla/webclient/EventRegistration.java Added support for java.awt.event.MouseListener M classes_spec/org/mozilla/webclient/test/EMWindow.java Implemented simle MouseListener M classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java Added support for java.awt.event.MouseListener M classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java Added support for java.awt.event.MouseListener M src_moz/DocumentLoaderObserverImpl.cpp M src_moz/DocumentLoaderObserverImpl.h * We define a local IID to allow the addDocumentLoadListener and * addMouseListener functions in EventRegistration.{h,cpp} to * interrogate the currently installed DocumentLoaderObserver instance * in mozilla. */ #define NS_IDOCLOADEROBSERVERIMPL_IID_STR "fdadb2e0-3028-11d4-8a96-0080c7b9c5ba" #define NS_IDOCLOADEROBSERVERIMPL_IID {0xfdadb2e0, 0x3028, 0x11d4, { 0x8a, 0x96, 0x00, 0x80, 0xc7, 0xb9, 0xc5, 0xba }} /** * This class is the shim between the mozilla listener event system for * document load events and the java DocumentLoadListener interface. * For each of the On* methods, we call the appropriate method in java. * See the implementation of OnEndDocumentLoad for an example. * A DocumentLoaderObserverImpl instance has a "jobject target", which * is the Java object that should ultimately receive the events. This * target will be null if the user just wants to listen for mouse * events. It willl be non-null if the user wants to listen for * DocumentLoad events. * It also hosts a nsIDOMMouseListener instance, which piggybacks on the * nsIDocumentLoaderObserver instance. M src_moz/EventRegistration.cpp M src_moz/EventRegistration.h Add support for MouseListener M src_moz/Makefile.win Added classes for MouseListener and Dom access M src_moz/NativeEventThread.cpp Added support for MouseListener M src_moz/NavigationImpl.cpp Added call to ReleaseStringChars for bal case. M src_moz/RDFTreeNode.cpp Added call to ReleaseStringChars for bal case. M src_moz/bal_util.cpp Added #include "wchar.h" so this file compiles on Solaris. M src_moz/jni_util.cpp Added implementations for util_CreatePropertiesObject, util_DestroyPropertiesObject and util_StoreIntoPropertiesObject. M src_moz/jni_util.h /** * A JNI wrapper to create a java.util.Properties object, or the * equivalent object in the BAL case. */ jobject util_CreatePropertiesObject(JNIEnv *env, jobject reserved_NotUsed); /** * A JNI wrapper to destroy the object from CreatePropertiesObject */ void util_DestroyPropertiesObject(JNIEnv *env, jobject propertiesObject, jobject reserved_NotUsed); /** * A JNI wrapper for storing a name/value pair into the Properties * object created by CreatePropertiesObject */ void util_StoreIntoPropertiesObject(JNIEnv *env, jobject propertiesObject, jobject name, jobject value); M src_moz/jni_util_export.cpp M src_moz/jni_util_export.h Added functions for allowing the BAL user to specify functions for {creating, destroying, setting values into} properties objects.
2000-05-26 03:51:51 +04:00
/**
* A JNI wrapper for storing a name/value pair into the Properties
* object created by CreatePropertiesObject
*/
void util_StoreIntoPropertiesObject(JNIEnv *env, jobject propertiesObject,
bug 40330 a=edburns This checkin mainly does two things: 1. Correctly populates the java.awt.event.MouseEvent subclass with the correct modifiers, x, y, and clickCount for the mozilla mouse event. 2. Adds a performance optimization: previously, every mouse event was causing a new instance of java.util.Properties to be created. Now, only one Properties instance is created per-page, and it is cleared on each mouse event. Also, I made the DOMMouseListenerImpl constructor initialize the refCount to 0. This allows the object to be correctly deleted. M classes_spec/org/mozilla/webclient/test/EMWindow.java M classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java M src_moz/DOMMouseListenerImpl.cpp M src_moz/DOMMouseListenerImpl.h M src_moz/WindowControlImpl.cpp M src_moz/jni_util.cpp M src_moz/jni_util.h M src_moz/jni_util_export.cpp M src_moz/jni_util_export.h M classes_spec/org/mozilla/webclient/test/EMWindow.java * Added test code for MouseListener properties: buttons, modifiers, etc. M classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java * Added support for mouse modifiers. Pull values out of the hash table, put them in the MouseEvent constructor. M src_moz/DOMMouseListenerImpl.cpp * Modified constructors so they initialize all ivars. * changed usage model of properties object to share the lifetime of the DOMMouseListenerImpl instance. Needed to make use of the new function util_ClearPropertiesObject() to do this. Now we have only one call to util_DestroyPropertiesObject(), in the DOMMouseListenerImpl destructor. M src_moz/DOMMouseListenerImpl.h > virtual ~DOMMouseListenerImpl(); > 98a101 > protected: 100a104,105 > > void JNICALL addMouseEventDataToProperties(nsIDOMEvent *aMouseEvent); M src_moz/WindowControlImpl.cpp * Initialize new WebShellInitConext member propertiesClass to nsnull M src_moz/jni_util.cpp * Added util_ClearPropertiesObject() an optimization. * Store the jclass for java/util/Properties in an element in WebShellInitContext. This prevents us from having to do FindClass each time a mouse event occurs. * Added a parameter to util_StoreIntoPropertiesObject. M src_moz/jni_util.h * Added propertiesClass to WebShellInitContext * Added new method ClearPropertiesObject * Added new last argument to DestroyPropertiesObject M src_moz/jni_util_export.cpp M src_moz/jni_util_export.h * Added function pointer for util_ClearPropertiesObject.
2000-06-08 06:16:06 +04:00
jobject name, jobject value,
jobject reserved);
bug: 20659 r=gbarney a=edburns This checkin adds java.awt.event.MouseListener support to webclient for mozilla. The following files are include in this checkin. "A" is new file "M" is modified file. A classes_spec/org/mozilla/webclient/WCMouseEvent.java A classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java A src_moz/DOMMouseListenerImpl.cpp A src_moz/DOMMouseListenerImpl.h A src_moz/dom_util.cpp A src_moz/dom_util.h M classes_spec/org/mozilla/webclient/EventRegistration.java M classes_spec/org/mozilla/webclient/test/EMWindow.java M classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java M classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java M src_moz/DocumentLoaderObserverImpl.cpp M src_moz/DocumentLoaderObserverImpl.h M src_moz/EventRegistration.cpp M src_moz/EventRegistration.h M src_moz/Makefile.solaris M src_moz/Makefile.win M src_moz/NativeEventThread.cpp M src_moz/NavigationImpl.cpp M src_moz/RDFTreeNode.cpp M src_moz/bal_util.cpp M src_moz/jni_util.cpp M src_moz/jni_util.h M src_moz/jni_util_export.cpp M src_moz/jni_util_export.h A classes_spec/org/mozilla/webclient/WCMouseEvent.java * <P> This java.awt.event.MouseEvent subclass allows the user to access the * WebclientEvent. This eventData of this WebclientEvent, if non-null, * is a java.util.Properties instance that contains information about * this event. </P> * <P>The following are some interesting keys:</P> * <UL> * <LI> href * </LI> * <LI> #text * </LI> * </UL> A classes_spec/org/mozilla/webclient/wrapper_native/WCMouseListenerImpl.java * This class wraps the user provided instance of * java.awt.event.MouseListener so it can be installed as a * WebclientEventListener. Note that we implement MouseListener so we * can be detected by the webclient event system. We don't do anything * with these methods here, though. A src_moz/DOMMouseListenerImpl.cpp A src_moz/DOMMouseListenerImpl.h * This class is the shim between the mozilla listener event system for * mouse events and the java MouseListener interface. * For each of the Mouse* methods, we call the appropriate method in java. * See the implementation of MouseOver for an example. * For each mouseEvent, we create a Properties object containing * information about the event. We use methods in dom_util to do this. A src_moz/dom_util.cpp A src_moz/dom_util.h /** * Methods to simplify webclient accessing the mozilla DOM. */ M classes_spec/org/mozilla/webclient/EventRegistration.java Added support for java.awt.event.MouseListener M classes_spec/org/mozilla/webclient/test/EMWindow.java Implemented simle MouseListener M classes_spec/org/mozilla/webclient/wrapper_native/EventRegistrationImpl.java Added support for java.awt.event.MouseListener M classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java Added support for java.awt.event.MouseListener M src_moz/DocumentLoaderObserverImpl.cpp M src_moz/DocumentLoaderObserverImpl.h * We define a local IID to allow the addDocumentLoadListener and * addMouseListener functions in EventRegistration.{h,cpp} to * interrogate the currently installed DocumentLoaderObserver instance * in mozilla. */ #define NS_IDOCLOADEROBSERVERIMPL_IID_STR "fdadb2e0-3028-11d4-8a96-0080c7b9c5ba" #define NS_IDOCLOADEROBSERVERIMPL_IID {0xfdadb2e0, 0x3028, 0x11d4, { 0x8a, 0x96, 0x00, 0x80, 0xc7, 0xb9, 0xc5, 0xba }} /** * This class is the shim between the mozilla listener event system for * document load events and the java DocumentLoadListener interface. * For each of the On* methods, we call the appropriate method in java. * See the implementation of OnEndDocumentLoad for an example. * A DocumentLoaderObserverImpl instance has a "jobject target", which * is the Java object that should ultimately receive the events. This * target will be null if the user just wants to listen for mouse * events. It willl be non-null if the user wants to listen for * DocumentLoad events. * It also hosts a nsIDOMMouseListener instance, which piggybacks on the * nsIDocumentLoaderObserver instance. M src_moz/EventRegistration.cpp M src_moz/EventRegistration.h Add support for MouseListener M src_moz/Makefile.win Added classes for MouseListener and Dom access M src_moz/NativeEventThread.cpp Added support for MouseListener M src_moz/NavigationImpl.cpp Added call to ReleaseStringChars for bal case. M src_moz/RDFTreeNode.cpp Added call to ReleaseStringChars for bal case. M src_moz/bal_util.cpp Added #include "wchar.h" so this file compiles on Solaris. M src_moz/jni_util.cpp Added implementations for util_CreatePropertiesObject, util_DestroyPropertiesObject and util_StoreIntoPropertiesObject. M src_moz/jni_util.h /** * A JNI wrapper to create a java.util.Properties object, or the * equivalent object in the BAL case. */ jobject util_CreatePropertiesObject(JNIEnv *env, jobject reserved_NotUsed); /** * A JNI wrapper to destroy the object from CreatePropertiesObject */ void util_DestroyPropertiesObject(JNIEnv *env, jobject propertiesObject, jobject reserved_NotUsed); /** * A JNI wrapper for storing a name/value pair into the Properties * object created by CreatePropertiesObject */ void util_StoreIntoPropertiesObject(JNIEnv *env, jobject propertiesObject, jobject name, jobject value); M src_moz/jni_util_export.cpp M src_moz/jni_util_export.h Added functions for allowing the BAL user to specify functions for {creating, destroying, setting values into} properties objects.
2000-05-26 03:51:51 +04:00
/**
* A JNI wrapper to get a value for a name out of a PropertiesObject
* created by CreatePropertiesObject
*/
jobject util_GetFromPropertiesObject(JNIEnv *, jobject propertiesObject,
jobject name, jobject reserved);
/**
* A JNI wrapper to get a boolean value for a name out of a PropertiesObject
* created by CreatePropertiesObject
*/
jboolean util_GetBoolFromPropertiesObject(JNIEnv *, jobject propertiesObject,
jobject name, jobject reserved);
/**
* A JNI wrapper to get an int value for a name out of a PropertiesObject
* created by CreatePropertiesObject
*/
jint util_GetIntFromPropertiesObject(JNIEnv *, jobject propertiesObject,
jobject name, jobject reserved);
bug=47357 a=edburns r=ashuk This change creates a new directory, java/webclient/src_share, that contains the code that will be used in both src_moz and src_ie, and any other native browser wrapping implementations. Here are the steps I followed to implement this change. 1. Create a new directory java/webclient/src_share 2. Move all jni_util*.* files from src_moz into src_share 3. Make it so src_share compiles into a new .lib src_share has no netscape dependencies. Any functionality that depended on ns dependencies was kept in src_moz. In this case, we have a function prototype only in src_share, with the implementation in src_moz. We did this for nsHashtable. The other trick was for things in WebShellInitContext that had nothing to do with Netscape. This case was accomodated by creating a new struct, ShareInitContext, that contains all WebShellInitContext members that have nothing to do with Netscape. Currently this is just jobject propertiesClass. I modified the WebShellInitContext struct to contain a ShareContext struct as its last member. There are two new methods in jni_util.h that allow for the initialization and deallocation of the members of the ShareContext struct. 4. Make it so src_moz uses the new .lib to provide the jni_util behavior a. Create ns_util* files that include ../src_share/jni_util* files appropriately. The only tricky part was for things in jni_util.h that Here's the list of files in this change. cvs -z3 -n update (in directory D:\Projects\mozilla\java\webclient) cvs server: Updating . M Makefile.win // added src_share to DIRS M src_moz/BookmarksImpl.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.cpp // include ns_util instead of jni_util M src_moz/CBrowserContainer.h // include ns_util instead of jni_util M src_moz/CurrentPageImpl.cpp // include ns_util instead of jni_util M src_moz/HistoryImpl.cpp // include ns_util instead of jni_util M src_moz/Makefile.win // include ns_util instead of jni_util M src_moz/NativeEventThread.cpp // include ns_util instead of jni_util M src_moz/NavigationImpl.cpp // include ns_util instead of jni_util M src_moz/RDFEnumeration.cpp // include ns_util instead of jni_util M src_moz/RDFTreeNode.cpp // include ns_util instead of jni_util M src_moz/WindowControlImpl.cpp // include ns_util instead of jni_util // also use new util_InitShareContext // function M src_moz/WrapperFactoryImpl.cpp // include ns_util instead of jni_util R src_moz/jni_util.cpp // moved to ../src_share R src_moz/jni_util.h // moved to ../src_share R src_moz/jni_util_export.cpp // moved to ../src_share R src_moz/jni_util_export.h // moved to ../src_share M src_moz/nsActions.cpp // include ns_util instead of jni_util // also use new util_DeallocateShareContext M src_moz/nsActions.h // include ns_util instead of jni_util A src_moz/ns_util.cpp // include jni_util.h A src_moz/ns_util.h // include jni_util.h, changes to // WebshellInitContext struct A src_moz/ns_util_export.cpp // provide impls for methods in // jni_util_export.h A src_share/Makefile.win A src_share/bal_util.cpp A src_share/bal_util.h A src_share/jni_util.cpp A src_share/jni_util.h A src_share/jni_util_export.cpp A src_share/jni_util_export.h *****CVS exited normally with code 0*****
2000-08-04 01:32:54 +04:00
//
// Functions provided by the browser specific native code
//
void util_LogMessage(int level, const char *fmt);
void util_Assert(void *test);
//
// Functions from secret JDK files
//
JNIEXPORT jvalue JNICALL
JNU_CallMethodByName(JNIEnv *env,
jboolean *hasException,
jobject obj,
const char *name,
const char *signature,
...);
JNIEXPORT jvalue JNICALL
JNU_CallMethodByNameV(JNIEnv *env,
jboolean *hasException,
jobject obj,
const char *name,
const char *signature,
va_list args);
JNIEXPORT void * JNICALL
JNU_GetEnv(JavaVM *vm, jint version);
#endif // jni_util_h