diff options
Diffstat (limited to 'src/newt')
-rw-r--r-- | src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java | 24 | ||||
-rwxr-xr-x | src/newt/classes/com/sun/javafx/newt/Window.java | 2 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java b/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java index 4b35f2562..c8e3c7c9e 100644 --- a/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java +++ b/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java @@ -35,12 +35,14 @@ package com.sun.javafx.newt; import javax.media.nativewindow.*; -public class OffscreenWindow extends Window { +public class OffscreenWindow extends Window implements SurfaceChangeable { + + long surfaceHandle = 0; public OffscreenWindow() { } - static long nextWindowHandle = 1; + static long nextWindowHandle = 0x100; // start here - a marker protected void createNative(long parentWindowHandle, Capabilities caps) { if(0!=parentWindowHandle) { @@ -50,7 +52,7 @@ public class OffscreenWindow extends Window { throw new NativeWindowException("Capabilities is onscreen"); } AbstractGraphicsScreen aScreen = screen.getGraphicsScreen(); - config = new DefaultGraphicsConfiguration(aScreen, caps, caps); + config = GraphicsConfigurationFactory.getFactory(aScreen.getDevice()).chooseGraphicsConfiguration(caps, null, aScreen); if (config == null) { throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); } @@ -64,6 +66,22 @@ public class OffscreenWindow extends Window { // nop } + public void disposeSurfaceHandle() { + surfaceHandle = 0; + } + + public synchronized void destroy() { + disposeSurfaceHandle(); + } + + public void setSurfaceHandle(long handle) { + surfaceHandle = handle ; + } + + public long getSurfaceHandle() { + return surfaceHandle; + } + public void setVisible(boolean visible) { if(!visible) { this.visible = visible; diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java index 3b0c3b970..85b8723f9 100755 --- a/src/newt/classes/com/sun/javafx/newt/Window.java +++ b/src/newt/classes/com/sun/javafx/newt/Window.java @@ -172,7 +172,7 @@ public abstract class Window implements NativeWindow public String toString() { StringBuffer sb = new StringBuffer(); - sb.append("NEWT-Window[config "+config+ + sb.append(getClass().getName()+"[config "+config+ ", windowHandle 0x"+Long.toHexString(getWindowHandle())+ ", surfaceHandle 0x"+Long.toHexString(getSurfaceHandle())+ ", pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+ |