65 jstring option; 66 }; 67 // Struct for _SynthesizeWmActivate() method 68 struct SynthesizeWmActivateStruct { 69 jobject frame; 70 jboolean doActivate; 71 }; 72 // Struct for _NotifyModalBlocked() method 73 struct NotifyModalBlockedStruct { 74 jobject frame; 75 jobject peer; 76 jobject blockerPeer; 77 jboolean blocked; 78 }; 79 // Information about thread containing modal blocked embedded frames 80 struct BlockedThreadStruct { 81 int framesCount; 82 HHOOK mouseHook; 83 HHOOK modalHook; 84 }; 85 /************************************************************************ 86 * AwtFrame fields 87 */ 88 89 jfieldID AwtFrame::handleID; 90 91 jfieldID AwtFrame::undecoratedID; 92 jmethodID AwtFrame::getExtendedStateMID; 93 jmethodID AwtFrame::setExtendedStateMID; 94 95 jmethodID AwtFrame::activateEmbeddingTopLevelMID; 96 97 Hashtable AwtFrame::sm_BlockedThreads("AWTBlockedThreads"); 98 99 /************************************************************************ 100 * AwtFrame methods 101 */ 102 103 AwtFrame::AwtFrame() { 104 m_parentWnd = NULL; 105 menuBar = NULL; 106 m_isEmbedded = FALSE; 107 m_isLightweight = FALSE; 108 m_ignoreWmSize = FALSE; 109 m_isMenuDropped = FALSE; 110 m_isInputMethodWindow = FALSE; 111 m_isUndecorated = FALSE; 112 m_imeTargetComponent = NULL; 113 m_actualFocusedWindow = NULL; 114 m_iconic = FALSE; 115 m_zoomed = FALSE; 116 m_maxBoundsSet = FALSE; 117 m_forceResetZoomed = FALSE; 118 1559 ::UnhookWindowsHookEx(blockedThread->modalHook); 1560 ::UnhookWindowsHookEx(blockedThread->mouseHook); 1561 sm_BlockedThreads.remove((void *)fThread); 1562 delete blockedThread; 1563 } else { 1564 blockedThread->framesCount--; 1565 } 1566 } 1567 } 1568 } 1569 } 1570 } 1571 1572 env->DeleteGlobalRef(self); 1573 env->DeleteGlobalRef(peer); 1574 env->DeleteGlobalRef(blockerPeer); 1575 1576 delete nmbs; 1577 } 1578 1579 /************************************************************************ 1580 * WFramePeer native methods 1581 */ 1582 1583 extern "C" { 1584 1585 /* 1586 * Class: java_awt_Frame 1587 * Method: initIDs 1588 * Signature: ()V 1589 */ 1590 JNIEXPORT void JNICALL 1591 Java_java_awt_Frame_initIDs(JNIEnv *env, jclass cls) 1592 { 1593 TRY; 1594 1595 AwtFrame::undecoratedID = env->GetFieldID(cls,"undecorated","Z"); 1596 DASSERT(AwtFrame::undecoratedID != NULL); 1597 1598 CATCH_BAD_ALLOC; 1906 } 1907 1908 CATCH_BAD_ALLOC_RET(NULL); 1909 } 1910 1911 JNIEXPORT void JNICALL 1912 Java_sun_awt_windows_WFramePeer_synthesizeWmActivate(JNIEnv *env, jobject self, jboolean doActivate) 1913 { 1914 TRY; 1915 1916 SynthesizeWmActivateStruct *sas = new SynthesizeWmActivateStruct; 1917 sas->frame = env->NewGlobalRef(self); 1918 sas->doActivate = doActivate; 1919 1920 /* 1921 * WARNING: invoking this function without synchronization by m_Sync CriticalSection. 1922 * Taking this lock results in a deadlock. 1923 */ 1924 AwtToolkit::GetInstance().InvokeFunction(AwtFrame::_SynthesizeWmActivate, sas); 1925 // global ref and sas are deleted in _SynthesizeWmActivate() 1926 1927 CATCH_BAD_ALLOC; 1928 } 1929 1930 } /* extern "C" */ | 65 jstring option; 66 }; 67 // Struct for _SynthesizeWmActivate() method 68 struct SynthesizeWmActivateStruct { 69 jobject frame; 70 jboolean doActivate; 71 }; 72 // Struct for _NotifyModalBlocked() method 73 struct NotifyModalBlockedStruct { 74 jobject frame; 75 jobject peer; 76 jobject blockerPeer; 77 jboolean blocked; 78 }; 79 // Information about thread containing modal blocked embedded frames 80 struct BlockedThreadStruct { 81 int framesCount; 82 HHOOK mouseHook; 83 HHOOK modalHook; 84 }; 85 // Struct for _SetLwFrameUnderMouse method 86 struct SetLwFrameUnderMouseStruct { 87 jobject frame; 88 }; 89 /************************************************************************ 90 * AwtFrame fields 91 */ 92 93 jfieldID AwtFrame::handleID; 94 95 jfieldID AwtFrame::undecoratedID; 96 jmethodID AwtFrame::getExtendedStateMID; 97 jmethodID AwtFrame::setExtendedStateMID; 98 99 jmethodID AwtFrame::activateEmbeddingTopLevelMID; 100 101 Hashtable AwtFrame::sm_BlockedThreads("AWTBlockedThreads"); 102 103 AwtFrame* AwtFrame::sm_lwFrameUnderMouse = NULL; 104 105 /************************************************************************ 106 * AwtFrame methods 107 */ 108 109 AwtFrame::AwtFrame() { 110 m_parentWnd = NULL; 111 menuBar = NULL; 112 m_isEmbedded = FALSE; 113 m_isLightweight = FALSE; 114 m_ignoreWmSize = FALSE; 115 m_isMenuDropped = FALSE; 116 m_isInputMethodWindow = FALSE; 117 m_isUndecorated = FALSE; 118 m_imeTargetComponent = NULL; 119 m_actualFocusedWindow = NULL; 120 m_iconic = FALSE; 121 m_zoomed = FALSE; 122 m_maxBoundsSet = FALSE; 123 m_forceResetZoomed = FALSE; 124 1565 ::UnhookWindowsHookEx(blockedThread->modalHook); 1566 ::UnhookWindowsHookEx(blockedThread->mouseHook); 1567 sm_BlockedThreads.remove((void *)fThread); 1568 delete blockedThread; 1569 } else { 1570 blockedThread->framesCount--; 1571 } 1572 } 1573 } 1574 } 1575 } 1576 } 1577 1578 env->DeleteGlobalRef(self); 1579 env->DeleteGlobalRef(peer); 1580 env->DeleteGlobalRef(blockerPeer); 1581 1582 delete nmbs; 1583 } 1584 1585 void AwtFrame::_SetLwFrameUnderMouse(void *param) 1586 { 1587 JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); 1588 1589 SetLwFrameUnderMouseStruct *sfums = (SetLwFrameUnderMouseStruct *)param; 1590 jobject self = sfums->frame; 1591 1592 if (self == NULL) { 1593 AwtFrame::sm_lwFrameUnderMouse = NULL; 1594 } else { 1595 AwtFrame *frame = NULL; 1596 1597 PDATA pData; 1598 JNI_CHECK_PEER_GOTO(self, ret); 1599 frame = (AwtFrame *)pData; 1600 if (::IsWindow(frame->GetHWnd())) 1601 { 1602 AwtFrame::sm_lwFrameUnderMouse = frame; 1603 } 1604 } 1605 ret: 1606 env->DeleteGlobalRef(self); 1607 1608 delete sfums; 1609 } 1610 1611 /************************************************************************ 1612 * WFramePeer native methods 1613 */ 1614 1615 extern "C" { 1616 1617 /* 1618 * Class: java_awt_Frame 1619 * Method: initIDs 1620 * Signature: ()V 1621 */ 1622 JNIEXPORT void JNICALL 1623 Java_java_awt_Frame_initIDs(JNIEnv *env, jclass cls) 1624 { 1625 TRY; 1626 1627 AwtFrame::undecoratedID = env->GetFieldID(cls,"undecorated","Z"); 1628 DASSERT(AwtFrame::undecoratedID != NULL); 1629 1630 CATCH_BAD_ALLOC; 1938 } 1939 1940 CATCH_BAD_ALLOC_RET(NULL); 1941 } 1942 1943 JNIEXPORT void JNICALL 1944 Java_sun_awt_windows_WFramePeer_synthesizeWmActivate(JNIEnv *env, jobject self, jboolean doActivate) 1945 { 1946 TRY; 1947 1948 SynthesizeWmActivateStruct *sas = new SynthesizeWmActivateStruct; 1949 sas->frame = env->NewGlobalRef(self); 1950 sas->doActivate = doActivate; 1951 1952 /* 1953 * WARNING: invoking this function without synchronization by m_Sync CriticalSection. 1954 * Taking this lock results in a deadlock. 1955 */ 1956 AwtToolkit::GetInstance().InvokeFunction(AwtFrame::_SynthesizeWmActivate, sas); 1957 // global ref and sas are deleted in _SynthesizeWmActivate() 1958 1959 CATCH_BAD_ALLOC; 1960 } 1961 1962 JNIEXPORT void JNICALL 1963 Java_sun_awt_windows_WLightweightFramePeer_setLWFrameUnderMouse(JNIEnv *env, jclass selfClass, jobject peer) 1964 { 1965 TRY; 1966 1967 SetLwFrameUnderMouseStruct *sfums = new SetLwFrameUnderMouseStruct; 1968 sfums->frame = env->NewGlobalRef(peer); 1969 1970 AwtToolkit::GetInstance().InvokeFunction(AwtFrame::_SetLwFrameUnderMouse, sfums); 1971 // global ref and sfums are deleted in _SetLwFrameUnderMouse() 1972 1973 CATCH_BAD_ALLOC; 1974 } 1975 1976 } /* extern "C" */ |