diff options
author | Kenneth Russel <[email protected]> | 2001-12-12 07:30:20 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2001-12-12 07:30:20 +0000 |
commit | bd6683651e11f56b19940fca06de4a888bacefa0 (patch) | |
tree | 1257236ac39060d531ef26951af8a92ee308c5eb | |
parent | 48c2a0f69ee4f85e2abc0044dca76516fbf834bd (diff) |
Better support for non-fullscreen platforms
-rw-r--r-- | demos/MiscDemos/gearsFullScreen.java | 33 |
1 files 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(); |