mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Fixed client drifting when rappidly toggling the GLWindow
This commit is contained in:
parent
6feb20a331
commit
8d0c0a629e
1 changed files with 6 additions and 3 deletions
|
@ -91,6 +91,9 @@ public class GLWindow extends DropTarget {
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int frameFactorX;
|
||||||
|
private int frameFactorY;
|
||||||
|
|
||||||
private synchronized void open() throws LWJGLException {
|
private synchronized void open() throws LWJGLException {
|
||||||
// Dimensions from LWJGL may have a non 1:1 scale on high DPI monitors.
|
// Dimensions from LWJGL may have a non 1:1 scale on high DPI monitors.
|
||||||
int x = getScaledPixelUnit(Display.getX());
|
int x = getScaledPixelUnit(Display.getX());
|
||||||
|
@ -128,8 +131,8 @@ 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.
|
||||||
int frameFactorX = frame.getWidth() - frame.getContentPane().getWidth();
|
frameFactorX = frame.getWidth() - frame.getContentPane().getWidth();
|
||||||
int frameFactorY = frame.getHeight() - frame.getContentPane().getHeight();
|
frameFactorY = frame.getHeight() - frame.getContentPane().getHeight();
|
||||||
|
|
||||||
frame.setSize(w + frameFactorX, h + frameFactorY);
|
frame.setSize(w + frameFactorX, h + frameFactorY);
|
||||||
}
|
}
|
||||||
|
@ -176,7 +179,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(Math.max(0, frame.getX()), Math.max(0, frame.getY()));
|
Display.setLocation(Math.max(0, frame.getX() + frameFactorX/3), Math.max(0, frame.getY() + frameFactorX/3));
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://bugs.mojang.com/browse/MC-68754
|
// https://bugs.mojang.com/browse/MC-68754
|
||||||
|
|
Loading…
Reference in a new issue