mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 06:18:00 +01:00
fixed rapidly toggling the GLWindow causes the client to slide up and off the screen
This commit is contained in:
parent
bba9a36996
commit
7e78804157
1 changed files with 5 additions and 5 deletions
|
@ -66,7 +66,7 @@ public class GLWindow extends DropTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getScaledPixelUnit(int i) {
|
private static int getScaledPixelUnit(int i) {
|
||||||
return (int)Math.floor(i * Display.getPixelScaleFactor());
|
return Math.max((int)Math.floor(i * Display.getPixelScaleFactor()), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Minecraft mc = Minecraft.getMinecraft();
|
private final Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
@ -128,10 +128,10 @@ public class GLWindow extends DropTarget {
|
||||||
public void windowOpened(WindowEvent e) {
|
public void windowOpened(WindowEvent e) {
|
||||||
// Once the window has opened compare the content and window dimensions to get
|
// Once the window has opened compare the content and window dimensions to get
|
||||||
// the OS's frame size then reassign adjusted dimensions to match LWJGL's window.
|
// the OS's frame size then reassign adjusted dimensions to match LWJGL's window.
|
||||||
float frameFactorX = frame.getWidth() - frame.getContentPane().getWidth();
|
int frameFactorX = frame.getWidth() - frame.getContentPane().getWidth();
|
||||||
float frameFactorY = frame.getHeight() - frame.getContentPane().getHeight();
|
int frameFactorY = frame.getHeight() - frame.getContentPane().getHeight();
|
||||||
|
|
||||||
frame.setSize((int)Math.floor(w + frameFactorX), (int)Math.floor(h + frameFactorY));
|
frame.setSize(w + frameFactorX, h + frameFactorY);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
frame.addComponentListener(new ComponentAdapter() {
|
frame.addComponentListener(new ComponentAdapter() {
|
||||||
|
@ -176,7 +176,7 @@ public class GLWindow extends DropTarget {
|
||||||
Display.setDisplayMode(Display.getDesktopDisplayMode());
|
Display.setDisplayMode(Display.getDesktopDisplayMode());
|
||||||
} else {
|
} else {
|
||||||
Display.setDisplayMode(new DisplayMode(frame.getContentPane().getWidth(), frame.getContentPane().getHeight()));
|
Display.setDisplayMode(new DisplayMode(frame.getContentPane().getWidth(), frame.getContentPane().getHeight()));
|
||||||
Display.setLocation(frame.getX(), frame.getY());
|
Display.setLocation(Math.max(0, frame.getX()), Math.max(0, frame.getY()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://bugs.mojang.com/browse/MC-68754
|
// https://bugs.mojang.com/browse/MC-68754
|
||||||
|
|
Loading…
Reference in a new issue