From e809c1f7f0b9b5ed3aac7524230758161ebb9118 Mon Sep 17 00:00:00 2001 From: Brian Matzon Date: Wed, 15 Aug 2007 20:14:29 +0000 Subject: [PATCH] fix: make sure that we return to the same display mode that was set in windowed mode when toggling between fullscreen and windowed mode --- src/java/org/lwjgl/opengl/Display.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/java/org/lwjgl/opengl/Display.java b/src/java/org/lwjgl/opengl/Display.java index ba0db008..a63b64bd 100644 --- a/src/java/org/lwjgl/opengl/Display.java +++ b/src/java/org/lwjgl/opengl/Display.java @@ -82,6 +82,9 @@ public final class Display { /** Cached window icons, for when Display is recreated */ private static ByteBuffer[] cached_icons; + + /** Display mode used prior to entering fullscreen */ + private static DisplayMode windowed_display_mode; /** * Y coordinate of the window. Y in window coordinates is from the top of the display down, @@ -298,6 +301,7 @@ public final class Display { private static void switchDisplayMode() throws LWJGLException { if (!current_mode.isFullscreen()) { LWJGLUtil.log("Switching to "+initial_mode); + windowed_display_mode = current_mode; setDisplayMode(initial_mode); } display_impl.switchDisplayMode(current_mode); @@ -473,6 +477,7 @@ public final class Display { switchDisplayMode(); } else { display_impl.resetDisplayMode(); + current_mode = windowed_display_mode; } createWindow(); makeCurrentAndSetSwapInterval(); @@ -844,6 +849,7 @@ public final class Display { destroyPeerInfo(); x = y = -1; cached_icons = null; + windowed_display_mode = null; reset(); removeShutdownHook(); }