[jdk8u-dev] RFR: 8189687: Swing: Invalid position of candidate pop-up of InputMethod in Hi-DPI on Windows [v2]

Kazuhisa Takakuri ktakakuri at openjdk.org
Fri Nov 1 07:21:13 UTC 2024


> This is a backport of JDK-8189687: Swing: Invalid position of candidate pop-up of InputMethod in Hi-DPI on Windows.
> JDK-8189687 contains two fixes to AwtComponent:.OpenCandidateWindow, one of which is backported in this pull request.
> The other fix is an enhancement to JEP 263 (JDK-8055212) and is not needed since JDK8 does not implement JEP 263.
> 
> 1. Fix to make OpenCandidateWindow reference the correct Window
> Fix OpenCandidateWindow to reference the proxy window that has focus when getting "HWND."
> 
> 
> --- a/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
> +++ b/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
> @@ -3880,19 +3880,21 @@ void AwtComponent::OpenCandidateWindow(int x, int y)
>  {
>      UINT bits = 1;
>      POINT p = {0, 0}; // upper left corner of the client area
> -    HWND hWnd = GetHWnd();
> +    HWND hWnd = ImmGetHWnd();
>      if (!::IsWindowVisible(hWnd)) {
>          return;
>      }
> 
> 
> 
> 2. Scaling fixes to enhance JDK-8073320
> OpenJDK9 has supported HiDPI Graphics since JEP 263 (JDK-8055212). This fix is one of its enhancements: when OpenCandidateWindow opens an IME conversion candidate, it corrects the coordinates for the device.
> 
> 
> In the attached test that reproduces the issue problem, the Panel containing the TextField is a child component, so it refers to the wrong window to get the position coordinate of the candidate window.
> Therefore, the candidate window will appear in the correct position with the "1" fix.
> Note that OpenJDK8 does not implement JEP 263, so the "2" fix is not included in this pull request.

Kazuhisa Takakuri has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Merge branch 'master' into 8189687
 - Fix the Copyright year
 - Backport 489e5ae3349370825b7faa1d7514796a2b1ac1c7

-------------

Changes:
  - all: https://git.openjdk.org/jdk8u-dev/pull/564/files
  - new: https://git.openjdk.org/jdk8u-dev/pull/564/files/18a33806..bad6946f

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=564&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=564&range=00-01

  Stats: 34458 lines in 212 files changed: 6553 ins; 26804 del; 1101 mod
  Patch: https://git.openjdk.org/jdk8u-dev/pull/564.diff
  Fetch: git fetch https://git.openjdk.org/jdk8u-dev.git pull/564/head:pull/564

PR: https://git.openjdk.org/jdk8u-dev/pull/564


More information about the jdk8u-dev mailing list