summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/WindowImpl.java8
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java4
3 files changed, 13 insertions, 1 deletions
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();
}