8147842: IME Composition Window is displayed at incorrect location
authorssadetsky
Mon, 30 May 2016 10:50:32 +0300
changeset 39009 5ca8adb8492c
parent 39008 8992e2fc49aa
child 39010 37ea10c369c7
8147842: IME Composition Window is displayed at incorrect location Reviewed-by: alexsch
jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Sun May 29 02:34:28 2016 +0300
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Mon May 30 10:50:32 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3781,7 +3781,10 @@
     HWND hWnd = GetHWnd();
     HWND hTop = GetTopLevelParentForWindow(hWnd);
     ::ClientToScreen(hTop, &p);
-
+    if (!m_bitsCandType) {
+        SetCandidateWindow(m_bitsCandType, x - p.x, y - p.y);
+        return;
+    }
     for (int iCandType=0; iCandType<32; iCandType++, bits<<=1) {
         if ( m_bitsCandType & bits )
             SetCandidateWindow(iCandType, x - p.x, y - p.y);
@@ -3799,7 +3802,7 @@
     HIMC hIMC = ImmGetContext(hwnd);
     CANDIDATEFORM cf;
     cf.dwIndex = iCandType;
-    cf.dwStyle = CFS_CANDIDATEPOS;
+    cf.dwStyle = CFS_POINT;
     cf.ptCurrentPos.x = x;
     cf.ptCurrentPos.y = y;
 
@@ -3831,8 +3834,12 @@
 
 MsgRouting AwtComponent::WmImeNotify(WPARAM subMsg, LPARAM bitsCandType)
 {
-    if (!m_useNativeCompWindow && subMsg == IMN_OPENCANDIDATE) {
-        m_bitsCandType = bitsCandType;
+    if (!m_useNativeCompWindow) {
+        if (subMsg == IMN_OPENCANDIDATE) {
+            m_bitsCandType = subMsg;
+        } else if (subMsg != IMN_SETCANDIDATEPOS) {
+            m_bitsCandType = 0;
+        }
         InquireCandidatePosition();
         return mrConsume;
     }
@@ -4100,12 +4107,7 @@
     if (mr != mrConsume)  {
         HWND proxy = GetProxyFocusOwner();
         if (proxy != NULL && ::IsWindowEnabled(proxy)) {
-            if (proxy != GetHWnd()) {
-                retVal = ::SendMessage(proxy, message, wParam, lParam);
-            } else {
-                retVal = ComCtl32Util::GetInstance().DefWindowProc(NULL,
-                                                proxy, message, wParam, lParam);
-            }
+            retVal = ::DefWindowProc(proxy, message, wParam, lParam);
             mr = mrConsume;
         }
     }