aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2006-12-11 21:56:10 +0000
committerCarsten Weisse <[email protected]>2006-12-11 21:56:10 +0000
commit8d6db3172d571a9fd3303e78a4768cded9029fcf (patch)
tree1431bf7c4989aa0e211f19d1ef67007f6d75ea5e /src/jake2/render
parent94a3846d87e55e09a32c489fc6b8231accb70349 (diff)
hope this helps on win32 screen mode switching
Diffstat (limited to 'src/jake2/render')
-rw-r--r--src/jake2/render/opengl/Jsr231Driver.java54
1 files changed, 33 insertions, 21 deletions
diff --git a/src/jake2/render/opengl/Jsr231Driver.java b/src/jake2/render/opengl/Jsr231Driver.java
index 4b42f3a..f50ee4c 100644
--- a/src/jake2/render/opengl/Jsr231Driver.java
+++ b/src/jake2/render/opengl/Jsr231Driver.java
@@ -51,7 +51,7 @@ public abstract class Jsr231Driver extends Jsr231GL implements GLDriver {
private GraphicsDevice device;
private DisplayMode oldDisplayMode;
- private Display display;
+ private volatile Display display;
private volatile Frame window;
// window position on the screen
@@ -153,7 +153,7 @@ public abstract class Jsr231Driver extends Jsr231GL implements GLDriver {
VID.Printf(Defines.PRINT_ALL, " " + newDim.width + " " + newDim.height + '\n');
// destroy the existing window
- shutdown();
+ if (window != null) shutdown();
window = new Frame("Jake2 (jsr231)");
ImageIcon icon = new ImageIcon(getClass().getResource("/icon-small.png"));
@@ -240,28 +240,40 @@ public abstract class Jsr231Driver extends Jsr231GL implements GLDriver {
}
public void shutdown() {
- try {
- EventQueue.invokeAndWait(new Runnable() {
- public void run() {
- if (oldDisplayMode != null
- && device.getFullScreenWindow() != null) {
- try {
- if (device.isFullScreenSupported())
- device.setDisplayMode(oldDisplayMode);
- device.setFullScreenWindow(null);
- } catch (Exception e) {
- e.printStackTrace();
+ Thread exit = new Thread(new Runnable() {
+ public void run() {
+
+ try {
+ EventQueue.invokeAndWait(new Runnable() {
+ public void run() {
+ if (oldDisplayMode != null
+ && device.getFullScreenWindow() != null) {
+ try {
+ if (device.isFullScreenSupported())
+ device.setDisplayMode(oldDisplayMode);
+ device.setFullScreenWindow(null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
- }
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
}
- });
- } catch (Exception e) {
- e.printStackTrace();
- }
- if (window != null) {
- display.destroy();
- window.dispose();
+ if (window != null) {
+ display.destroy();
+ window.dispose();
+ }
+ }
+ });
+ exit.start();
+ try {
+ exit.join();
+ } catch (InterruptedException e) {
}
+ display = null;
+
}
/**