RFR: 8261840: Submenus close to screen borders are no longer repositioned

Robert Lichtenberger rlichten at openjdk.java.net
Tue Apr 20 06:23:06 UTC 2021


On Tue, 23 Feb 2021 15:32:17 GMT, Robert Lichtenberger <rlichten at openjdk.org> wrote:

> Reverting to the old way of showing the context menu but with application
> of CSS prior to calling prefHeight(-1) / prefWidth(-1) to ensure correct
> size measurement of the menu.

I've finally managed to build JavaFX under Windows and tried out MenuShowBug.java from JDK-8228363 under different setups:

**JavaFX 16**: Does not contain any fix for JDK-8228363 and thus will always show the menu at the wrong position when opened the first time.

**PR-383**: This was the version that used AnchorLocation. When using 125% DPI, it works well, but not perfect, i.e. when only one of my two screens is set to 125% DPI, gaps still appear sometimes. However this solution is unacceptable anyway, due to the issue described in JDK-8261840 (for which this PR is the fix).

**PR-410** (i.e.: this PR): I can reproduce the problem of @kevinrushforth (i.e. gap on first click). Since up to JavaFX 16 the first opening of the menu never worked under any DPI setting, this is not a regression but rather another issue that we need to look into. 

To be on the safe side, I also checked MenuShowBug without any stylesheets:
* JavaFX 16: Works perfectly with 100% DPI, menu slightly too low with 125% DPI
* PR-410: Works perfectly with 100% DPI, menu slightly too low with 125% DPI
i.e. no difference.

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

PR: https://git.openjdk.java.net/jfx/pull/410


More information about the openjfx-dev mailing list