Skip to content

Commit

Permalink
Verify game's minimum size
Browse files Browse the repository at this point in the history
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: runelite#2261

Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed May 2, 2018
1 parent f37dda9 commit e90f8aa
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
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;
Expand Down Expand Up @@ -201,22 +202,10 @@ public void onConfigChanged(ConfigChanged event)
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);
Expand Down

0 comments on commit e90f8aa

Please sign in to comment.