diff options
Diffstat (limited to 'src')
10 files changed, 24 insertions, 71 deletions
diff --git a/src/classes/com/sun/javafx/newt/GLWindow.java b/src/classes/com/sun/javafx/newt/GLWindow.java index e7e5408fa..f7aedcf2a 100644 --- a/src/classes/com/sun/javafx/newt/GLWindow.java +++ b/src/classes/com/sun/javafx/newt/GLWindow.java @@ -126,11 +126,6 @@ public class GLWindow extends Window implements GLAutoDrawable { return new GLWindow(window); } - public boolean isTerminalObject() { - shouldNotCallThis(); - return false; - } - protected void createNative(GLCapabilities caps) { shouldNotCallThis(); } @@ -227,7 +222,11 @@ public class GLWindow extends Window implements GLAutoDrawable { window.setVisible(visible); if (visible && context == null) { factory = GLDrawableFactory.getFactory(); - drawable = factory.createGLDrawable(window, window.getChosenCapabilities(), null); + NativeWindow nw = window; + if (window.getWrappedWindow() != null) { + nw = NativeWindowFactory.getNativeWindow(window.getWrappedWindow()); + } + drawable = factory.createGLDrawable(nw, window.getChosenCapabilities(), null); window.setVisible(true); drawable.setRealized(true); context = drawable.createContext(null); diff --git a/src/classes/com/sun/javafx/newt/Window.java b/src/classes/com/sun/javafx/newt/Window.java index b4333bf2b..ab0588e8e 100755 --- a/src/classes/com/sun/javafx/newt/Window.java +++ b/src/classes/com/sun/javafx/newt/Window.java @@ -112,8 +112,6 @@ public abstract class Window implements NativeWindow } } - public abstract boolean isTerminalObject(); - /** * Create native windowHandle, ie creates a new native invisible window * @@ -155,7 +153,6 @@ public abstract class Window implements NativeWindow ", pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+ ", visible "+isVisible()+ ", wrappedWindow "+getWrappedWindow()+ - ", terminalObject "+isTerminalObject()+ ", visualID "+visualID+ ", "+chosenCaps+ ", screen handle/index "+getScreenHandle()+"/"+getScreenIndex() + @@ -297,6 +294,8 @@ public abstract class Window implements NativeWindow return height; } + /** If this Window actually wraps one from another toolkit such as + the AWT, this will return a non-null value. */ public Object getWrappedWindow() { return null; } diff --git a/src/classes/com/sun/javafx/newt/awt/AWTWindow.java b/src/classes/com/sun/javafx/newt/awt/AWTWindow.java index 07510e7a6..595e84cb0 100644 --- a/src/classes/com/sun/javafx/newt/awt/AWTWindow.java +++ b/src/classes/com/sun/javafx/newt/awt/AWTWindow.java @@ -83,10 +83,6 @@ public class AWTWindow extends Window { private int displayWidth; private int displayHeight; - public final boolean isTerminalObject() { - return false; - } - public void setTitle(String title) { super.setTitle(title); if (frame != null) { diff --git a/src/classes/com/sun/javafx/newt/kd/KDWindow.java b/src/classes/com/sun/javafx/newt/kd/KDWindow.java index b7b9f6686..44e297a92 100755 --- a/src/classes/com/sun/javafx/newt/kd/KDWindow.java +++ b/src/classes/com/sun/javafx/newt/kd/KDWindow.java @@ -56,10 +56,6 @@ public class KDWindow extends Window { public KDWindow() { } - public final boolean isTerminalObject() { - return true; - } - protected void createNative(GLCapabilities caps) { int eglRenderableType; if(GLProfile.isGLES1()) { diff --git a/src/classes/com/sun/javafx/newt/macosx/MacWindow.java b/src/classes/com/sun/javafx/newt/macosx/MacWindow.java index 8427bb607..dce504f83 100755 --- a/src/classes/com/sun/javafx/newt/macosx/MacWindow.java +++ b/src/classes/com/sun/javafx/newt/macosx/MacWindow.java @@ -65,10 +65,6 @@ public class MacWindow extends Window { return 0; } - public final boolean isTerminalObject() { - return true; - } - public final int getDisplayWidth() { return 640; } diff --git a/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java b/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java index bd60402d2..de05f0951 100755 --- a/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java +++ b/src/classes/com/sun/javafx/newt/windows/WindowsWindow.java @@ -55,10 +55,6 @@ public class WindowsWindow extends Window { public WindowsWindow() { } - public final boolean isTerminalObject() { - return true; - } - public long getSurfaceHandle() { if (hdc == 0) { hdc = GetDC(windowHandle); diff --git a/src/classes/com/sun/javafx/newt/x11/X11Window.java b/src/classes/com/sun/javafx/newt/x11/X11Window.java index c77933f18..ee0846e1b 100755 --- a/src/classes/com/sun/javafx/newt/x11/X11Window.java +++ b/src/classes/com/sun/javafx/newt/x11/X11Window.java @@ -54,10 +54,6 @@ public class X11Window extends Window { public X11Window() { } - public final boolean isTerminalObject() { - return true; - } - protected void createNative(GLCapabilities caps) { chosenCaps = (GLCapabilities) caps.clone(); // FIXME: visualID := f1(caps); caps := f2(visualID) visualID = 0; // n/a diff --git a/src/classes/com/sun/opengl/impl/NativeWindowFactoryImpl.java b/src/classes/com/sun/opengl/impl/NativeWindowFactoryImpl.java index 97d7c0e30..296ea3a44 100644 --- a/src/classes/com/sun/opengl/impl/NativeWindowFactoryImpl.java +++ b/src/classes/com/sun/opengl/impl/NativeWindowFactoryImpl.java @@ -43,17 +43,12 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { // This subclass of NativeWindowFactory handles the case of // NativeWindows and AWT Components being passed in protected NativeWindow getNativeWindowImpl(Object winObj) throws IllegalArgumentException { - if (null==winObj) { + if (null == winObj) { throw new IllegalArgumentException("winObj is null"); } if (winObj instanceof NativeWindow) { - NativeWindow nw = (NativeWindow) winObj; - Object wrappedWindow = nw.getWrappedWindow(); - if (wrappedWindow == null) { - // Use the NativeWindow directly - return nw; - } - winObj = wrappedWindow; + // Use the NativeWindow directly + return (NativeWindow) winObj; } if (GLReflection.isAWTComponent(winObj)) { diff --git a/src/classes/javax/media/opengl/GLDrawable.java b/src/classes/javax/media/opengl/GLDrawable.java index 844e025a0..219af33c4 100644 --- a/src/classes/javax/media/opengl/GLDrawable.java +++ b/src/classes/javax/media/opengl/GLDrawable.java @@ -82,7 +82,6 @@ public interface GLDrawable { public GLContext createContext(GLContext shareWith); /** - * Indicates to on-screen GLDrawable implementations whether the * underlying window has been created and can be drawn into. This * method must be called from GLDrawables obtained from the @@ -99,7 +98,7 @@ public interface GLDrawable { * by the implementation. It is not necessary to call * <code>setRealized</code> on a GLCanvas, a GLJPanel, or a * GLPbuffer, as these perform the appropriate calls on their - * underlying GLDrawables internally.. + * underlying GLDrawables internally. */ public void setRealized(boolean realized); diff --git a/src/classes/javax/media/opengl/NativeWindow.java b/src/classes/javax/media/opengl/NativeWindow.java index a2a892d52..f7e09520e 100644 --- a/src/classes/javax/media/opengl/NativeWindow.java +++ b/src/classes/javax/media/opengl/NativeWindow.java @@ -39,25 +39,20 @@ package javax.media.opengl; -/** Interface for a native window object. - This can be a representation of a fully functional - native window, i.e. a terminal object, where - {@link NativeWindow#isTerminalObject()} returns true. - Otherwise it is a a proxy for a wrapped - Java-level window toolkit window object (e.g. java.awt.Component), - which can be retrieved with - {@link NativeWindow#getWrappedWindow()}. - - In case the NativeWindow is a terminal object, - where the NativeWindow implementation took care of exposing - all necessary native windowing information, - the utilizing toolkit (e.g. JOGL) will use a generic implementation - and use the native information directly. +/** Provides the mechanism by which the Java / OpenGL binding + interacts with windows. A window toolkit such as the AWT may + either implement this interface directly with one of its + components, or provide and register an implementation of {@link + NativeWindowFactory NativeWindowFactory} which can create + NativeWindow objects for its components. <P> - In case the NativeWindow is a proxy object, - where no native windowing information is available yet, - the utilizing toolkit (e.g. JOGL) is expected to have a specific implementation - path to handle the wrapped Java-level window toolkit window object. */ + A NativeWindow created for a particular on-screen component is + expected to have the same lifetime as that component. As long as + the component is alive, the NativeWindow must be able to control + it, and any time it is visible and locked, provide information + such as the window handle to the Java / OpenGL binding so that + GLDrawables and GLContexts may be created for the window. +*/ public interface NativeWindow { public static final int LOCK_NOT_SUPPORTED = 0; @@ -117,20 +112,6 @@ public interface NativeWindow { public long getVisualID(); public int getScreenIndex(); - /** - * If this NativeWindow actually wraps a window from a Java-level - * window toolkit, return the underlying window object. - */ - public Object getWrappedWindow(); - - /** - * @return True, if this NativeWindow is a terminal object, - * i.e. all native windowing information is available. - * False otherwise, ie. it holds a wrapped window object, - * from which native handles must be derived by the utilizing tookit. - */ - public boolean isTerminalObject(); - /** Returns the current width of this window. */ public int getWidth(); |