1134 env->DeleteLocalRef(target); 1135 throw; 1136 } 1137 1138 done: 1139 env->DeleteLocalRef(target); 1140 return window; 1141 } 1142 1143 BOOL AwtWindow::IsOneOfOwnersOf(AwtWindow * wnd) { 1144 while (wnd != NULL) { 1145 if (wnd == this || wnd->GetOwningFrameOrDialog() == this) return TRUE; 1146 wnd = (AwtWindow*)GetComponent(::GetWindow(wnd->GetHWnd(), GW_OWNER)); 1147 } 1148 return FALSE; 1149 } 1150 1151 void AwtWindow::InitOwner(AwtWindow *owner) 1152 { 1153 DASSERT(owner != NULL); 1154 while (owner != NULL && owner->IsSimpleWindow()) { 1155 1156 HWND ownerOwnerHWND = ::GetWindow(owner->GetHWnd(), GW_OWNER); 1157 if (ownerOwnerHWND == NULL) { 1158 owner = NULL; 1159 break; 1160 } 1161 owner = (AwtWindow *)AwtComponent::GetComponent(ownerOwnerHWND); 1162 } 1163 m_owningFrameDialog = (AwtFrame *)owner; 1164 } 1165 1166 void AwtWindow::moveToDefaultLocation() { 1167 HWND boggy = ::CreateWindow(GetClassName(), L"BOGGY", WS_OVERLAPPED, CW_USEDEFAULT, 0 ,0, 0, 1168 NULL, NULL, NULL, NULL); 1169 RECT defLoc; 1170 1171 // Fixed 6477497: Windows drawn off-screen on Win98, even when java.awt.Window.locationByPlatform is set 1172 // Win9x does not position a window until the window is shown. 1173 // The behavior is slightly opposite to the WinNT (and up), where 1174 // Windows will position the window upon creation of the window. 1175 // That's why we have to manually set the left & top values of 1176 // the defLoc to 0 if the GetWindowRect function returns FALSE. 1177 BOOL result = ::GetWindowRect(boggy, &defLoc); 1178 if (!result) { 1179 defLoc.left = defLoc.top = 0; 1180 } 1181 VERIFY(::DestroyWindow(boggy)); | 1134 env->DeleteLocalRef(target); 1135 throw; 1136 } 1137 1138 done: 1139 env->DeleteLocalRef(target); 1140 return window; 1141 } 1142 1143 BOOL AwtWindow::IsOneOfOwnersOf(AwtWindow * wnd) { 1144 while (wnd != NULL) { 1145 if (wnd == this || wnd->GetOwningFrameOrDialog() == this) return TRUE; 1146 wnd = (AwtWindow*)GetComponent(::GetWindow(wnd->GetHWnd(), GW_OWNER)); 1147 } 1148 return FALSE; 1149 } 1150 1151 void AwtWindow::InitOwner(AwtWindow *owner) 1152 { 1153 DASSERT(owner != NULL); 1154 AwtWindow *initialOwner = owner; 1155 while (owner != NULL && owner->IsSimpleWindow()) { 1156 1157 HWND ownerOwnerHWND = ::GetWindow(owner->GetHWnd(), GW_OWNER); 1158 if (ownerOwnerHWND == NULL) { 1159 owner = NULL; 1160 break; 1161 } 1162 owner = (AwtWindow *)AwtComponent::GetComponent(ownerOwnerHWND); 1163 } 1164 if (!owner) { 1165 owner = initialOwner->GetOwningFrameOrDialog(); 1166 } 1167 m_owningFrameDialog = (AwtFrame *)owner; 1168 } 1169 1170 void AwtWindow::moveToDefaultLocation() { 1171 HWND boggy = ::CreateWindow(GetClassName(), L"BOGGY", WS_OVERLAPPED, CW_USEDEFAULT, 0 ,0, 0, 1172 NULL, NULL, NULL, NULL); 1173 RECT defLoc; 1174 1175 // Fixed 6477497: Windows drawn off-screen on Win98, even when java.awt.Window.locationByPlatform is set 1176 // Win9x does not position a window until the window is shown. 1177 // The behavior is slightly opposite to the WinNT (and up), where 1178 // Windows will position the window upon creation of the window. 1179 // That's why we have to manually set the left & top values of 1180 // the defLoc to 0 if the GetWindowRect function returns FALSE. 1181 BOOL result = ::GetWindowRect(boggy, &defLoc); 1182 if (!result) { 1183 defLoc.left = defLoc.top = 0; 1184 } 1185 VERIFY(::DestroyWindow(boggy)); |