From 76562bc5073909410ccf8a72a01d6998356a9d70 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 19 Nov 2011 19:19:49 +0100 Subject: NEWT Window: Promote/Expose 'Window getDelegatedWindow()' for accessing the delegate (ie GLWindow) --- src/newt/classes/com/jogamp/newt/Window.java | 5 +++++ src/newt/classes/com/jogamp/newt/event/NEWTEvent.java | 1 + src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 8 ++++---- src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java | 5 +---- 4 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/newt/classes') diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index b0df7a28a..32024a49a 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -134,6 +134,11 @@ public interface Window extends NativeWindow, WindowClosingProtocol { boolean isVisible(); + /** + * If the implementation uses delegation, return the delegated {@link Window} instance, + * otherwise return this instance. */ + Window getDelegatedWindow(); + // // Child Window Management // diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java index 50aed2c8e..3f3817b91 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java @@ -46,6 +46,7 @@ package com.jogamp.newt.event; *
  • KeyEvent 300..30x
  • *
    */ +@SuppressWarnings("serial") public class NEWTEvent extends java.util.EventObject { private final boolean isSystemEvent; private final int eventType; diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index fd216bfda..166718423 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -55,8 +55,8 @@ import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.util.Animator; /** - * An implementation of {@link javax.media.opengl.GLAutoDrawable} interface, - * using an aggregation of a {@link com.jogamp.newt.Window} implementation. + * An implementation of {@link GLAutoDrawable} and {@link Window} interface, + * using a delegated {@link Window} instance, which may be an aggregation (lifecycle: created and destroyed). *

    * This implementation does not make the OpenGL context current
    * before calling the various input EventListener callbacks, ie {@link com.jogamp.newt.event.MouseListener} etc.
    @@ -196,8 +196,8 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC return window.getRequestedCapabilities(); } - public final Window getWindow() { - return window; + public final Window getDelegatedWindow() { + return window.getDelegatedWindow(); } public final NativeWindow getParent() { diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java index bb678935a..a7326d916 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java @@ -30,7 +30,6 @@ package jogamp.newt.driver.android; import javax.media.opengl.GLProfile; import com.jogamp.newt.Window; -import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; import jogamp.newt.driver.android.AndroidWindow; @@ -63,9 +62,7 @@ public class NewtBaseActivity extends Activity { } public void setContentView(android.view.Window androidWindow, Window newtWindow) { - if(newtWindow instanceof GLWindow) { - newtWindow = ((GLWindow)newtWindow).getWindow(); - } + newtWindow = newtWindow.getDelegatedWindow(); if(newtWindow instanceof AndroidWindow) { this.newtWindow = (AndroidWindow)newtWindow; this.newtWindow.setAndroidWindow(androidWindow); -- cgit v1.2.3