src/windows/native/sun/windows/awt_Component.cpp

Print this page

        

*** 1470,1482 **** // fix 4128317 : use GetClientRect for full 32-bit int precision and // to avoid negative client area dimensions overflowing 16-bit params - robi ::GetClientRect( GetHWnd(), &r ); mr = WmSize(static_cast<UINT>(wParam), r.right - r.left, r.bottom - r.top); //mr = WmSize(wParam, LOWORD(lParam), HIWORD(lParam)); - if (ImmGetContext() != NULL) { SetCompositionWindow(r); - } break; } case WM_SIZING: mr = WmSizing(); break; --- 1470,1480 ----
*** 1531,1541 **** mr = WmActivate(nState, fMinimized, (HWND)lParam); // When the window is deactivated, send WM_IME_ENDCOMPOSITION // message to deactivate the composition window so that // it won't receive keyboard input focus. ! if (ImmGetContext() != NULL) { DefWindowProc(WM_IME_ENDCOMPOSITION, 0, 0); } } break; } --- 1529,1542 ---- mr = WmActivate(nState, fMinimized, (HWND)lParam); // When the window is deactivated, send WM_IME_ENDCOMPOSITION // message to deactivate the composition window so that // it won't receive keyboard input focus. ! HIMC hIMC; ! HWND hwnd = ImmGetHWnd(); ! if ((hIMC = ImmGetContext(hwnd)) != NULL) { ! ImmReleaseContext(hwnd, hIMC); DefWindowProc(WM_IME_ENDCOMPOSITION, 0, 0); } } break; }
*** 1714,1728 **** LOWORD(lParam), HIWORD(lParam), TRUE); break; case WM_IME_SETCONTEXT: // lParam is passed as pointer and it can be modified. mr = WmImeSetContext(static_cast<BOOL>(wParam), &lParam); - CallProxyDefWindowProc(message, wParam, lParam, retValue, mr); break; case WM_IME_NOTIFY: mr = WmImeNotify(wParam, lParam); - CallProxyDefWindowProc(message, wParam, lParam, retValue, mr); break; case WM_IME_STARTCOMPOSITION: mr = WmImeStartComposition(); CallProxyDefWindowProc(message, wParam, lParam, retValue, mr); break; --- 1715,1727 ----
*** 3719,3734 **** } // support IME Composition messages void AwtComponent::SetCompositionWindow(RECT& r) { ! HIMC hIMC = ImmGetContext(); if (hIMC == NULL) { return; } COMPOSITIONFORM cf = {CFS_DEFAULT, {0, 0}, {0, 0, 0, 0}}; ImmSetCompositionWindow(hIMC, &cf); } void AwtComponent::OpenCandidateWindow(int x, int y) { UINT bits = 1; --- 3718,3735 ---- } // support IME Composition messages void AwtComponent::SetCompositionWindow(RECT& r) { ! HWND hwnd = ImmGetHWnd(); ! HIMC hIMC = ImmGetContext(hwnd); if (hIMC == NULL) { return; } COMPOSITIONFORM cf = {CFS_DEFAULT, {0, 0}, {0, 0, 0, 0}}; ImmSetCompositionWindow(hIMC, &cf); + ImmReleaseContext(hwnd, hIMC); } void AwtComponent::OpenCandidateWindow(int x, int y) { UINT bits = 1;
*** 3738,3771 **** for (int iCandType=0; iCandType<32; iCandType++, bits<<=1) { if ( m_bitsCandType & bits ) SetCandidateWindow(iCandType, x-rc.left, y-rc.top); } if (m_bitsCandType != 0) { - HWND proxy = GetProxyFocusOwner(); // REMIND: is there any chance GetProxyFocusOwner() returns NULL here? ! ::DefWindowProc((proxy != NULL) ? proxy : GetHWnd(), WM_IME_NOTIFY, IMN_OPENCANDIDATE, m_bitsCandType); } } void AwtComponent::SetCandidateWindow(int iCandType, int x, int y) { ! HIMC hIMC = ImmGetContext(); CANDIDATEFORM cf; cf.dwIndex = iCandType; cf.dwStyle = CFS_CANDIDATEPOS; cf.ptCurrentPos.x = x; cf.ptCurrentPos.y = y; ImmSetCandidateWindow(hIMC, &cf); } MsgRouting AwtComponent::WmImeSetContext(BOOL fSet, LPARAM *lplParam) { // If the Windows input context is disabled, do not let Windows // display any UIs. ! HIMC hIMC = ImmGetContext(); if (hIMC == NULL) { *lplParam = 0; return mrDoDefault; } --- 3739,3776 ---- for (int iCandType=0; iCandType<32; iCandType++, bits<<=1) { if ( m_bitsCandType & bits ) SetCandidateWindow(iCandType, x-rc.left, y-rc.top); } if (m_bitsCandType != 0) { // REMIND: is there any chance GetProxyFocusOwner() returns NULL here? ! ::DefWindowProc(ImmGetHWnd(), WM_IME_NOTIFY, IMN_OPENCANDIDATE, m_bitsCandType); } } void AwtComponent::SetCandidateWindow(int iCandType, int x, int y) { ! HWND hwnd = ImmGetHWnd(); ! HIMC hIMC = ImmGetContext(hwnd); CANDIDATEFORM cf; cf.dwIndex = iCandType; cf.dwStyle = CFS_CANDIDATEPOS; cf.ptCurrentPos.x = x; cf.ptCurrentPos.y = y; ImmSetCandidateWindow(hIMC, &cf); + + ImmReleaseContext(hwnd, hIMC); } MsgRouting AwtComponent::WmImeSetContext(BOOL fSet, LPARAM *lplParam) { // If the Windows input context is disabled, do not let Windows // display any UIs. ! HWND hwnd = ImmGetHWnd(); ! HIMC hIMC = ImmGetContext(hwnd); ! ImmReleaseContext(hwnd, hIMC); if (hIMC == NULL) { *lplParam = 0; return mrDoDefault; }
*** 3820,3834 **** BYTE* valAttrW = NULL; int cClauseW = 0; AwtInputTextInfor* textInfor = NULL; try { ! HIMC hIMC = ImmGetContext(); DASSERT(hIMC!=0); textInfor = new AwtInputTextInfor; textInfor->GetContextData(hIMC, flags); jstring jtextString = textInfor->GetText(); /* The conditions to send the input method event to AWT EDT are: 1. Whenever there is a composition message sent regarding whether the composition text is NULL or not. See details at bug 6222692. --- 3825,3841 ---- BYTE* valAttrW = NULL; int cClauseW = 0; AwtInputTextInfor* textInfor = NULL; try { ! HWND hwnd = ImmGetHWnd(); ! HIMC hIMC = ImmGetContext(hwnd); DASSERT(hIMC!=0); textInfor = new AwtInputTextInfor; textInfor->GetContextData(hIMC, flags); + ImmReleaseContext(hwnd, hIMC); jstring jtextString = textInfor->GetText(); /* The conditions to send the input method event to AWT EDT are: 1. Whenever there is a composition message sent regarding whether the composition text is NULL or not. See details at bug 6222692.
*** 4008,4027 **** // call m_InputMethod.sendInputMethod() jobject candPos = env->CallObjectMethod(m_InputMethod, inqCandPosMid); DASSERT(!safe_ExceptionOccurred(env)); } ! HIMC AwtComponent::ImmGetContext() { ! HWND proxy = GetProxyFocusOwner(); ! return ::ImmGetContext((proxy != NULL) ? proxy : GetHWnd()); } HIMC AwtComponent::ImmAssociateContext(HIMC himc) { ! HWND proxy = GetProxyFocusOwner(); ! return ::ImmAssociateContext((proxy != NULL) ? proxy : GetHWnd(), himc); } HWND AwtComponent::GetProxyFocusOwner() { AwtWindow *window = GetContainer(); --- 4015,4032 ---- // call m_InputMethod.sendInputMethod() jobject candPos = env->CallObjectMethod(m_InputMethod, inqCandPosMid); DASSERT(!safe_ExceptionOccurred(env)); } ! HWND AwtComponent::ImmGetHWnd() { ! return GetHWnd(); } HIMC AwtComponent::ImmAssociateContext(HIMC himc) { ! return ::ImmAssociateContext(ImmGetHWnd(), himc); } HWND AwtComponent::GetProxyFocusOwner() { AwtWindow *window = GetContainer();