Verify game's minimum size

Due to some race condition, we can't really rely on applet's minimum
size, so add verification for minimum size when size is changed.

Fixes: #2261

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-05-02 22:00:45 +02:00
parent e9d1d7e75f
commit 5a95a340cc

View File

@@ -55,6 +55,7 @@ import javax.swing.SwingUtilities;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.Constants;
import net.runelite.api.GameState;
import net.runelite.api.Point;
import net.runelite.api.events.ConfigChanged;
@@ -201,22 +202,10 @@ public class ClientUI
return;
}
int width = config.gameSize().width;
int height = config.gameSize().height;
// The upper bounds are defined by the applet's max size
// The lower bounds are taken care of by ClientPanel's setMinimumSize
if (width > 7680)
{
width = 7680;
}
if (height > 2160)
{
height = 2160;
}
// The lower bounds are defined by the client's fixed size
int width = Math.max(Math.min(config.gameSize().width, 7680), Constants.GAME_FIXED_WIDTH);
int height = Math.max(Math.min(config.gameSize().height, 2160), Constants.GAME_FIXED_HEIGHT);
final Dimension size = new Dimension(width, height);
client.setSize(size);