464 DWORD windowStyle,
465 DWORD windowExStyle,
466 int x, int y, int w, int h,
467 HWND hWndParent, HMENU hMenu,
468 COLORREF colorForeground,
469 COLORREF colorBackground,
470 jobject peer)
471 {
472 // Retrieve the warning string
473 // Note: we need to get it before CreateHWnd() happens because
474 // the isUntrusted() method may be invoked while the HWND
475 // is being created in response to some window messages.
476 jobject target = env->GetObjectField(peer, AwtObject::targetID);
477 jstring javaWarningString =
478 (jstring)env->CallObjectMethod(target, AwtWindow::getWarningStringMID);
479
480 if (javaWarningString != NULL) {
481 size_t length = env->GetStringLength(javaWarningString) + 1;
482 warningString = new WCHAR[length];
483 env->GetStringRegion(javaWarningString, 0,
484 static_cast<jsize>(length - 1), warningString);
485 warningString[length-1] = L'\0';
486
487 env->DeleteLocalRef(javaWarningString);
488 }
489 env->DeleteLocalRef(target);
490
491 AwtCanvas::CreateHWnd(env, title,
492 windowStyle,
493 windowExStyle,
494 x, y, w, h,
495 hWndParent, hMenu,
496 colorForeground,
497 colorBackground,
498 peer);
499
500 // Now we need to create the warning window.
501 CreateWarningWindow(env);
502 }
503
504 void AwtWindow::CreateWarningWindow(JNIEnv *env)
2586 if (data == NULL) {
2587 return;
2588 }
2589 hBitmap = CreateBitmapFromRaster(env, data, width, height);
2590 if (hBitmap == NULL) {
2591 return;
2592 }
2593 } else {
2594 hBitmap = hNewBitmap;
2595 }
2596
2597 ::EnterCriticalSection(&contentBitmapCS);
2598 if (hContentBitmap != NULL) {
2599 ::DeleteObject(hContentBitmap);
2600 }
2601 hContentBitmap = hBitmap;
2602 contentWidth = width;
2603 contentHeight = height;
2604 UpdateWindowImpl(width, height, hBitmap);
2605 ::LeaveCriticalSection(&contentBitmapCS);
2606 }
2607
2608 void AwtWindow::FillBackground(HDC hMemoryDC, SIZE &size)
2609 {
2610 if (isOpaque()) {
2611 AwtCanvas::FillBackground(hMemoryDC, size);
2612 }
2613 }
2614
2615 void AwtWindow::FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha)
2616 {
2617 if (isOpaque()) {
2618 AwtCanvas::FillAlpha(bitmapBits, size, alpha);
2619 }
2620 }
2621
2622 /*
2623 * Fixed 6353381: it's improved fix for 4792958
2624 * which was backed-out to avoid 5059656
2625 */
2626 BOOL AwtWindow::HasValidRect()
2627 {
2628 RECT inside;
2629 RECT outside;
2630
2631 if (::IsIconic(GetHWnd())) {
2632 return FALSE;
2633 }
2634
2635 ::GetClientRect(GetHWnd(), &inside);
2636 ::GetWindowRect(GetHWnd(), &outside);
2637
2638 BOOL isZeroClientArea = (inside.right == 0 && inside.bottom == 0);
2639 BOOL isInvalidLocation = ((outside.left == -32000 && outside.top == -32000) || // Win2k && WinXP
|
464 DWORD windowStyle,
465 DWORD windowExStyle,
466 int x, int y, int w, int h,
467 HWND hWndParent, HMENU hMenu,
468 COLORREF colorForeground,
469 COLORREF colorBackground,
470 jobject peer)
471 {
472 // Retrieve the warning string
473 // Note: we need to get it before CreateHWnd() happens because
474 // the isUntrusted() method may be invoked while the HWND
475 // is being created in response to some window messages.
476 jobject target = env->GetObjectField(peer, AwtObject::targetID);
477 jstring javaWarningString =
478 (jstring)env->CallObjectMethod(target, AwtWindow::getWarningStringMID);
479
480 if (javaWarningString != NULL) {
481 size_t length = env->GetStringLength(javaWarningString) + 1;
482 warningString = new WCHAR[length];
483 env->GetStringRegion(javaWarningString, 0,
484 static_cast<jsize>(length - 1), reinterpret_cast<jchar*>(warningString));
485 warningString[length-1] = L'\0';
486
487 env->DeleteLocalRef(javaWarningString);
488 }
489 env->DeleteLocalRef(target);
490
491 AwtCanvas::CreateHWnd(env, title,
492 windowStyle,
493 windowExStyle,
494 x, y, w, h,
495 hWndParent, hMenu,
496 colorForeground,
497 colorBackground,
498 peer);
499
500 // Now we need to create the warning window.
501 CreateWarningWindow(env);
502 }
503
504 void AwtWindow::CreateWarningWindow(JNIEnv *env)
2586 if (data == NULL) {
2587 return;
2588 }
2589 hBitmap = CreateBitmapFromRaster(env, data, width, height);
2590 if (hBitmap == NULL) {
2591 return;
2592 }
2593 } else {
2594 hBitmap = hNewBitmap;
2595 }
2596
2597 ::EnterCriticalSection(&contentBitmapCS);
2598 if (hContentBitmap != NULL) {
2599 ::DeleteObject(hContentBitmap);
2600 }
2601 hContentBitmap = hBitmap;
2602 contentWidth = width;
2603 contentHeight = height;
2604 UpdateWindowImpl(width, height, hBitmap);
2605 ::LeaveCriticalSection(&contentBitmapCS);
2606 }
2607
2608 /*
2609 * Fixed 6353381: it's improved fix for 4792958
2610 * which was backed-out to avoid 5059656
2611 */
2612 BOOL AwtWindow::HasValidRect()
2613 {
2614 RECT inside;
2615 RECT outside;
2616
2617 if (::IsIconic(GetHWnd())) {
2618 return FALSE;
2619 }
2620
2621 ::GetClientRect(GetHWnd(), &inside);
2622 ::GetWindowRect(GetHWnd(), &outside);
2623
2624 BOOL isZeroClientArea = (inside.right == 0 && inside.bottom == 0);
2625 BOOL isInvalidLocation = ((outside.left == -32000 && outside.top == -32000) || // Win2k && WinXP
|