696 { 697 break; 698 } 699 hwnd = ::GetParent(hwnd); 700 } 701 702 return hwnd; 703 } 704 //////////////////// 705 706 jobject AwtComponent::FindHeavyweightUnderCursor(BOOL useCache) { 707 JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); 708 if (env->EnsureLocalCapacity(1) < 0) { 709 return NULL; 710 } 711 712 HWND hit = NULL; 713 POINT p = { 0, 0 }; 714 AwtComponent *comp = NULL; 715 716 if (useCache) { 717 if (sm_cursorOn == NULL) { 718 return NULL; 719 } 720 721 722 DASSERT(::IsWindow(sm_cursorOn)); 723 VERIFY(::GetCursorPos(&p)); 724 /* 725 * Fix for BugTraq ID 4304024. 726 * Allow a non-default cursor only for the client area. 727 */ 728 comp = AwtComponent::GetComponent(sm_cursorOn); 729 if (comp != NULL && 730 ::SendMessage(sm_cursorOn, WM_NCHITTEST, 0, 731 MAKELPARAM(p.x, p.y)) == HTCLIENT) { 732 goto found; 733 } 734 } 735 | 696 { 697 break; 698 } 699 hwnd = ::GetParent(hwnd); 700 } 701 702 return hwnd; 703 } 704 //////////////////// 705 706 jobject AwtComponent::FindHeavyweightUnderCursor(BOOL useCache) { 707 JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); 708 if (env->EnsureLocalCapacity(1) < 0) { 709 return NULL; 710 } 711 712 HWND hit = NULL; 713 POINT p = { 0, 0 }; 714 AwtComponent *comp = NULL; 715 716 if ((comp = AwtFrame::sm_lwFrameUnderMouse) != NULL) { 717 goto found; 718 } 719 720 if (useCache) { 721 if (sm_cursorOn == NULL) { 722 return NULL; 723 } 724 725 726 DASSERT(::IsWindow(sm_cursorOn)); 727 VERIFY(::GetCursorPos(&p)); 728 /* 729 * Fix for BugTraq ID 4304024. 730 * Allow a non-default cursor only for the client area. 731 */ 732 comp = AwtComponent::GetComponent(sm_cursorOn); 733 if (comp != NULL && 734 ::SendMessage(sm_cursorOn, WM_NCHITTEST, 0, 735 MAKELPARAM(p.x, p.y)) == HTCLIENT) { 736 goto found; 737 } 738 } 739 |