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 <mark.koester1@gmail.com> Co-authored-by: Jeremy Plsek <jeremyplsek@gmail.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user