< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_Component.cpp

Print this page




3807 }
3808 
3809 void AwtComponent::OpenCandidateWindow(int x, int y)
3810 {
3811     UINT bits = 1;
3812     POINT p = {0, 0}; // upper left corner of the client area
3813     HWND hWnd = GetHWnd();
3814     if (!::IsWindowVisible(hWnd)) {
3815         return;
3816     }
3817     HWND hTop = GetTopLevelParentForWindow(hWnd);
3818     ::ClientToScreen(hTop, &p);
3819     if (!m_bitsCandType) {
3820         SetCandidateWindow(m_bitsCandType, x - p.x, y - p.y);
3821         return;
3822     }
3823     for (int iCandType=0; iCandType<32; iCandType++, bits<<=1) {
3824         if ( m_bitsCandType & bits )
3825             SetCandidateWindow(iCandType, x - p.x, y - p.y);
3826     }
3827     if (m_bitsCandType != 0) {
3828         // REMIND: is there any chance GetProxyFocusOwner() returns NULL here?
3829         ::DefWindowProc(ImmGetHWnd(),
3830                         WM_IME_NOTIFY, IMN_OPENCANDIDATE, m_bitsCandType);
3831     }
3832 }
3833 
3834 void AwtComponent::SetCandidateWindow(int iCandType, int x, int y)
3835 {
3836     HWND hwnd = ImmGetHWnd();
3837     HIMC hIMC = ImmGetContext(hwnd);

3838     CANDIDATEFORM cf;
3839     cf.dwIndex = iCandType;
3840     cf.dwStyle = CFS_POINT;
3841     cf.ptCurrentPos.x = x;
3842     cf.ptCurrentPos.y = y;
3843 




3844     ImmSetCandidateWindow(hIMC, &cf);

3845     ImmReleaseContext(hwnd, hIMC);

3846 }
3847 
3848 MsgRouting AwtComponent::WmImeSetContext(BOOL fSet, LPARAM *lplParam)
3849 {
3850     // If the Windows input context is disabled, do not let Windows
3851     // display any UIs.
3852     HWND hwnd = ImmGetHWnd();
3853     HIMC hIMC = ImmGetContext(hwnd);
3854     if (hIMC == NULL) {
3855         *lplParam = 0;
3856         return mrDoDefault;
3857     }
3858     ImmReleaseContext(hwnd, hIMC);
3859 
3860     if (fSet) {
3861         LPARAM lParam = *lplParam;
3862         if (!m_useNativeCompWindow) {
3863             // stop to draw native composing window.
3864             *lplParam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
3865         }
3866     }
3867     return mrDoDefault;
3868 }
3869 
3870 MsgRouting AwtComponent::WmImeNotify(WPARAM subMsg, LPARAM bitsCandType)
3871 {
3872     if (!m_useNativeCompWindow) {
3873         if (subMsg == IMN_OPENCANDIDATE) {
3874             m_bitsCandType = bitsCandType;
3875             InquireCandidatePosition();
3876         } else if (subMsg == IMN_OPENSTATUSWINDOW ||
3877                    subMsg == WM_IME_STARTCOMPOSITION) {
3878             m_bitsCandType = 0;
3879             InquireCandidatePosition();
3880         } else if (subMsg == IMN_SETCANDIDATEPOS) {
3881             InquireCandidatePosition();
3882         }
3883         return mrConsume;
3884     }
3885     return mrDoDefault;
3886 }
3887 
3888 MsgRouting AwtComponent::WmImeStartComposition()
3889 {
3890     if (m_useNativeCompWindow) {
3891         RECT rc;
3892         ::GetClientRect(GetHWnd(), &rc);
3893         SetCompositionWindow(rc);
3894         return mrDoDefault;
3895     } else

3896         return mrConsume;

3897 }
3898 
3899 MsgRouting AwtComponent::WmImeEndComposition()
3900 {
3901     if (m_useNativeCompWindow)   return mrDoDefault;
3902 
3903     SendInputMethodEvent(
3904         java_awt_event_InputMethodEvent_INPUT_METHOD_TEXT_CHANGED,
3905         NULL, 0, NULL, NULL, 0, NULL, NULL, 0, 0, 0 );
3906     return mrConsume;
3907 }
3908 
3909 MsgRouting AwtComponent::WmImeComposition(WORD wChar, LPARAM flags)
3910 {
3911     if (m_useNativeCompWindow)   return mrDoDefault;
3912 
3913     int*      bndClauseW = NULL;
3914     jstring*  readingClauseW = NULL;
3915     int*      bndAttrW = NULL;
3916     BYTE*     valAttrW = NULL;




3807 }
3808 
3809 void AwtComponent::OpenCandidateWindow(int x, int y)
3810 {
3811     UINT bits = 1;
3812     POINT p = {0, 0}; // upper left corner of the client area
3813     HWND hWnd = GetHWnd();
3814     if (!::IsWindowVisible(hWnd)) {
3815         return;
3816     }
3817     HWND hTop = GetTopLevelParentForWindow(hWnd);
3818     ::ClientToScreen(hTop, &p);
3819     if (!m_bitsCandType) {
3820         SetCandidateWindow(m_bitsCandType, x - p.x, y - p.y);
3821         return;
3822     }
3823     for (int iCandType=0; iCandType<32; iCandType++, bits<<=1) {
3824         if ( m_bitsCandType & bits )
3825             SetCandidateWindow(iCandType, x - p.x, y - p.y);
3826     }





3827 }
3828 
3829 void AwtComponent::SetCandidateWindow(int iCandType, int x, int y)
3830 {
3831     HWND hwnd = ImmGetHWnd();
3832     HIMC hIMC = ImmGetContext(hwnd);
3833     if (hIMC) {
3834         CANDIDATEFORM cf;

3835         cf.dwStyle = CFS_POINT;
3836         ImmGetCandidateWindow(hIMC, 0, &cf);
3837         POINT curPos = cf.ptCurrentPos;
3838         if (x != curPos.x || y != curPos.y) {
3839             cf.dwIndex = iCandType;
3840             cf.dwStyle = CFS_POINT | CFS_FORCE_POSITION;
3841             cf.ptCurrentPos = {x, y};
3842             cf.rcArea = {0, 0, 0, 0};
3843             ImmSetCandidateWindow(hIMC, &cf);
3844         }
3845         ImmReleaseContext(hwnd, hIMC);
3846     }
3847 }
3848 
3849 MsgRouting AwtComponent::WmImeSetContext(BOOL fSet, LPARAM *lplParam)
3850 {
3851     // If the Windows input context is disabled, do not let Windows
3852     // display any UIs.
3853     HWND hwnd = ImmGetHWnd();
3854     HIMC hIMC = ImmGetContext(hwnd);
3855     if (hIMC == NULL) {
3856         *lplParam = 0;
3857         return mrDoDefault;
3858     }
3859     ImmReleaseContext(hwnd, hIMC);
3860 
3861     if (fSet) {
3862         LPARAM lParam = *lplParam;
3863         if (!m_useNativeCompWindow) {
3864             // stop to draw native composing window.
3865             *lplParam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
3866         }
3867     }
3868     return mrDoDefault;
3869 }
3870 
3871 MsgRouting AwtComponent::WmImeNotify(WPARAM subMsg, LPARAM bitsCandType)
3872 {
3873     if (!m_useNativeCompWindow) {
3874         if (subMsg == IMN_OPENCANDIDATE || subMsg == IMN_CHANGECANDIDATE) {
3875             m_bitsCandType = bitsCandType;
3876             InquireCandidatePosition();
3877         } else if (subMsg == IMN_OPENSTATUSWINDOW ||
3878                    subMsg == WM_IME_STARTCOMPOSITION ||
3879                    subMsg == IMN_SETCANDIDATEPOS) {


3880             InquireCandidatePosition();
3881         }

3882     }
3883     return mrDoDefault;
3884 }
3885 
3886 MsgRouting AwtComponent::WmImeStartComposition()
3887 {
3888     if (m_useNativeCompWindow) {
3889         RECT rc;
3890         ::GetClientRect(GetHWnd(), &rc);
3891         SetCompositionWindow(rc);
3892         return mrDoDefault;
3893     } else {
3894         InquireCandidatePosition();
3895         return mrConsume;
3896     }
3897 }
3898 
3899 MsgRouting AwtComponent::WmImeEndComposition()
3900 {
3901     if (m_useNativeCompWindow)   return mrDoDefault;
3902 
3903     SendInputMethodEvent(
3904         java_awt_event_InputMethodEvent_INPUT_METHOD_TEXT_CHANGED,
3905         NULL, 0, NULL, NULL, 0, NULL, NULL, 0, 0, 0 );
3906     return mrConsume;
3907 }
3908 
3909 MsgRouting AwtComponent::WmImeComposition(WORD wChar, LPARAM flags)
3910 {
3911     if (m_useNativeCompWindow)   return mrDoDefault;
3912 
3913     int*      bndClauseW = NULL;
3914     jstring*  readingClauseW = NULL;
3915     int*      bndAttrW = NULL;
3916     BYTE*     valAttrW = NULL;


< prev index next >