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