Merge pull request #3499 from WooxSolo/client-close-remember-fix

Fix remember screen bounds for KEEP_GAME_SIZE
This commit is contained in:
Adam
2018-06-03 15:04:08 -04:00
committed by GitHub
2 changed files with 18 additions and 9 deletions

View File

@@ -755,16 +755,19 @@ public class ClientUI
{ {
final Rectangle bounds = frame.getBounds(); final Rectangle bounds = frame.getBounds();
// Try to contract sidebar if (config.automaticResizeType() == ExpandResizeType.KEEP_GAME_SIZE)
if (sidebarOpen)
{ {
bounds.width -= pluginToolbar.getWidth(); // Try to contract sidebar
} if (sidebarOpen)
{
bounds.width -= pluginToolbar.getWidth();
}
// Try to contract plugin panel // Try to contract plugin panel
if (pluginPanel != null) if (pluginPanel != null)
{ {
bounds.width -= pluginPanel.getWrappedPanel().getPreferredSize().width; bounds.width -= pluginPanel.getWrappedPanel().getPreferredSize().width;
}
} }
configManager.unsetConfiguration(CONFIG_GROUP, CONFIG_CLIENT_MAXIMIZED); configManager.unsetConfiguration(CONFIG_GROUP, CONFIG_CLIENT_MAXIMIZED);

View File

@@ -119,7 +119,7 @@ public class ContainableFrame extends JFrame
if (wouldExpandThroughEdge) if (wouldExpandThroughEdge)
{ {
if (!isFrameCloseToRightEdge()) if (!isFrameCloseToRightEdge() || isFrameCloseToLeftEdge())
{ {
// Move the window to the edge // Move the window to the edge
newWindowX = (int)(screenBounds.getX() + screenBounds.getWidth()) - getWidth(); newWindowX = (int)(screenBounds.getX() + screenBounds.getWidth()) - getWidth();
@@ -186,6 +186,12 @@ public class ContainableFrame extends JFrame
return (getExtendedState() & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH; return (getExtendedState() & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH;
} }
private boolean isFrameCloseToLeftEdge()
{
Rectangle screenBounds = getGraphicsConfiguration().getBounds();
return Math.abs(getX() - screenBounds.getX()) <= SCREEN_EDGE_CLOSE_DISTANCE;
}
private boolean isFrameCloseToRightEdge() private boolean isFrameCloseToRightEdge()
{ {
Rectangle screenBounds = getGraphicsConfiguration().getBounds(); Rectangle screenBounds = getGraphicsConfiguration().getBounds();