From f49348e1abfac846c285f618b506eeb0e3d6bef8 Mon Sep 17 00:00:00 2001 From: WooxSolo Date: Wed, 30 May 2018 21:19:14 +0200 Subject: [PATCH] Move frame to right screen border when expanding large window When playing on almost fullscreen, the window would previously expand through the left edge without filling up the right edge space first upon starting the client --- .../java/net/runelite/client/ui/ContainableFrame.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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();