From 7bc4c218b47033cb66f4eb5e707a86a0a4e60cff Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 9 Nov 2011 00:31:34 +0100 Subject: NativeWindow: Add accessor interfaces NativeSurfaceHolder and NativeWindowHolder - NativeSurfaceHolder interface allows access to it's implementation's NativeSurface reference. - NativeWindowHolder interface allows access to it's implementation's NativeWindow reference. Implement or extend interface w/ these accessors whereever it seems fit: - NEWT Window - GLDrawable These accessors allow lower layers to retrieve the NativeSurface/Window instance w/o knowledge of the 'upper' frameworks, ie. NativeWindow/JOGL or JOGL/NEWT. Commited in followups (due to mixed semantical changes in those files): - JAWTWindow - NewtCanvasAWT - Some NEWT impl. --- src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/newt/classes') diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index e9ac272c8..51a2aa73b 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -195,6 +195,10 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC return window.getRequestedCapabilities(); } + public NativeWindow getNativeWindow() { + return window; + } + public final Window getWindow() { return window; } @@ -676,8 +680,18 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC // GLDrawable methods // + + /** + * {@inheritDoc} + *

+ * Be aware that the returned NativeSurface may change. + * If this inner {@link GLDrawable} representation became realized (see {@link #isRealized()}) + * this {@link GLDrawable}'s {@link NativeSurface} instance is being returned. + * Otherwise this {@link Window} {@link NativeSurface}'s is being returned. + *

+ */ public final NativeSurface getNativeSurface() { - return null!=drawable ? drawable.getNativeSurface() : null; + return null!=drawable ? drawable.getNativeSurface() : window.getNativeSurface(); } public final long getHandle() { -- cgit v1.2.3