diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java index 11d1212583..b0e49d65d3 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java @@ -755,16 +755,19 @@ public class ClientUI { final Rectangle bounds = frame.getBounds(); - // Try to contract sidebar - if (sidebarOpen) + if (config.automaticResizeType() == ExpandResizeType.KEEP_GAME_SIZE) { - bounds.width -= pluginToolbar.getWidth(); - } + // Try to contract sidebar + if (sidebarOpen) + { + bounds.width -= pluginToolbar.getWidth(); + } - // Try to contract plugin panel - if (pluginPanel != null) - { - bounds.width -= pluginPanel.getWrappedPanel().getPreferredSize().width; + // Try to contract plugin panel + if (pluginPanel != null) + { + bounds.width -= pluginPanel.getWrappedPanel().getPreferredSize().width; + } } configManager.unsetConfiguration(CONFIG_GROUP, CONFIG_CLIENT_MAXIMIZED); diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ContainableFrame.java b/runelite-client/src/main/java/net/runelite/client/ui/ContainableFrame.java index f168baffa0..0748731c9a 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/ContainableFrame.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/ContainableFrame.java @@ -119,7 +119,7 @@ public class ContainableFrame extends JFrame if (wouldExpandThroughEdge) { - if (!isFrameCloseToRightEdge()) + if (!isFrameCloseToRightEdge() || isFrameCloseToLeftEdge()) { // Move the window to the edge newWindowX = (int)(screenBounds.getX() + screenBounds.getWidth()) - getWidth(); @@ -186,6 +186,12 @@ public class ContainableFrame extends JFrame 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() { Rectangle screenBounds = getGraphicsConfiguration().getBounds();