fix disabling fullscreen mode while on native resolution not applying borderless

This commit is contained in:
yugecin 2018-10-02 22:48:11 +02:00
parent 21c552bd16
commit 8e272df5fc
No known key found for this signature in database
GPG Key ID: 2C5AC035A7068E44
2 changed files with 9 additions and 8 deletions

View File

@ -351,6 +351,13 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
width = Integer.parseInt(res[0]);
height = Integer.parseInt(res[1]);
}
updateDisplayMode(width, height);
}
public void updateDisplayMode(int width, int height) {
int screenWidth = nativeDisplayMode.getWidth();
int screenHeight = nativeDisplayMode.getHeight();
// check for larger-than-screen dimensions
if (!OPTION_ALLOW_LARGER_RESOLUTIONS.state && (screenWidth < width || screenHeight < height)) {
@ -366,7 +373,7 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
try {
setDisplayMode(width, height, OPTION_FULLSCREEN.state);
} catch (Exception e) {
bubNotifs.send(BUB_RED, "Failed to change resolution");
bubNotifs.send(BUB_RED, "Failed to change display mode");
Log.error("Failed to set display mode.", e);
}
}

View File

@ -21,7 +21,6 @@ import awlex.ospu.polymover.factory.PolyMoverFactory;
import itdelatrisu.opsu.GameImage;
import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.states.Game;
import itdelatrisu.opsu.ui.Colors;
import itdelatrisu.opsu.ui.Fonts;
import org.lwjgl.input.Keyboard;
import org.newdawn.slick.SlickException;
@ -191,12 +190,7 @@ public class Options {
public void toggle()
{
super.toggle();
try {
displayContainer.setDisplayMode(width, height, state);
} catch (Exception e) {
bubNotifs.send(Colors.BUB_RED, "Failed to change fullscreen state");
Log.error("Failed to change fullscreen state.", e);
}
displayContainer.updateDisplayMode(width, height);
}
};
public static final ListOption OPTION_SKIN = new ListOption("Skin", "Skin", "Change how the game looks.") {