-----------------------------------------------------------------------
jethro 5Oct98
We are not properly cloning native data when AWTEvents are cloned.
Cloning is used extensively with lightweight components, and not
cloning the private data is causing drag and drop to fail on
Motif (see bug 4177037). To make this work everywhere, we need
a native copyDataFieldInto() method on all platforms, including
win32.
The java method signature looks like this:
private native void copyDataFieldInto(AWTEvent that);
The native method looks something like this:
/*
* Class: java_awt_AWTEvent
* Method: copyDataFieldInto
* Signature: ()V
*
* Allocates a copy of the data instance variable and copies it
* from thisEvent into thatEvent. If data is null, thatEvent's
* data field is also set to NULL.
*/
JNIEXPORT void JNICALL
Java_java_awt_AWTEvent_copyDataFieldInto
(JNIEnv *env, jobject thisEvent, jobject thatEvent) {
/* on win32, AWTEvent.data is of type (MSG*) */
MSG *pThisData = NULL;
MSG *pThatData = NULL;
AWT_LOCK();
pThisData = (void *)(*env)->GetLongField(env, thisEvent, awtEventIDs.data);
if (pThisData != NULL) {
/*****
***** ALLOCATE/CLONE pThisData to pThatData
*****/
}
(*env)->SetLongField(env, thatEvent, awtEventIDs.data, (jlong)pThatData);
AWT_UNLOCK();
} /* AWTEvent_copyDataFieldInto() */
-----------------------------------------------------------------------