aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java73
-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
-rw-r--r--src/newt/native/Window.h4
-rw-r--r--src/newt/native/X11Window.c1
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java10
15 files changed, 150 insertions, 32 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 30b02cb61..99089d3d7 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -130,6 +130,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* <p>Changing this state is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p>
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code false}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -140,6 +141,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* otherwise the custom position is being enforced.</p>
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code true}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -152,6 +154,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* <p>Changing this state is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p>
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code false}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -160,6 +163,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* Set if window has <i>the input focus</i>, otherwise cleared.
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code false}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -168,6 +172,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* Set if window has <i>window decorations</i>, otherwise cleared.
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code false}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -176,6 +181,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* Set if window is <i>always on top</i>, otherwise cleared.
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code false}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -184,6 +190,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* Set if window is <i>always on bottom</i>, otherwise cleared.
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code false}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -192,12 +199,13 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* Set if window is <i>sticky</i>, i.e. visible <i>on all virtual desktop</i>, otherwise cleared.
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code false}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_BIT_STICKY = 7; // reconfig-flag
/**
- * Set if window is <i>resizable</i>, otherwise cleared.
+ * Set if window is <i>resizable</i> after creation, otherwise cleared.
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code true}.</p>
* @see #getStateMask()
@@ -208,6 +216,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* Set if window is <i>maximized vertically</i>, otherwise cleared.
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code false}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -216,6 +225,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* Set if window is <i>maximized horizontally</i>, otherwise cleared.
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code false}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -228,6 +238,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* </p>
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code false}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -237,6 +248,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* Set if the <i>pointer is visible</i> when inside the window, otherwise cleared.
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code true}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -245,84 +257,131 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* Set if the <i>pointer is confined</i> to the window, otherwise cleared.
* <p>Bit number {@value}.</p>
* <p>Defaults to {@code false}.</p>
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_BIT_POINTERCONFINED = 13;
/**
+ * Set if window is <i>repositionable</i> after creation, otherwise cleared.
+ * <p>Bit number {@value}.</p>
+ * <p>Defaults to {@code true}.</p>
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
+ * @since 2.4.0
+ */
+ public static final int STATE_BIT_REPOSITIONABLE = 14; // reconfig-flag
+
+ /**
* Bitmask for {@link #STATE_BIT_VISIBLE}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_VISIBLE = 1 << STATE_BIT_VISIBLE;
/**
* Bitmask for {@link #STATE_BIT_AUTOPOSITION}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_AUTOPOSITION = 1 << STATE_BIT_AUTOPOSITION;
/**
* Bitmask for {@link #STATE_BIT_CHILDWIN}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_CHILDWIN = 1 << STATE_BIT_CHILDWIN;
/**
* Bitmask for {@link #STATE_BIT_FOCUSED}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_FOCUSED = 1 << STATE_BIT_FOCUSED;
/**
* Bitmask for {@link #STATE_BIT_UNDECORATED}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_UNDECORATED = 1 << STATE_BIT_UNDECORATED;
/**
* Bitmask for {@link #STATE_BIT_ALWAYSONTOP}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_ALWAYSONTOP = 1 << STATE_BIT_ALWAYSONTOP;
/**
* Bitmask for {@link #STATE_BIT_ALWAYSONBOTTOM}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_ALWAYSONBOTTOM = 1 << STATE_BIT_ALWAYSONBOTTOM;
/**
* Bitmask for {@link #STATE_BIT_STICKY}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_STICKY = 1 << STATE_BIT_STICKY;
/**
* Bitmask for {@link #STATE_BIT_RESIZABLE}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_RESIZABLE = 1 << STATE_BIT_RESIZABLE;
/**
* Bitmask for {@link #STATE_BIT_MAXIMIZED_VERT}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_MAXIMIZED_VERT = 1 << STATE_BIT_MAXIMIZED_VERT;
/**
* Bitmask for {@link #STATE_BIT_MAXIMIZED_HORZ}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_MAXIMIZED_HORZ = 1 << STATE_BIT_MAXIMIZED_HORZ;
/**
* Bitmask for {@link #STATE_BIT_FULLSCREEN}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_FULLSCREEN = 1 << STATE_BIT_FULLSCREEN;
/**
* Bitmask for {@link #STATE_BIT_POINTERVISIBLE}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_POINTERVISIBLE = 1 << STATE_BIT_POINTERVISIBLE;
/**
* Bitmask for {@link #STATE_BIT_POINTERCONFINED}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
* @since 2.3.2
*/
public static final int STATE_MASK_POINTERCONFINED = 1 << STATE_BIT_POINTERCONFINED;
+ /**
+ * Bitmask for {@link #STATE_BIT_REPOSITIONABLE}, {@value}.
+ * @see #getSupportedStateMask()
+ * @see #getStateMask()
+ * @since 2.4.0
+ */
+ public static final int STATE_MASK_REPOSITIONABLE = 1 << STATE_BIT_REPOSITIONABLE;
/**
* Number of all public state bits.
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -330,6 +389,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
/**
* Bitmask covering all public state bits.
+ * @see #getSupportedStateMask()
* @see #getStateMask()
* @since 2.3.2
*/
@@ -352,6 +412,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* @see #STATE_MASK_FULLSCREEN
* @see #STATE_MASK_POINTERVISIBLE
* @see #STATE_MASK_POINTERCONFINED
+ * @see #STATE_MASK_REPOSITIONABLE
* @since 2.3.2
*/
int getStateMask();
@@ -372,10 +433,13 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* Please note that a window's size shall also be allowed to change, i.e. {@link #setSize(int, int)}.
* </p>
* <p>
- * Default value is {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED} | {@link #STATE_MASK_FULLSCREEN},
+ * Default minimum value is {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED},
* i.e. the <b>minimum requirement</b> for all implementations.
* </p>
* <p>
+ * Usual desktop minimum value is {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED} | {@link STATE_MASK_FULLSCREEN} | {@link STATE_MASK_RESIZABLE} | {@link STATE_MASK_REPOSITIONABLE}.
+ * </p>
+ * <p>
* Before native window creation {@link #getStatePublicBitmask()} is returned,
* i.e. it is assumed all features are supported.
* </p>
@@ -389,12 +453,13 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* <li>{@link #STATE_MASK_ALWAYSONTOP}: Window can be set {@link #setAlwaysOnTop(boolean) always-on-top}. </li>
* <li>{@link #STATE_MASK_ALWAYSONBOTTOM}: Window can be set {@link #setAlwaysOnBottom(boolean) always-on-bottom}. </li>
* <li>{@link #STATE_MASK_STICKY}: Window can be set {@link #setSticky(boolean) sticky}.</li>
- * <li>{@link #STATE_MASK_RESIZABLE}: Window {@link #setResizable(boolean) resizability} can be toggled.</li>
+ * <li>{@link #STATE_MASK_RESIZABLE}: Window {@link #setResizable(boolean) resizability} can be toggled and it's {@link #setSize(int, int) size} can be changed.</li>
* <li>{@link #STATE_MASK_MAXIMIZED_VERT}: Window can be {@link #setMaximized(boolean, boolean) maximized-vertically}. </li>
* <li>{@link #STATE_MASK_MAXIMIZED_HORZ}: Window can be {@link #setMaximized(boolean, boolean) maximized-horizontally}. </li>
* <li>{@link #STATE_MASK_FULLSCREEN}: Window {@link #setFullscreen(boolean) fullscreen} can be toggled. </li>
* <li>{@link #STATE_MASK_POINTERVISIBLE}: Window {@link #setPointerVisible(boolean) pointer visibility} can be toggled. </li>
* <li>{@link #STATE_MASK_POINTERCONFINED}: Window {@link #confinePointer(boolean) pointer can be confined}. </li>
+ * <li>{@link #STATE_MASK_REPOSITIONABLE}: Window {@link #setPosition(int, int) position} can be changed.</li>
* </ul>
* </p>
* @see #getStateMask()
@@ -605,6 +670,8 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* @param width of the window's client area in window units
* @param height of the window's client area in window units
*
+ * @see {@link #STATE_BIT_RESIZABLE}
+ * @see {@link #STATE_MASK_RESIZABLE}
* @see #setSurfaceSize(int, int)
* @see #setTopLevelSize(int, int)
* @see #getInsets()
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
diff --git a/src/newt/native/Window.h b/src/newt/native/Window.h
index f6aba4c83..b3924e5b1 100644
--- a/src/newt/native/Window.h
+++ b/src/newt/native/Window.h
@@ -55,7 +55,8 @@
#define FLAG_IS_FULLSCREEN ( 1 << 11 )
#define FLAG_IS_POINTERVISIBLE ( 1 << 12 )
#define FLAG_IS_POINTERCONFINED ( 1 << 13 )
-#define FLAG_IS_FULLSCREEN_SPAN ( 1 << 14 )
+#define FLAG_IS_REPOSITIONABLE ( 1 << 14 )
+#define FLAG_IS_FULLSCREEN_SPAN ( 1 << 15 )
#define TST_FLAG_CHANGE_VISIBILITY(f) ( 0 != ( (f) & FLAG_CHANGE_VISIBILITY ) )
#define TST_FLAG_CHANGE_VISIBILITY_FAST(f) ( 0 != ( (f) & FLAG_CHANGE_VISIBILITY_FAST ) )
@@ -85,6 +86,7 @@
#define TST_FLAG_IS_MAXIMIZED_HORZ(f) ( 0 != ( (f) & FLAG_IS_MAXIMIZED_HORZ ) )
#define TST_FLAG_IS_MAXIMIZED_ANY(f) ( 0 != ( (f) & ( FLAG_IS_MAXIMIZED_VERT | FLAG_IS_MAXIMIZED_HORZ ) ) )
#define TST_FLAG_IS_FULLSCREEN(f) ( 0 != ( (f) & FLAG_IS_FULLSCREEN ) )
+#define TST_FLAG_IS_REPOSITIONABLE(f) ( 0 != ( (f) & FLAG_IS_REPOSITIONABLE ) )
#define TST_FLAG_IS_FULLSCREEN_SPAN(f) ( 0 != ( (f) & FLAG_IS_FULLSCREEN_SPAN ) )
#endif
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index e4c70d6ca..9f635fce7 100644
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -1088,6 +1088,7 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_WindowDriver_GetSupportedReco
FLAG_IS_FULLSCREEN |
FLAG_IS_POINTERVISIBLE |
FLAG_IS_POINTERCONFINED |
+ FLAG_IS_REPOSITIONABLE |
FLAG_IS_FULLSCREEN_SPAN;
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java
index 8d26ebb82..af329dfa7 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java
@@ -48,7 +48,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLContextSurfaceLockNEWT extends UITestCase {
- static final int demoSize = 64;
+ static final int demoSizePos = 80;
public abstract class MyRunnable implements Runnable {
final Object postSync;
@@ -77,6 +77,8 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase {
System.err.println("Animatr "+id+", count "+frameCount+": PRE: "+Thread.currentThread().getName());
for(int c=0; c<frameCount; c++) {
+ System.err.println("Animatr "+id+": Action "+c+" / "+frameCount+": "+Thread.currentThread().getName());
+
glad.display();
}
@@ -107,8 +109,11 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase {
System.err.println("Resizer "+id+", count "+actionCount+": PRE: "+Thread.currentThread().getName());
for(int c=0; c<actionCount; c++) {
+ final int _c = c;
win.runOnEDTIfAvail(true, new Runnable() {
+ int i = _c;
public void run() {
+ System.err.println("Resizer "+id+": Action "+i+" / "+actionCount+": "+Thread.currentThread().getName());
// Normal resize, may trigger immediate display within lock
win.setSize(win.getSurfaceWidth()+1, win.getSurfaceHeight()+1);
@@ -188,7 +193,8 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase {
glWindow.addGLEventListener(new GearsES2(0));
glWindow.addGLEventListener(myEventCounter);
- glWindow.setSize(demoSize, demoSize);
+ glWindow.setPosition(demoSizePos, demoSizePos);
+ glWindow.setSize(demoSizePos, demoSizePos);
glWindow.setVisible(true);
final String currentThreadName = Thread.currentThread().getName();