diff options
Diffstat (limited to 'src')
5 files changed, 23 insertions, 4 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java b/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java index 361d16613..2e092a5b7 100644 --- a/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java +++ b/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java @@ -12,6 +12,7 @@ import javax.media.opengl.GLProfile; import org.junit.After; import org.junit.Assert; +import org.junit.Assume; import org.junit.Before; import org.junit.Test; @@ -51,7 +52,13 @@ public class TestTransformFeedbackVeryingsBug407NEWT { Window window; GLDrawable drawable; - GLProfile glp = GLProfile.get(GLProfile.GL3); + GLProfile glp = null; + try { + glp = GLProfile.get(GLProfile.GL3); + } catch (Throwable t) { + t.printStackTrace(); + Assume.assumeNoException(t); + } caps = new GLCapabilities(glp); caps.setOnscreen(true); diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWT.java b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWT.java index 42a58e2b1..1dac6edad 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWT.java @@ -2,6 +2,7 @@ package com.jogamp.test.junit.newt; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.awt.AWTException; import java.awt.BorderLayout; @@ -94,8 +95,7 @@ public class TestFocus01SwingAWT { // Verify focus status. assertFalse("AWT parent canvas has focus", newtCanvasAWT.hasFocus()); - // TODO No test for NEWT hasFocus. - // assertTrue(newtCanvasAWT.getNEWTChild().hasFocus()); + assertTrue(newtCanvasAWT.getNEWTChild().hasFocus()); // Type two keys, which should be directed to the focused window. Robot robot = new Robot(); diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index ef3e5e69c..17a562d61 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -277,6 +277,8 @@ public interface Window extends NativeWindow { void requestFocus(); + boolean hasFocus(); + void windowRepaint(int x, int y, int width, int height); void enqueueEvent(boolean wait, com.jogamp.newt.event.NEWTEvent event); diff --git a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java index d3ff2e558..e26947a36 100644 --- a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java +++ b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java @@ -170,7 +170,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer protected AbstractGraphicsConfiguration config; protected Capabilities caps; - protected boolean fullscreen, visible; + protected boolean fullscreen, visible, hasFocus; protected int width, height, x, y; // non fullscreen dimensions .. @@ -621,6 +621,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer windowHandle = 0; visible = false; fullscreen = false; + hasFocus = false; if(unrecoverable) { destroyScreen(); @@ -919,6 +920,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer enqueueRequestFocus(false); // FIXME: or shall we wait ? } + public boolean hasFocus() { + return hasFocus; + } + public Insets getInsets() { return new Insets(0,0,0,0); } @@ -1614,6 +1619,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_IMPLEMENTATION) { System.err.println("Window.focusChanged: ("+getThreadName()+"): "+focusGained+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); } + hasFocus = focusGained; if (focusGained) { sendWindowEvent(WindowEvent.EVENT_WINDOW_GAINED_FOCUS); } else { diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 13d549e24..028f809f0 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -184,6 +184,10 @@ public class GLWindow implements GLAutoDrawable, Window { window.requestFocus(); } + public boolean hasFocus() { + return window.hasFocus(); + } + public final Insets getInsets() { return window.getInsets(); } |