From 38f1d2e71fd6ed17bb56d0baad463feaac1a8575 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 2 Oct 2021 13:20:37 -0400 Subject: [PATCH] ui: recompute minimum size after frame restore Without this, the minimum size will be the same size as was prior to maximizing the frame. If the side bar or panel is opened or closed when maximized this can cause the minimum size to be incorrect after a restore. Co-authored-by: Mark Koester Co-authored-by: Jeremy Plsek --- .../main/java/net/runelite/client/ui/ClientUI.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 fbb85f09bb..c887a54682 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 @@ -32,6 +32,7 @@ import java.awt.Component; import java.awt.Container; import java.awt.Cursor; import java.awt.Dimension; +import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GraphicsConfiguration; @@ -361,6 +362,16 @@ public class ClientUI } }); + frame.addWindowStateListener(l -> + { + if (l.getNewState() == Frame.NORMAL) + { + // Recompute minimum size after a restore. + // Invoking this immediately causes the minimum size to be 8px too small with custom chrome on. + SwingUtilities.invokeLater(frame::revalidateMinimumSize); + } + }); + container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS)); container.add(new ClientPanel(client));