From bd6683651e11f56b19940fca06de4a888bacefa0 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Wed, 12 Dec 2001 07:30:20 +0000 Subject: Better support for non-fullscreen platforms --- demos/MiscDemos/gearsFullScreen.java | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/demos/MiscDemos/gearsFullScreen.java b/demos/MiscDemos/gearsFullScreen.java index e51ba84..458ed05 100644 --- a/demos/MiscDemos/gearsFullScreen.java +++ b/demos/MiscDemos/gearsFullScreen.java @@ -136,6 +136,7 @@ public class gearsFullScreen extends SimpleGLAnimApplet1 applet.canvas.getUseFpsSleep()); } + mainFrame.setResizable(true); mainFrame.setSize(initWidth, initHeight); mainFrame.show(); mainFrame.setLocation(0, 0); @@ -143,22 +144,26 @@ public class gearsFullScreen extends SimpleGLAnimApplet1 if (device.isFullScreenSupported()) { device.setFullScreenWindow(mainFrame); if (device.isDisplayChangeSupported()) { - device.setDisplayMode(newMode); - } else { - newMode = null; - } - final DisplayMode tmpMode = newMode; - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - if (tmpMode != null) { - try { - device.setDisplayMode(origMode); - } catch (Exception e) { + if (newMode != null) { + device.setDisplayMode(newMode); + } + final DisplayMode tmpMode = newMode; + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + if (tmpMode != null) { + try { + device.setDisplayMode(origMode); + } catch (Exception e) { + } } + device.setFullScreenWindow(null); } - device.setFullScreenWindow(null); - } - }); + }); + } else { + // Not much point in having a full-screen window in this case + device.setFullScreenWindow(null); + mainFrame.setSize(origMode.getWidth(), origMode.getHeight()); + } } applet.start(); -- cgit v1.2.3