diff options
Diffstat (limited to 'src/newt/classes/com/sun')
3 files changed, 26 insertions, 20 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDWindow.java b/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDWindow.java index df0134c8e..1265fa9e2 100755 --- a/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDWindow.java +++ b/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDWindow.java @@ -79,7 +79,7 @@ public class KDWindow extends Window { } public void setVisible(boolean visible) { - if(this.visible!=visible) { + if(0!=eglWindowHandle && this.visible!=visible) { this.visible=visible; setVisible0(eglWindowHandle, visible); if ( 0==windowHandle ) { @@ -93,7 +93,9 @@ public class KDWindow extends Window { } public void setSize(int width, int height) { - setSize0(eglWindowHandle, width, height); + if(0!=eglWindowHandle) { + setSize0(eglWindowHandle, width, height); + } } public void setPosition(int x, int y) { @@ -102,7 +104,7 @@ public class KDWindow extends Window { } public boolean setFullscreen(boolean fullscreen) { - if(this.fullscreen!=fullscreen) { + if(0!=eglWindowHandle && this.fullscreen!=fullscreen) { this.fullscreen=fullscreen; if(this.fullscreen) { setFullScreen0(eglWindowHandle, true); diff --git a/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java b/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java index c42aaa6d9..a173baff0 100755 --- a/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java +++ b/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java @@ -54,7 +54,7 @@ public class WindowsWindow extends Window { } public long getSurfaceHandle() { - if (hdc == 0) { + if (hdc == 0 && 0!=windowHandle) { hdc = GetDC(windowHandle); hmon = MonitorFromWindow(windowHandle); if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { @@ -67,21 +67,23 @@ public class WindowsWindow extends Window { } public boolean hasDeviceChanged() { - long _hmon = MonitorFromWindow(windowHandle); - if (hmon != _hmon) { - if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { - Exception e = new Exception("!!! Window Device Changed "+Thread.currentThread().getName()+ - ", HMON 0x"+Long.toHexString(hmon)+" -> 0x"+Long.toHexString(_hmon)); - e.printStackTrace(); + if(0!=windowHandle) { + long _hmon = MonitorFromWindow(windowHandle); + if (hmon != _hmon) { + if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { + Exception e = new Exception("!!! Window Device Changed "+Thread.currentThread().getName()+ + ", HMON 0x"+Long.toHexString(hmon)+" -> 0x"+Long.toHexString(_hmon)); + e.printStackTrace(); + } + hmon = _hmon; + return true; } - hmon = _hmon; - return true; } return false; } public void disposeSurfaceHandle() { - if (hdc != 0) { + if (0!=hdc && 0!=windowHandle) { ReleaseDC(windowHandle, hdc); hdc=0; if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { @@ -124,7 +126,7 @@ public class WindowsWindow extends Window { } public void setVisible(boolean visible) { - if(this.visible!=visible) { + if(this.visible!=visible && 0!=windowHandle) { this.visible=visible; setVisible0(windowHandle, visible); } @@ -132,7 +134,7 @@ public class WindowsWindow extends Window { // @Override public void setSize(int width, int height) { - if (width != this.width || this.height != height) { + if (0!=windowHandle && (width != this.width || this.height != height)) { if(!fullscreen) { nfs_width=width; nfs_height=height; @@ -145,7 +147,7 @@ public class WindowsWindow extends Window { //@Override public void setPosition(int x, int y) { - if (this.x != x || this.y != y) { + if (0!=windowHandle && (this.x != x || this.y != y)) { if(!fullscreen) { nfs_x=x; nfs_y=y; @@ -157,7 +159,7 @@ public class WindowsWindow extends Window { } public boolean setFullscreen(boolean fullscreen) { - if(this.fullscreen!=fullscreen) { + if(0!=windowHandle && (this.fullscreen!=fullscreen)) { int x,y,w,h; this.fullscreen=fullscreen; if(fullscreen) { @@ -191,7 +193,7 @@ public class WindowsWindow extends Window { if (title == null) { title = ""; } - if (!title.equals(getTitle())) { + if (0!=windowHandle && !title.equals(getTitle())) { super.setTitle(title); setTitle(windowHandle, title); } diff --git a/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java b/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java index bd6bb42c2..380c968d1 100755 --- a/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java +++ b/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java @@ -84,7 +84,7 @@ public class X11Window extends Window { } public void setVisible(boolean visible) { - if(this.visible!=visible) { + if(0!=windowHandle && this.visible!=visible) { this.visible=visible; setVisible0(getDisplayHandle(), windowHandle, visible); clearEventMask(); @@ -96,6 +96,7 @@ public class X11Window extends Window { } public void setSize(int width, int height) { + if(0==windowHandle) return; if(!fullscreen) { nfs_width=width; nfs_height=height; @@ -104,6 +105,7 @@ public class X11Window extends Window { } public void setPosition(int x, int y) { + if(0==windowHandle) return; if(!fullscreen) { nfs_x=x; nfs_y=y; @@ -112,7 +114,7 @@ public class X11Window extends Window { } public boolean setFullscreen(boolean fullscreen) { - if(this.fullscreen!=fullscreen) { + if(0!=windowHandle && this.fullscreen!=fullscreen) { int x,y,w,h; this.fullscreen=fullscreen; if(fullscreen) { |