On Wed, 7 Dec 2022 20:12:56 GMT, Kevin Rushforth <[email protected]> wrote:

> On Windows platforms with more than one screen, a PopupWindow created for a 
> Stage that straddles two windows will be drawn with an incorrect position and 
> screen scale if the majority of the Stage is on one screen, and the popup is 
> positioned on the other screen. In this case, the Stage is drawn using the 
> screen scale of the screen that most of the window is on, while the popup is 
> drawn using the scale of the screen that it is (typically entirely) on.
> 
> The most common way this can happen is when you have two screens of a 
> different scale with the secondary screen on the left or above the primary 
> screen. If you position the Stage such that most of it is still on the 
> primary screen (thus the Stage is drawn using the scale of the primary 
> screen), with a menu, a control with a context menu, or a control with a 
> Tooltip now on the secondary screen, the popup window for the menu or Tooltip 
> will be drawn using the screen scale of the secondary window and thus won't 
> be positioned or sized correctly relative to the menu bar, or control in the 
> main window.
> 
> The fix implemented by this PR is to always use the screen of the owner 
> window, including the screen scales, when rendering a popup window. This 
> matches the behavior of native Windows apps, such as Notepad.

As a note for reviewers: While testing this I found a few cases where it clamps 
the position of a popup drawn on the second monitor near the edges to something 
closer to the middle of the screen. This might be a separate issue (my guess is 
that it probably is), but be on the look out for anything odd in your testing.

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

PR: https://git.openjdk.org/jfx/pull/971

Reply via email to