From 081523f2ecfc3a03b278c1a29f26ccbcc08e72f2 Mon Sep 17 00:00:00 2001 From: Carsten Weisse Date: Mon, 11 Dec 2006 22:16:06 +0000 Subject: hope this helps on win32 screen mode switching --- src/jake2/render/opengl/Jsr231Driver.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/jake2/render/opengl/Jsr231Driver.java b/src/jake2/render/opengl/Jsr231Driver.java index f50ee4c..a9d44e1 100644 --- a/src/jake2/render/opengl/Jsr231Driver.java +++ b/src/jake2/render/opengl/Jsr231Driver.java @@ -138,8 +138,10 @@ public abstract class Jsr231Driver extends Jsr231GL implements GLDriver { /* * fullscreen handling */ - GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); - device = env.getDefaultScreenDevice(); + if (device == null) { + GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); + device = env.getDefaultScreenDevice(); + } if (oldDisplayMode == null) { oldDisplayMode = device.getDisplayMode(); @@ -201,14 +203,10 @@ public abstract class Jsr231Driver extends Jsr231GL implements GLDriver { VID.Printf(Defines.PRINT_ALL, "...setting fullscreen " + getModeString(displayMode) + '\n'); } else { - // Not much point in having a full-screen window in this - // case - device.setFullScreenWindow(null); final Frame f2 = window; try { EventQueue.invokeAndWait(new Runnable() { public void run() { - f2.setVisible(false); f2.setLocation(window_xpos, window_ypos); f2.pack(); f2.setResizable(false); @@ -249,8 +247,11 @@ public abstract class Jsr231Driver extends Jsr231GL implements GLDriver { if (oldDisplayMode != null && device.getFullScreenWindow() != null) { try { - if (device.isFullScreenSupported()) - device.setDisplayMode(oldDisplayMode); + if (device.isFullScreenSupported()) { + if (!device.getDisplayMode().equals(oldDisplayMode)) + device.setDisplayMode(oldDisplayMode); + + } device.setFullScreenWindow(null); } catch (Exception e) { e.printStackTrace(); -- cgit v1.2.3