Skip to content

Commit

Permalink
clientui: adjust for frame insets when performing display bounds check
Browse files Browse the repository at this point in the history
This prevents the client resetting its position when it is too close to the display edge due to the insets
  • Loading branch information
Adam- committed Jan 25, 2024
1 parent 0b67e33 commit 144e226
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,15 @@ public void show()
frame.setBounds(clientBounds);
appliedSize = true;

// Adjust for insets before performing display test
Insets insets = frame.getInsets();
clientBounds = new Rectangle(
clientBounds.x + insets.left,
clientBounds.y + insets.top,
clientBounds.width - (insets.left + insets.right),
clientBounds.height - (insets.top + insets.bottom)
);

// Check that the bounds are contained inside a valid display
GraphicsConfiguration gc = findDisplayFromBounds(clientBounds);
if (gc == null)
Expand Down

0 comments on commit 144e226

Please sign in to comment.