From 24eab4dc2a14eed97897ec61b69f7f845ab84e04 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 6 Nov 2013 07:06:58 +0100 Subject: NEWT Window: Expose 'setVisible(boolean wait, boolean visible)' allowing applications to not block until window becomes visible. --- src/newt/classes/com/jogamp/newt/Window.java | 21 ++++++++++++++++----- .../classes/com/jogamp/newt/opengl/GLWindow.java | 5 +++++ 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'src/newt/classes/com') diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index 04eb07a25..869b56331 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -158,10 +158,21 @@ public interface Window extends NativeWindow, WindowClosingProtocol { void setWindowDestroyNotifyAction(Runnable r); /** - * setVisible makes the window and children visible if visible is true, + * Calls {@link #setVisible(boolean, boolean) setVisible(true, visible)}, + * i.e. blocks until the window becomes visible. + * @see #setVisible(boolean, boolean) + */ + void setVisible(boolean visible); + + /** + * setVisible(..) makes the window and children visible if visible is true, * otherwise the window and children becomes invisible. *

- * The setVisible(true) is responsible to actual create the native window. + * setVisible(wait, true) is responsible to actual create the native window. + *

+ *

+ * If wait is true, method blocks until window is {@link #isVisible() visible} and {@link #isNativeValid() valid}, + * otherwise method returns immediately. *

*

* Zero size semantics are respected, see {@link #setSize(int,int)}:
@@ -178,12 +189,12 @@ public interface Window extends NativeWindow, WindowClosingProtocol { *

*

* In case this window is a child window and has a {@link javax.media.nativewindow.NativeWindow} parent,
- * setVisible(true) has no effect as long the parent's is not valid yet, + * setVisible(wait, true) has no effect as long the parent's is not valid yet, * i.e. {@link javax.media.nativewindow.NativeWindow#getWindowHandle()} returns null.
- * setVisible(true) shall be repeated when the parent becomes valid. + * setVisible(wait, true) shall be repeated when the parent becomes valid. *

*/ - void setVisible(boolean visible); + void setVisible(boolean wait, boolean visible); boolean isVisible(); diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 4f259fe9a..52f19f783 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -425,6 +425,11 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind window.setVisible(visible); } + @Override + public void setVisible(boolean wait, boolean visible) { + window.setVisible(wait, visible); + } + @Override public final void setSize(int width, int height) { window.setSize(width, height); -- cgit v1.2.3