On Thu, 10 Aug 2023 05:04:48 GMT, Sergei Tachenov <[email protected]> wrote:

>> src/java.desktop/share/classes/javax/swing/JMenu.java line 489:
>> 
>>> 487:         }
>>> 488:         if (position.y + y >= screenBounds.y + screenBounds.height) { 
>>> // Below the current screen?
>>> 489:             y = screenBounds.y + screenBounds.height - 1 - position.y; 
>>> // Fit into the screen, relative to our origin.
>> 
>> why only the y coordinate is checked? Can we implement it for x as well for 
>> symmetry?
>
> A good idea. I was actually thinking about it after I had submitted this. 
> Even though I've never encountered any issues with the X coordinate, I think 
> it's still possible in theory in some unusual circumstances. Anyway, an extra 
> check definitely won't hurt. Will do.

Added the X coordinate checks as well. While I was testing it, I noticed that 
sometimes the screen bounds are already wrong here because the graphics 
configuration is returned for the wrong display above. It happens, for example, 
in Ubuntu, when a window spans across two monitors. This seems to be a separate 
issue, though, and I can't do anything about it here, it's something deeper 
inside the internals, and likely is platform-dependent.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15185#discussion_r1289975698

Reply via email to