8165543: Better window framing
Reviewed-by: prr, ssadetsky, mschoene
This commit is contained in:
parent
fea6f71dae
commit
2b71ce6a46
@ -57,15 +57,6 @@ typedef AwtObject* PDATA;
|
||||
} \
|
||||
}
|
||||
|
||||
#define JNI_CHECK_PEER_GOTO(peer, where) { \
|
||||
JNI_CHECK_NULL_GOTO(peer, "peer", where); \
|
||||
pData = JNI_GET_PDATA(peer); \
|
||||
if (pData == NULL) { \
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \
|
||||
goto where; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define JNI_CHECK_NULL_RETURN(obj, msg) { \
|
||||
if (obj == NULL) { \
|
||||
env->ExceptionClear(); \
|
||||
@ -74,15 +65,6 @@ typedef AwtObject* PDATA;
|
||||
} \
|
||||
}
|
||||
|
||||
#define JNI_CHECK_PEER_RETURN(peer) { \
|
||||
JNI_CHECK_NULL_RETURN(peer, "peer"); \
|
||||
pData = JNI_GET_PDATA(peer); \
|
||||
if (pData == NULL) { \
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define JNI_CHECK_PEER_CREATION_RETURN(peer) { \
|
||||
if (peer == NULL ) { \
|
||||
return; \
|
||||
@ -109,6 +91,33 @@ typedef AwtObject* PDATA;
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* This macros must be used under SyncCall or on the Toolkit thread.
|
||||
*/
|
||||
#define JNI_CHECK_PEER_GOTO(peer, where) { \
|
||||
JNI_CHECK_NULL_GOTO(peer, "peer", where); \
|
||||
pData = JNI_GET_PDATA(peer); \
|
||||
if (pData == NULL) { \
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \
|
||||
goto where; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* This macros must be used under SyncCall or on the Toolkit thread.
|
||||
*/
|
||||
#define JNI_CHECK_PEER_RETURN(peer) { \
|
||||
JNI_CHECK_NULL_RETURN(peer, "peer"); \
|
||||
pData = JNI_GET_PDATA(peer); \
|
||||
if (pData == NULL) { \
|
||||
THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* This macros must be used under SyncCall or on the Toolkit thread.
|
||||
*/
|
||||
#define JNI_CHECK_PEER_RETURN_NULL(peer) { \
|
||||
JNI_CHECK_NULL_RETURN_NULL(peer, "peer"); \
|
||||
pData = JNI_GET_PDATA(peer); \
|
||||
@ -118,6 +127,9 @@ typedef AwtObject* PDATA;
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* This macros must be used under SyncCall or on the Toolkit thread.
|
||||
*/
|
||||
#define JNI_CHECK_PEER_RETURN_VAL(peer, val) { \
|
||||
JNI_CHECK_NULL_RETURN_VAL(peer, "peer", val); \
|
||||
pData = JNI_GET_PDATA(peer); \
|
||||
|
@ -65,6 +65,7 @@ LPCTSTR AwtButton::GetClassName() {
|
||||
/* Create a new AwtButton object and window. */
|
||||
AwtButton* AwtButton::Create(jobject self, jobject parent)
|
||||
{
|
||||
DASSERT(AwtToolkit::IsMainThread());
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
/* the result */
|
||||
@ -88,7 +89,6 @@ AwtButton* AwtButton::Create(jobject self, jobject parent)
|
||||
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
awtParent = (AwtCanvas*)pData;
|
||||
JNI_CHECK_NULL_GOTO(awtParent, "awtParent", done);
|
||||
|
||||
target = env->GetObjectField(self, AwtObject::targetID);
|
||||
JNI_CHECK_NULL_GOTO(target, "target", done);
|
||||
@ -375,9 +375,6 @@ Java_sun_awt_windows_WButtonPeer_setLabel(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(self);
|
||||
|
||||
SetLabelStruct *sls = new SetLabelStruct;
|
||||
sls->button = env->NewGlobalRef(self);
|
||||
sls->label = (label != NULL) ? (jstring)env->NewGlobalRef(label) : NULL;
|
||||
@ -399,14 +396,9 @@ Java_sun_awt_windows_WButtonPeer_create(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(parent);
|
||||
|
||||
AwtToolkit::CreateComponent(
|
||||
self, parent, (AwtToolkit::ComponentFactory)AwtButton::Create);
|
||||
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,7 @@ LPCTSTR AwtCanvas::GetClassName() {
|
||||
*/
|
||||
AwtCanvas* AwtCanvas::Create(jobject self, jobject hParent)
|
||||
{
|
||||
DASSERT(AwtToolkit::IsMainThread());
|
||||
TRY;
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
@ -74,12 +75,11 @@ AwtCanvas* AwtCanvas::Create(jobject self, jobject hParent)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PDATA pData;
|
||||
AwtComponent* parent;
|
||||
|
||||
JNI_CHECK_NULL_GOTO(hParent, "null hParent", done);
|
||||
|
||||
parent = (AwtComponent*)JNI_GET_PDATA(hParent);
|
||||
JNI_CHECK_NULL_GOTO(parent, "null parent", done);
|
||||
JNI_CHECK_PEER_GOTO(hParent, done);
|
||||
parent = (AwtCanvas*)pData;
|
||||
|
||||
target = env->GetObjectField(self, AwtObject::targetID);
|
||||
JNI_CHECK_NULL_GOTO(target, "null target", done);
|
||||
@ -236,12 +236,9 @@ Java_sun_awt_windows_WCanvasPeer_create(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(parent);
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtCanvas::Create);
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ LPCTSTR AwtCheckbox::GetClassName() {
|
||||
|
||||
AwtCheckbox* AwtCheckbox::Create(jobject peer, jobject parent)
|
||||
{
|
||||
DASSERT(AwtToolkit::IsMainThread());
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
jstring label = NULL;
|
||||
@ -81,11 +82,10 @@ AwtCheckbox* AwtCheckbox::Create(jobject peer, jobject parent)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PDATA pData;
|
||||
AwtComponent* awtParent;
|
||||
JNI_CHECK_NULL_GOTO(parent, "null parent", done);
|
||||
|
||||
awtParent = (AwtComponent*)JNI_GET_PDATA(parent);
|
||||
JNI_CHECK_NULL_GOTO(awtParent, "null awtParent", done);
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
awtParent = (AwtCanvas*)pData;
|
||||
|
||||
target = env->GetObjectField(peer, AwtObject::targetID);
|
||||
JNI_CHECK_NULL_GOTO(target, "null target", done);
|
||||
@ -669,11 +669,10 @@ Java_sun_awt_windows_WCheckboxPeer_create(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(parent);
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtCheckbox::Create);
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -104,7 +104,7 @@ void AwtChoice::Dispose() {
|
||||
}
|
||||
|
||||
AwtChoice* AwtChoice::Create(jobject peer, jobject parent) {
|
||||
|
||||
DASSERT(AwtToolkit::IsMainThread());
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
jobject target = NULL;
|
||||
@ -115,12 +115,10 @@ AwtChoice* AwtChoice::Create(jobject peer, jobject parent) {
|
||||
if (env->EnsureLocalCapacity(1) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
PDATA pData;
|
||||
AwtCanvas* awtParent;
|
||||
|
||||
JNI_CHECK_NULL_GOTO(parent, "null parent", done);
|
||||
|
||||
awtParent = (AwtCanvas*)JNI_GET_PDATA(parent);
|
||||
JNI_CHECK_NULL_GOTO(awtParent, "null awtParent", done);
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
awtParent = (AwtCanvas*)pData;
|
||||
|
||||
target = env->GetObjectField(peer, AwtObject::targetID);
|
||||
JNI_CHECK_NULL_GOTO(target, "null target", done);
|
||||
@ -830,12 +828,9 @@ Java_sun_awt_windows_WChoicePeer_create(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(parent);
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtChoice::Create);
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
@ -151,6 +151,11 @@ struct SetFocusStruct {
|
||||
jobject component;
|
||||
jboolean doSetFocus;
|
||||
};
|
||||
// Struct for _SetParent function
|
||||
struct SetParentStruct {
|
||||
jobject component;
|
||||
jobject parentComp;
|
||||
};
|
||||
/************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -269,9 +274,6 @@ AwtComponent::~AwtComponent()
|
||||
{
|
||||
DASSERT(AwtToolkit::IsMainThread());
|
||||
|
||||
/* Disconnect all links. */
|
||||
UnlinkObjects();
|
||||
|
||||
/*
|
||||
* All the messages for this component are processed, native
|
||||
* resources are freed, and Java object is not connected to
|
||||
@ -283,6 +285,8 @@ AwtComponent::~AwtComponent()
|
||||
|
||||
void AwtComponent::Dispose()
|
||||
{
|
||||
DASSERT(AwtToolkit::IsMainThread());
|
||||
|
||||
// NOTE: in case the component/toplevel was focused, Java should
|
||||
// have already taken care of proper transferring it or clearing.
|
||||
|
||||
@ -301,8 +305,10 @@ void AwtComponent::Dispose()
|
||||
/* Release global ref to input method */
|
||||
SetInputMethod(NULL, TRUE);
|
||||
|
||||
if (m_childList != NULL)
|
||||
if (m_childList != NULL) {
|
||||
delete m_childList;
|
||||
m_childList = NULL;
|
||||
}
|
||||
|
||||
DestroyDropTarget();
|
||||
ReleaseDragCapture(0);
|
||||
@ -325,6 +331,9 @@ void AwtComponent::Dispose()
|
||||
m_brushBackground = NULL;
|
||||
}
|
||||
|
||||
/* Disconnect all links. */
|
||||
UnlinkObjects();
|
||||
|
||||
if (m_bPauseDestroy) {
|
||||
// AwtComponent::WmNcDestroy could be released now
|
||||
m_bPauseDestroy = FALSE;
|
||||
@ -6288,21 +6297,36 @@ ret:
|
||||
return result;
|
||||
}
|
||||
|
||||
void AwtComponent::SetParent(void * param) {
|
||||
void AwtComponent::_SetParent(void * param)
|
||||
{
|
||||
if (AwtToolkit::IsMainThread()) {
|
||||
AwtComponent** comps = (AwtComponent**)param;
|
||||
if ((comps[0] != NULL) && (comps[1] != NULL)) {
|
||||
HWND selfWnd = comps[0]->GetHWnd();
|
||||
HWND parentWnd = comps[1]->GetHWnd();
|
||||
if (::IsWindow(selfWnd) && ::IsWindow(parentWnd)) {
|
||||
// Shouldn't trigger native focus change
|
||||
// (only the proxy may be the native focus owner).
|
||||
::SetParent(selfWnd, parentWnd);
|
||||
}
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
SetParentStruct *data = (SetParentStruct*) param;
|
||||
jobject self = data->component;
|
||||
jobject parent = data->parentComp;
|
||||
|
||||
AwtComponent *awtComponent = NULL;
|
||||
AwtComponent *awtParent = NULL;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
awtComponent = (AwtComponent *)pData;
|
||||
JNI_CHECK_PEER_GOTO(parent, ret);
|
||||
awtParent = (AwtComponent *)pData;
|
||||
|
||||
HWND selfWnd = awtComponent->GetHWnd();
|
||||
HWND parentWnd = awtParent->GetHWnd();
|
||||
if (::IsWindow(selfWnd) && ::IsWindow(parentWnd)) {
|
||||
// Shouldn't trigger native focus change
|
||||
// (only the proxy may be the native focus owner).
|
||||
::SetParent(selfWnd, parentWnd);
|
||||
}
|
||||
delete[] comps;
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
env->DeleteGlobalRef(parent);
|
||||
delete data;
|
||||
} else {
|
||||
AwtToolkit::GetInstance().InvokeFunction(AwtComponent::SetParent, param);
|
||||
AwtToolkit::GetInstance().InvokeFunction(AwtComponent::_SetParent, param);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7129,15 +7153,12 @@ JNIEXPORT void JNICALL
|
||||
Java_sun_awt_windows_WComponentPeer_pSetParent(JNIEnv* env, jobject self, jobject parent) {
|
||||
TRY;
|
||||
|
||||
typedef AwtComponent* PComponent;
|
||||
AwtComponent** comps = new PComponent[2];
|
||||
AwtComponent* comp = (AwtComponent*)JNI_GET_PDATA(self);
|
||||
AwtComponent* parentComp = (AwtComponent*)JNI_GET_PDATA(parent);
|
||||
comps[0] = comp;
|
||||
comps[1] = parentComp;
|
||||
SetParentStruct * data = new SetParentStruct;
|
||||
data->component = env->NewGlobalRef(self);
|
||||
data->parentComp = env->NewGlobalRef(parent);
|
||||
|
||||
AwtToolkit::GetInstance().SyncCall(AwtComponent::SetParent, comps);
|
||||
// comps is deleted in SetParent
|
||||
AwtToolkit::GetInstance().SyncCall(AwtComponent::_SetParent, data);
|
||||
// global refs and data are deleted in SetParent
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
@ -672,6 +672,7 @@ public:
|
||||
static void _RemoveNativeDropTarget(void *param);
|
||||
static jintArray _CreatePrintedPixels(void *param);
|
||||
static jboolean _NativeHandlesWheelScrolling(void *param);
|
||||
static void _SetParent(void * param);
|
||||
static void _SetRectangularShape(void *param);
|
||||
static void _SetZOrder(void *param);
|
||||
|
||||
|
@ -111,12 +111,13 @@ AwtDialog* AwtDialog::Create(jobject peer, jobject parent)
|
||||
PDATA pData;
|
||||
AwtWindow* awtParent = NULL;
|
||||
HWND hwndParent = NULL;
|
||||
|
||||
target = env->GetObjectField(peer, AwtObject::targetID);
|
||||
JNI_CHECK_NULL_GOTO(target, "null target", done);
|
||||
|
||||
if (parent != NULL) {
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
awtParent = (AwtWindow *)(JNI_GET_PDATA(parent));
|
||||
awtParent = (AwtWindow *)pData;
|
||||
hwndParent = awtParent->GetHWnd();
|
||||
} else {
|
||||
// There is no way to prevent a parentless dialog from showing on
|
||||
@ -775,11 +776,9 @@ Java_sun_awt_windows_WDialogPeer_createAwtDialog(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtDialog::Create);
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
@ -691,7 +691,7 @@ Java_sun_awt_windows_WFileDialogPeer_getLocationOnScreen(JNIEnv *env,
|
||||
jobject peerRef = env->NewGlobalRef(peer);
|
||||
jobject resultRef = (jobject)AwtToolkit::GetInstance().SyncCall(
|
||||
(void*(*)(void*))AwtFileDialog::_GetLocationOnScreen, (void *)peerRef);
|
||||
env->DeleteLocalRef(peerRef);
|
||||
env->DeleteGlobalRef(peerRef);
|
||||
|
||||
if (resultRef != NULL)
|
||||
{
|
||||
|
@ -1580,12 +1580,12 @@ void AwtFrame::_NotifyModalBlocked(void *param)
|
||||
|
||||
PDATA pData;
|
||||
|
||||
pData = JNI_GET_PDATA(peer);
|
||||
JNI_CHECK_PEER_GOTO(peer, ret);
|
||||
AwtFrame *f = (AwtFrame *)pData;
|
||||
|
||||
// dialog here may be NULL, for example, if the blocker is a native dialog
|
||||
// however, we need to install/unistall modal hooks anyway
|
||||
pData = JNI_GET_PDATA(blockerPeer);
|
||||
JNI_CHECK_PEER_GOTO(blockerPeer, ret);
|
||||
AwtDialog *d = (AwtDialog *)pData;
|
||||
|
||||
if ((f != NULL) && ::IsWindow(f->GetHWnd()))
|
||||
@ -1637,7 +1637,7 @@ void AwtFrame::_NotifyModalBlocked(void *param)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
env->DeleteGlobalRef(peer);
|
||||
env->DeleteGlobalRef(blockerPeer);
|
||||
@ -1809,8 +1809,6 @@ Java_sun_awt_windows_WFramePeer_createAwtFrame(JNIEnv *env, jobject self,
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtFrame::Create);
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
@ -1924,8 +1922,6 @@ Java_sun_awt_windows_WEmbeddedFramePeer_create(JNIEnv *env, jobject self,
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtFrame::Create);
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ AwtLabel* AwtLabel::Create(jobject labelPeer, jobject parent)
|
||||
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
awtParent = (AwtCanvas*)pData;
|
||||
JNI_CHECK_NULL_GOTO(awtParent, "awtParent", done);
|
||||
|
||||
target = env->GetObjectField(labelPeer, AwtObject::targetID);
|
||||
JNI_CHECK_NULL_GOTO(target, "target", done);
|
||||
|
||||
@ -392,12 +392,9 @@ Java_sun_awt_windows_WLabelPeer_create(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(parent);
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtLabel::Create);
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
@ -89,10 +89,9 @@ AwtList* AwtList::Create(jobject peer, jobject parent)
|
||||
|
||||
PDATA pData;
|
||||
AwtCanvas* awtParent;
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
awtParent = (AwtCanvas*)pData;
|
||||
JNI_CHECK_NULL_GOTO(awtParent, "null awtParent", done);
|
||||
|
||||
/* target is Hjava_awt_List * */
|
||||
target = env->GetObjectField(peer, AwtObject::targetID);
|
||||
@ -928,9 +927,6 @@ Java_sun_awt_windows_WListPeer_deselect(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(self);
|
||||
|
||||
SelectElementStruct *ses = new SelectElementStruct;
|
||||
ses->list = env->NewGlobalRef(self);
|
||||
ses->index = pos;
|
||||
@ -994,11 +990,8 @@ Java_sun_awt_windows_WListPeer_create(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(parent);
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)AwtList::Create);
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
@ -96,10 +96,9 @@ AwtScrollPane* AwtScrollPane::Create(jobject self, jobject parent)
|
||||
|
||||
PDATA pData;
|
||||
AwtComponent* awtParent;
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
awtParent = (AwtComponent*)pData;
|
||||
JNI_CHECK_NULL_GOTO(awtParent, "null awtParent", done);
|
||||
|
||||
target = env->GetObjectField(self, AwtObject::targetID);
|
||||
JNI_CHECK_NULL_GOTO(target, "null target", done);
|
||||
@ -679,11 +678,10 @@ Java_sun_awt_windows_WScrollPanePeer_create(JNIEnv *env, jobject self,
|
||||
|
||||
DTRACE_PRINTLN2("%x: WScrollPanePeer.create(%x)", self, parent);
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(parent);
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtScrollPane::Create);
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
((AwtScrollPane*)pData)->VerifyState();
|
||||
|
||||
|
@ -38,7 +38,11 @@ struct SetValuesStruct {
|
||||
jint value;
|
||||
jint visible;
|
||||
jint min, max;
|
||||
|
||||
};
|
||||
// struct for _SetLineIncrement()/_SetPageIncrement() methods
|
||||
struct SetIncrementStruct {
|
||||
jobject scrollbar;
|
||||
jint increment;
|
||||
};
|
||||
/************************************************************************
|
||||
* AwtScrollbar fields
|
||||
@ -108,10 +112,9 @@ AwtScrollbar::Create(jobject peer, jobject parent)
|
||||
|
||||
PDATA pData;
|
||||
AwtCanvas* awtParent;
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
awtParent = (AwtCanvas*)pData;
|
||||
JNI_CHECK_NULL_GOTO(awtParent, "null awtParent", done);
|
||||
|
||||
target = env->GetObjectField(peer, AwtObject::targetID);
|
||||
JNI_CHECK_NULL_GOTO(target, "null target", done);
|
||||
@ -471,6 +474,52 @@ ret:
|
||||
delete svs;
|
||||
}
|
||||
|
||||
void AwtScrollbar::_SetLineIncrement(void *param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
SetIncrementStruct *sis = (SetIncrementStruct *)param;
|
||||
jobject self = sis->scrollbar;
|
||||
jint increment = sis->increment;
|
||||
|
||||
AwtScrollbar *sb = NULL;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
sb = (AwtScrollbar *)pData;
|
||||
if (::IsWindow(sb->GetHWnd()))
|
||||
{
|
||||
sb->SetLineIncrement(increment);
|
||||
}
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
|
||||
delete sis;
|
||||
}
|
||||
|
||||
void AwtScrollbar::_SetPageIncrement(void *param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
SetIncrementStruct *sis = (SetIncrementStruct *)param;
|
||||
jobject self = sis->scrollbar;
|
||||
jint increment = sis->increment;
|
||||
|
||||
AwtScrollbar *sb = NULL;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
sb = (AwtScrollbar *)pData;
|
||||
if (::IsWindow(sb->GetHWnd()))
|
||||
{
|
||||
sb->SetPageIncrement(increment);
|
||||
}
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
|
||||
delete sis;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Scrollbar native methods
|
||||
*/
|
||||
@ -546,10 +595,12 @@ Java_sun_awt_windows_WScrollbarPeer_setLineIncrement(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(self);
|
||||
AwtScrollbar* c = (AwtScrollbar*)pData;
|
||||
c->SetLineIncrement(increment);
|
||||
SetIncrementStruct *sis = new SetIncrementStruct;
|
||||
sis->scrollbar = env->NewGlobalRef(self);
|
||||
sis->increment = increment;
|
||||
|
||||
AwtToolkit::GetInstance().SyncCall(AwtScrollbar::_SetLineIncrement, sis);
|
||||
// global ref and svs are deleted in _SetValues
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
@ -565,10 +616,12 @@ Java_sun_awt_windows_WScrollbarPeer_setPageIncrement(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(self);
|
||||
AwtScrollbar* c = (AwtScrollbar*)pData;
|
||||
c->SetPageIncrement(increment);
|
||||
SetIncrementStruct *sis = new SetIncrementStruct;
|
||||
sis->scrollbar = env->NewGlobalRef(self);
|
||||
sis->increment = increment;
|
||||
|
||||
AwtToolkit::GetInstance().SyncCall(AwtScrollbar::_SetPageIncrement, sis);
|
||||
// global ref and svs are deleted in _SetValues
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
@ -584,12 +637,9 @@ Java_sun_awt_windows_WScrollbarPeer_create(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(parent);
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtScrollbar::Create);
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ public:
|
||||
|
||||
INLINE virtual BOOL IsScrollbar() { return TRUE; }
|
||||
|
||||
static void _SetLineIncrement(void *param);
|
||||
static void _SetPageIncrement(void *param);
|
||||
// invoked on Toolkit thread
|
||||
static void _SetValues(void *param);
|
||||
|
||||
|
@ -505,12 +505,9 @@ Java_sun_awt_windows_WTextAreaPeer_create(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(parent);
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtTextArea::Create);
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
@ -95,10 +95,9 @@ AwtTextComponent* AwtTextComponent::Create(jobject peer, jobject parent, BOOL is
|
||||
|
||||
PDATA pData;
|
||||
AwtCanvas* awtParent;
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
|
||||
JNI_CHECK_PEER_GOTO(parent, done);
|
||||
awtParent = (AwtCanvas*)pData;
|
||||
JNI_CHECK_NULL_GOTO(awtParent, "null awtParent", done);
|
||||
|
||||
target = env->GetObjectField(peer, AwtObject::targetID);
|
||||
JNI_CHECK_NULL_GOTO(target, "null target", done);
|
||||
|
@ -260,12 +260,9 @@ Java_sun_awt_windows_WTextFieldPeer_create(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_RETURN(parent);
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtTextField::Create);
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
@ -3400,12 +3400,9 @@ Java_sun_awt_windows_WWindowPeer_createAwtWindow(JNIEnv *env, jobject self,
|
||||
{
|
||||
TRY;
|
||||
|
||||
PDATA pData;
|
||||
// JNI_CHECK_PEER_RETURN(parent);
|
||||
AwtToolkit::CreateComponent(self, parent,
|
||||
(AwtToolkit::ComponentFactory)
|
||||
AwtWindow::Create);
|
||||
JNI_CHECK_PEER_CREATION_RETURN(self);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user