Integrated: 6415065: Submenu is shown on wrong screen in multiple monitor environment

Sergei Tachenov duke at openjdk.org
Thu Sep 21 09:03:52 UTC 2023


On Tue, 8 Aug 2023 08:44:25 GMT, Sergei Tachenov <duke at openjdk.org> wrote:

> Hello!
> 
> I'm a member of the UI team in JetBrains IntelliJ department, and we have this bug with popup menus being shown on the wrong monitor in multi-monitor environments:
> 
> https://youtrack.jetbrains.com/issue/JBR-5824/Dual-monitor-bug-on-the-context-menu
> 
> I managed to track it down to this JDK bug:
> 
> https://bugs.openjdk.org/browse/JDK-6415065
> 
> I've described the cause and the fix in the commit message, but in short, what happens here is that `JMenu.getPopupMenuOrigin` sometimes returns coordinates outside (usually above) of the current screen, and later `JPopupMenu.adjustPopupLocationToFitScreen` uses those coordinates to fit the entire popup menu into the screen, which goes wrong because at that point it's no longer known which screen the menu was initially invoked on.
> 
> I've fixed this by making sure the Y coordinate is still within the correct screen when it's returned from `JMenu.getPopupMenuOrigin`.

This pull request has now been integrated.

Changeset: 23ed890f
Author:    Sergei Tachenov <sergei.tachenov at jetbrains.com>
Committer: Alexey Ushakov <avu at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/23ed890f3ff25296fb8dbb59532b9079e0326db9
Stats:     17 lines in 1 file changed: 17 ins; 0 del; 0 mod

6415065: Submenu is shown on wrong screen in multiple monitor environment

Reviewed-by: prr

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

PR: https://git.openjdk.org/jdk/pull/15185


More information about the client-libs-dev mailing list