aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java24
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java4
2 files changed, 16 insertions, 12 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 6a0449e30..fd224e6c7 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -93,7 +93,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private AbstractGraphicsConfiguration config = null; // control access due to delegation
protected CapabilitiesImmutable capsRequested = null;
protected CapabilitiesChooser capabilitiesChooser = null; // default null -> default
- private boolean fullscreen = false, hasFocus = false;
+ private boolean fullscreen = false, hasFocus = false, brokenFocusChange = false;
private int width = 128, height = 128; // client-area size w/o insets, default: may be overwritten by user
private int x = 64, y = 64; // client-area pos w/o insets
private boolean autoPosition = true; // default: true (allow WM to choose top-level position, if not set by user)
@@ -323,7 +323,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if(postParentlockFocus) {
// harmonize focus behavior for all platforms: focus on creation
- requestFocusInt(isFullscreen() /* skipFocusAction */, true/* force */);
+ requestFocusInt(isFullscreen() /* skipFocusAction */);
((DisplayImpl) screen.getDisplay()).dispatchMessagesNative(); // status up2date
}
if(DEBUG_IMPLEMENTATION) {
@@ -1185,7 +1185,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
ok = WindowImpl.this.waitForSize(width, height, false, TIMEOUT_NATIVEWINDOW);
}
if(ok) {
- requestFocusInt(false /* skipFocusAction */, true/* force */);
+ requestFocusInt(false /* skipFocusAction */);
display.dispatchMessagesNative(); // status up2date
}
}
@@ -1616,7 +1616,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
public void requestFocus(boolean wait) {
- requestFocus(wait /* wait */, false /* skipFocusAction */, false /* force */);
+ requestFocus(wait /* wait */, false /* skipFocusAction */, brokenFocusChange /* force */);
}
private void requestFocus(boolean wait, boolean skipFocusAction, boolean force) {
@@ -1627,13 +1627,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
- /** Internal request focus on current thread */
- private void requestFocusInt(boolean skipFocusAction, boolean force) {
+ /** Internally forcing request focus on current thread */
+ private void requestFocusInt(boolean skipFocusAction) {
if( skipFocusAction || !focusAction() ) {
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.RequestFocusInt: force "+force+" - ("+getThreadName()+"): "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
+ System.err.println("Window.RequestFocusInt: forcing - ("+getThreadName()+"): "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
}
- requestFocusImpl(force);
+ requestFocusImpl(true);
}
}
@@ -1657,6 +1657,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return res;
}
+ protected void setBrokenFocusChange(boolean v) {
+ brokenFocusChange = v;
+ }
+
public void setKeyboardFocusHandler(KeyListener l) {
keyboardFocusHandler = l;
}
@@ -2335,7 +2339,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/** Triggered by implementation's WM events to update the focus state. */
protected void focusChanged(boolean defer, boolean focusGained) {
- if(hasFocus != focusGained) {
+ if(brokenFocusChange || hasFocus != focusGained) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.focusChanged: ("+getThreadName()+"): (defer: "+defer+") "+this.hasFocus+" -> "+focusGained+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
}
@@ -2347,7 +2351,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
enqueueWindowEvent(false, evt);
}
}
- }
+ }
/** Triggered by implementation's WM events to update the visibility state. */
protected void visibleChanged(boolean defer, boolean visible) {
diff --git a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
index 8d1b21db1..affce29dc 100644
--- a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
+++ b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
@@ -210,6 +210,7 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
surfaceHandle = 0;
eglSurface = 0;
definePosition(0, 0); // default to 0/0
+ setBrokenFocusChange(true);
}
@Override
@@ -255,7 +256,6 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
protected void createNativeImpl() {
Log.d(MD.TAG, "createNativeImpl 0 - surfaceHandle 0x"+Long.toHexString(surfaceHandle)+
", format [a "+androidFormat+", n "+nativeFormat+"], "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+" - "+Thread.currentThread().getName());
- androidView.bringToFront();
if(0!=getParentWindowHandle()) {
throw new NativeWindowException("Window parenting not supported (yet)");
@@ -305,8 +305,8 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
protected void requestFocusImpl(boolean reparented) {
if(null != androidView) {
- androidView.bringToFront();
androidView.requestFocus();
+ androidView.bringToFront();
}
}