8189687: Swing: Invalid position of candidate pop-up of InputMethod in Hi-DPI on Windows
authorant
Wed, 25 Apr 2018 21:54:42 +0530
changeset 50005 48637783b4f6
parent 50004 b6f4bd0bf173
child 50006 394a0387a3ab
8189687: Swing: Invalid position of candidate pop-up of InputMethod in Hi-DPI on Windows Reviewed-by: serb, psadhukhan Contributed-by: anton.tarasov@jetbrains.com
src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
--- a/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Tue Apr 24 15:42:58 2018 +0100
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Wed Apr 25 21:54:42 2018 +0530
@@ -3880,19 +3880,21 @@
 {
     UINT bits = 1;
     POINT p = {0, 0}; // upper left corner of the client area
-    HWND hWnd = GetHWnd();
+    HWND hWnd = ImmGetHWnd();
     if (!::IsWindowVisible(hWnd)) {
         return;
     }
     HWND hTop = GetTopLevelParentForWindow(hWnd);
     ::ClientToScreen(hTop, &p);
+    int sx = ScaleUpX(x) - p.x;
+    int sy = ScaleUpY(y) - p.y;
     if (!m_bitsCandType) {
-        SetCandidateWindow(m_bitsCandType, x - p.x, y - p.y);
+        SetCandidateWindow(m_bitsCandType, sx, sy);
         return;
     }
     for (int iCandType=0; iCandType<32; iCandType++, bits<<=1) {
         if ( m_bitsCandType & bits )
-            SetCandidateWindow(iCandType, x - p.x, y - p.y);
+            SetCandidateWindow(iCandType, sx, sy);
     }
 }