changeset 50005:48637783b4f6

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
author ant
date Wed, 25 Apr 2018 21:54:42 +0530
parents b6f4bd0bf173
children 394a0387a3ab
files src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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);
     }
 }