clientui: use contains instead of intersects for screen bounds checking

It is possible to have the client bounds intersect the screen bounds but still have the client unusable due to being unable to resposition it.
This commit is contained in:
Adam
2020-07-28 13:42:44 -04:00
parent 24c621177a
commit a41074f135

View File

@@ -522,8 +522,8 @@ public class ClientUI
frame.setBounds(clientBounds);
// frame.getGraphicsConfiguration().getBounds() returns the bounds for the primary display.
// We have to find the correct graphics configuration by using the intersection of the client boundaries.
GraphicsConfiguration gc = getIntersectingDisplay(clientBounds);
// We have to find the correct graphics configuration by using the client boundaries.
GraphicsConfiguration gc = findDisplayFromBounds(clientBounds);
if (gc != null)
{
double scale = gc.getDefaultTransform().getScaleX();
@@ -587,7 +587,7 @@ public class ClientUI
}
}
private GraphicsConfiguration getIntersectingDisplay(final Rectangle bounds)
private GraphicsConfiguration findDisplayFromBounds(final Rectangle bounds)
{
GraphicsDevice[] gds = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
@@ -596,7 +596,7 @@ public class ClientUI
GraphicsConfiguration gc = gd.getDefaultConfiguration();
final Rectangle displayBounds = gc.getBounds();
if (displayBounds.intersects(bounds))
if (displayBounds.contains(bounds))
{
return gc;
}