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:
@@ -522,8 +522,8 @@ public class ClientUI
|
|||||||
frame.setBounds(clientBounds);
|
frame.setBounds(clientBounds);
|
||||||
|
|
||||||
// frame.getGraphicsConfiguration().getBounds() returns the bounds for the primary display.
|
// 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.
|
// We have to find the correct graphics configuration by using the client boundaries.
|
||||||
GraphicsConfiguration gc = getIntersectingDisplay(clientBounds);
|
GraphicsConfiguration gc = findDisplayFromBounds(clientBounds);
|
||||||
if (gc != null)
|
if (gc != null)
|
||||||
{
|
{
|
||||||
double scale = gc.getDefaultTransform().getScaleX();
|
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();
|
GraphicsDevice[] gds = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
|
||||||
|
|
||||||
@@ -596,7 +596,7 @@ public class ClientUI
|
|||||||
GraphicsConfiguration gc = gd.getDefaultConfiguration();
|
GraphicsConfiguration gc = gd.getDefaultConfiguration();
|
||||||
|
|
||||||
final Rectangle displayBounds = gc.getBounds();
|
final Rectangle displayBounds = gc.getBounds();
|
||||||
if (displayBounds.intersects(bounds))
|
if (displayBounds.contains(bounds))
|
||||||
{
|
{
|
||||||
return gc;
|
return gc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user