summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-12-09 02:24:44 +0100
committerSven Gothel <[email protected]>2019-12-09 02:24:44 +0100
commit3e92d34de3672d7f5e401ed6181bb55a58bdf4b6 (patch)
tree7dada4b8e816e8ef5c9a7386b17239a075b99536 /src/newt/classes/jogamp
parent5047217ff8366b0d3280e478aac6c711170d7063 (diff)
Bug 1156: NEWT Window: Better handling of fixed console case: Not resizable and not repositionable.
Our two fixed size and position console cases 'bcm.egl' and 'egl.gbm' (drm.gbm) only operate in a console like fullscreen mode. We should earmark and expose this behavior, as well as handle it by not waiting for a position / size and not attempting to change position and size. Reducing WindowImpl.minimumReconfigStateMask to bare minimum values: STATE_MASK_VISIBLE | STATE_MASK_FOCUSED; New WindowImpl.mutableSizePosReconfigStateMask extends WindowImpl.minimumReconfigStateMask, representing previous values: STATE_MASK_VISIBLE | STATE_MASK_FOCUSED | STATE_MASK_FULLSCREEN | STATE_MASK_RESIZABLE | STATE_MASK_REPOSITIONABLE; All WindowDriver implementations previously using WindowImpl.minimumReconfigStateMask are now using WindowImpl.mutableSizePosReconfigStateMask but the explicit console driver named above. I would have liked to add the STATE_BIT_FULLSCREEN to the current stateMask to notify this semantics, however this would have lead to more code changes as our fullscreen mode assumes to be 'on top' of the normal mode. Here the normal mode is essentially fullscreen and no back/forth fullscreen setting is useful or allowed. Therefore, both fixed size & position console driver won't expose themselves as being in fullscreen mode.
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/OffscreenWindow.java2
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java58
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/WindowDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java3
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java3
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java3
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java15
11 files changed, 68 insertions, 26 deletions
diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java
index da940541e..be07cda0a 100644
--- a/src/newt/classes/jogamp/newt/OffscreenWindow.java
+++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java
@@ -117,7 +117,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
@Override
protected final int getSupportedReconfigMaskImpl() {
- return minimumReconfigStateMask;
+ return mutableSizePosReconfigStateMask;
}
@Override
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index af73bddf8..25e34df05 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -210,7 +210,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @see #getStateMask()
* @since 2.3.2
*/
- protected static final int STATE_BIT_COUNT_ALL_PUBLIC = STATE_BIT_POINTERCONFINED + 1;
+ protected static final int STATE_BIT_COUNT_ALL_PUBLIC = STATE_BIT_REPOSITIONABLE + 1;
/** Bitmask for {@link #STATE_BIT_COUNT_ALL_PUBLIC} */
protected static final int STATE_MASK_ALL_PUBLIC = ( 1 << STATE_BIT_COUNT_ALL_PUBLIC ) - 1;
@@ -279,27 +279,30 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected static final int CHANGE_MASK_FULLSCREEN = 1 << 21;
/** Regular state mask */
- /* pp */ final Bitfield stateMask = Bitfield.Factory.synchronize(Bitfield.Factory.create(32));
+ private final Bitfield stateMask = Bitfield.Factory.synchronize(Bitfield.Factory.create(32));
/** Non fullscreen state mask */
private final Bitfield stateMaskNFS = Bitfield.Factory.synchronize(Bitfield.Factory.create(32));
/** Default is all but {@link #STATE_MASK_FULLSCREEN_SPAN}. */
protected int supportedReconfigStateMask = 0;
- /** See {@link #getSupportedStateMask()}, i.e. {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED} | {@link STATE_MASK_FULLSCREEN}. */
- protected static final int minimumReconfigStateMask = STATE_MASK_VISIBLE | STATE_MASK_FOCUSED | STATE_MASK_FULLSCREEN;
+ /** See {@link #getSupportedStateMask()}, i.e. {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED}. */
+ protected static final int minimumReconfigStateMask = STATE_MASK_VISIBLE | STATE_MASK_FOCUSED;
+ /** See {@link #getSupportedStateMask()}, i.e. {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED} | {@link STATE_MASK_FULLSCREEN} | {@link STATE_MASK_RESIZABLE} | {@link STATE_MASK_REPOSITIONABLE}. */
+ protected static final int mutableSizePosReconfigStateMask = minimumReconfigStateMask |
+ STATE_MASK_FULLSCREEN | STATE_MASK_RESIZABLE | STATE_MASK_REPOSITIONABLE;
/* pp */ final void resetStateMask() {
stateMask.clearField(false);
stateMask.put32(0, 32,
STATE_MASK_AUTOPOSITION |
( null != parentWindow ? STATE_MASK_CHILDWIN : 0 ) |
- STATE_MASK_RESIZABLE |
+ ( isReconfigureMaskSupported(STATE_MASK_RESIZABLE) ? STATE_MASK_RESIZABLE : 0 ) |
+ ( isReconfigureMaskSupported(STATE_MASK_REPOSITIONABLE) ? STATE_MASK_REPOSITIONABLE : 0 ) |
STATE_MASK_POINTERVISIBLE |
PSTATE_MASK_FULLSCREEN_MAINMONITOR);
stateMaskNFS.clearField(false);
normPosSizeStored[0] = false;
normPosSizeStored[1] = false;
- supportedReconfigStateMask = STATE_MASK_ALL_RECONFIG;
}
@Override
@@ -405,13 +408,20 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if( showChangeFlags ) {
+ sb.append((0 != ( STATE_MASK_REPOSITIONABLE & mask))?"repositionable":"fixed-position");
+ sb.append(", ");
+ } else if( 0 != ( STATE_MASK_REPOSITIONABLE & mask) ) {
+ sb.append("repositionable");
+ sb.append(", ");
+ }
+ if( showChangeFlags ) {
if( 0 != ( CHANGE_MASK_RESIZABLE & mask) ) {
sb.append("*");
}
- sb.append((0 != ( STATE_MASK_RESIZABLE & mask))?"resizable":"unresizable");
+ sb.append((0 != ( STATE_MASK_RESIZABLE & mask))?"resizable":"fixed-size");
sb.append(", ");
- } else if( 0 == ( STATE_MASK_RESIZABLE & mask) ) {
- sb.append("unresizable");
+ } else if( 0 != ( STATE_MASK_RESIZABLE & mask) ) {
+ sb.append("resizable");
sb.append(", ");
}
@@ -748,7 +758,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
supportedReconfigStateMask = getSupportedReconfigMaskImpl() & STATE_MASK_ALL_RECONFIG;
if( DEBUG_IMPLEMENTATION) {
final boolean minimumOK = minimumReconfigStateMask == ( minimumReconfigStateMask & supportedReconfigStateMask );
- System.err.println("Supported Reconfig (minimum-ok "+minimumOK+"): "+appendStateBits(new StringBuilder(), supportedReconfigStateMask, true).toString());
+ System.err.println("Supported Reconfig.1 (minimum-ok "+minimumOK+"): "+appendStateBits(new StringBuilder(), supportedReconfigStateMask, true).toString());
}
screen.addMonitorModeListener(monitorModeListenerImpl);
setTitleImpl(title);
@@ -895,6 +905,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* ie. instance created and all fields set.
*/
private final void instantiationFinished() {
+ supportedReconfigStateMask = getSupportedReconfigMaskImpl() & STATE_MASK_ALL_RECONFIG;
+ if( DEBUG_IMPLEMENTATION) {
+ final boolean minimumOK = minimumReconfigStateMask == ( minimumReconfigStateMask & supportedReconfigStateMask );
+ System.err.println("Supported Reconfig.0 (minimum-ok "+minimumOK+"): "+appendStateBits(new StringBuilder(), supportedReconfigStateMask, true).toString());
+ }
resetStateMask();
instantiationFinishedImpl();
}
@@ -949,8 +964,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* Default value is {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED},
* i.e. the <b>minimum requirement</b> for all implementations.
* </p>
+ * <p>
+ * Will be called twice. Once after simple {@link #instantiationFinished()}
+ * pre native window creation and once right after {@link #createNativeImpl() native creation}.
+ * </p>
* @see #getSupportedStateMask()
* @see #reconfigureWindowImpl(int, int, int, int, int)
+ * @see #instantiationFinished()
+ * @see #createNativeImpl()
*/
protected abstract int getSupportedReconfigMaskImpl();
@@ -1346,7 +1367,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
- if ( force || ( !isFullscreen() && ( getWidth() != width || getHeight() != height ) ) ) {
+ if ( force ||
+ ( ( isReconfigureMaskSupported(STATE_MASK_RESIZABLE) || !isNativeValid() ) &&
+ !isFullscreen() &&
+ ( getWidth() != width || getHeight() != height )
+ )
+ )
+ {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window setSize: START force "+force+", "+getWidth()+"x"+getHeight()+" -> "+width+"x"+height+", windowHandle "+toHexString(windowHandle)+", state "+getStateMaskString());
}
@@ -2732,6 +2759,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final StringBuilder sb = new StringBuilder();
sb.append(getClass().getName()+"[State "+getStateMaskString()+
+ ",\n Reconfig "+getSupportedStateMaskString()+
",\n "+screen+
",\n window["+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+" wu, "+getSurfaceWidth()+"x"+getSurfaceHeight()+" pixel]"+
",\n Config "+config+
@@ -2883,7 +2911,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window setPosition: "+getX()+"/"+getY()+" -> "+x+"/"+y+", fs "+stateMask.get(STATE_BIT_FULLSCREEN)+", windowHandle "+toHexString(windowHandle));
}
// Let the window be positioned if !fullscreen and position changed or being a child window.
- if ( !isFullscreen() && ( getX() != x || getY() != y || null != getParent()) ) {
+ if ( ( isReconfigureMaskSupported(STATE_MASK_REPOSITIONABLE) || !isNativeValid() ) &&
+ !isFullscreen() &&
+ ( getX() != x || getY() != y || null != getParent())
+ )
+ {
if(isNativeValid()) {
// this.x/this.y will be set by sizeChanged, triggered by windowing event system
reconfigureWindowImpl(x, y, getWidth(), getHeight(), getReconfigureMask(0, isVisible()));
@@ -4576,7 +4608,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
boolean _autopos = false;
boolean ok;
do {
- if( useCustomPosition ) {
+ if( useCustomPosition && isReconfigureMaskSupported(STATE_MASK_REPOSITIONABLE) ) {
ok = Math.abs(x - getX()) <= maxDX && Math.abs(y - getY()) <= maxDY ;
} else {
_autopos = stateMask.get(STATE_BIT_AUTOPOSITION);
diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
index 7bf2b6146..f2c102206 100644
--- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
@@ -456,7 +456,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
@Override
protected final int getSupportedReconfigMaskImpl() {
- return minimumReconfigStateMask;
+ return mutableSizePosReconfigStateMask;
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
index b72481f1b..860ee9188 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
@@ -263,7 +263,7 @@ public class WindowDriver extends WindowImpl {
@Override
protected final int getSupportedReconfigMaskImpl() {
- return minimumReconfigStateMask;
+ return mutableSizePosReconfigStateMask;
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
index e12b033cc..783ee8a36 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
@@ -252,7 +252,7 @@ public class WindowDriver extends WindowImpl {
@Override
protected final int getSupportedReconfigMaskImpl() {
- return minimumReconfigStateMask |
+ return mutableSizePosReconfigStateMask |
// STATE_MASK_UNDECORATED |
// STATE_MASK_ALWAYSONTOP |
// STATE_MASK_ALWAYSONBOTTOM |
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
index f00c075b5..a8a3a2007 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
@@ -86,7 +86,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
@Override
protected final int getSupportedReconfigMaskImpl() {
- return minimumReconfigStateMask;
+ return mutableSizePosReconfigStateMask;
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java
index 38cb79fa5..be53d8f34 100644
--- a/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java
@@ -362,13 +362,12 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
@Override
protected final int getSupportedReconfigMaskImpl() {
- return minimumReconfigStateMask |
+ return mutableSizePosReconfigStateMask |
STATE_MASK_CHILDWIN |
STATE_MASK_UNDECORATED |
STATE_MASK_ALWAYSONTOP |
STATE_MASK_ALWAYSONBOTTOM |
STATE_MASK_STICKY |
- STATE_MASK_RESIZABLE |
STATE_MASK_MAXIMIZED_VERT |
STATE_MASK_MAXIMIZED_HORZ |
STATE_MASK_POINTERVISIBLE |
diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
index 6b5943ff1..ee2925b1c 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
@@ -96,7 +96,7 @@ public class WindowDriver extends WindowImpl {
@Override
protected final int getSupportedReconfigMaskImpl() {
- return minimumReconfigStateMask;
+ return mutableSizePosReconfigStateMask;
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index 2934375a3..53e05d8a0 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -367,13 +367,12 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
@Override
protected final int getSupportedReconfigMaskImpl() {
- return minimumReconfigStateMask |
+ return mutableSizePosReconfigStateMask |
STATE_MASK_CHILDWIN |
STATE_MASK_UNDECORATED |
STATE_MASK_ALWAYSONTOP |
STATE_MASK_ALWAYSONBOTTOM |
STATE_MASK_STICKY |
- STATE_MASK_RESIZABLE |
STATE_MASK_MAXIMIZED_VERT |
STATE_MASK_MAXIMIZED_HORZ |
STATE_MASK_POINTERVISIBLE |
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
index 2c6b4a37e..b3a68eaf3 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
@@ -205,13 +205,12 @@ public class WindowDriver extends WindowImpl {
@Override
protected final int getSupportedReconfigMaskImpl() {
- return minimumReconfigStateMask |
+ return mutableSizePosReconfigStateMask |
STATE_MASK_CHILDWIN |
STATE_MASK_UNDECORATED |
STATE_MASK_ALWAYSONTOP |
STATE_MASK_ALWAYSONBOTTOM |
// STATE_MASK_STICKY |
- STATE_MASK_RESIZABLE |
STATE_MASK_MAXIMIZED_VERT |
STATE_MASK_MAXIMIZED_HORZ |
STATE_MASK_POINTERVISIBLE |
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index 5adbba185..a71192a66 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -170,7 +170,20 @@ public class WindowDriver extends WindowImpl {
@Override
protected final int getSupportedReconfigMaskImpl() {
- return ( minimumReconfigStateMask | GetSupportedReconfigMask0(javaWindowHandle) ) & STATE_MASK_ALL_RECONFIG;
+ if( 0 == javaWindowHandle ) {
+ return mutableSizePosReconfigStateMask |
+ STATE_MASK_CHILDWIN |
+ STATE_MASK_UNDECORATED |
+ STATE_MASK_ALWAYSONTOP | // optional
+ STATE_MASK_ALWAYSONBOTTOM | // optional
+ STATE_MASK_STICKY | // optional
+ STATE_MASK_MAXIMIZED_VERT | // optional
+ STATE_MASK_MAXIMIZED_HORZ | // optional
+ STATE_MASK_POINTERVISIBLE |
+ STATE_MASK_POINTERCONFINED;
+ } else {
+ return ( mutableSizePosReconfigStateMask | GetSupportedReconfigMask0(javaWindowHandle) ) & STATE_MASK_ALL_RECONFIG;
+ }
}
@Override