aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java52
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java10
-rw-r--r--src/newt/classes/jogamp/newt/OffscreenWindow.java6
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java192
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/WindowDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java16
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java7
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java18
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java17
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java21
-rw-r--r--src/newt/native/Window.h4
-rw-r--r--src/newt/native/WindowsEDID.c10
-rw-r--r--src/newt/native/WindowsWindow.c110
-rw-r--r--src/newt/native/X11Window.c32
17 files changed, 405 insertions, 113 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index d46afd1cd..cacac9f9b 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -223,9 +223,6 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
*/
public static final int STATE_BIT_FULLSCREEN = 11; // reconfig-flag
- // Hidden in WindowImpl:
- // static final int STATE_BIT_FULLSCREEN_SPAN = 12;
-
/**
* Set if the <i>pointer is visible</i> when inside the window, otherwise cleared.
* <p>Bit number {@value}.</p>
@@ -233,7 +230,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* @see #getStateMask()
* @since 2.3.2
*/
- public static final int STATE_BIT_POINTERVISIBLE = 13;
+ public static final int STATE_BIT_POINTERVISIBLE = 12;
/**
* Set if the <i>pointer is confined</i> to the window, otherwise cleared.
* <p>Bit number {@value}.</p>
@@ -241,7 +238,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* @see #getStateMask()
* @since 2.3.2
*/
- public static final int STATE_BIT_POINTERCONFINED = 14;
+ public static final int STATE_BIT_POINTERCONFINED = 13;
/**
* Bitmask for {@link #STATE_BIT_VISIBLE}, {@value}.
@@ -330,6 +327,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
/**
* Returns the current status mask of this instance.
+ * @see #getSupportedStateMask()
* @see #STATE_MASK_VISIBLE
* @see #STATE_MASK_AUTOPOSITION
* @see #STATE_MASK_CHILDWIN
@@ -354,6 +352,50 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
*/
String getStateMaskString();
+ /**
+ * Returns the supported {@link #getStateMask() state mask} of the implementation.
+ * <p>
+ * Implementation provides supported {@link #getStateMask() state mask} values at runtime
+ * <i>after</i> native window creation, i.e. first visibility.
+ * </p>
+ * <p>
+ * Default value is {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED},
+ * i.e. the <b>minimum requirement</b> for all implementations.
+ * </p>
+ * <p>
+ * Before native window creation {@link #getStatePublicBitmask()} is returned,
+ * i.e. it is assumed all features are supported.
+ * </p>
+ * <p>
+ * Semantic of the supported state-mask bits:
+ * <ul>
+ * <li>{@link #STATE_MASK_VISIBLE}: {@link #setVisible(boolean) Visibility} can be toggled after creation. <b>Minimum requirement</b>.</li>
+ * <li>{@link #STATE_MASK_AUTOPOSITION}: {@code WindowManager autoposition} is supported.</li>
+ * <li>{@link #STATE_MASK_CHILDWIN}: {@link #reparentWindow(NativeWindow, int, int, int) Native window parenting} is supported.</li>
+ * <li>{@link #STATE_MASK_FOCUSED}: Window {@link #requestFocus() focus management} is supported. <b>Minimum requirement</b>.</li>
+ * <li>{@link #STATE_MASK_UNDECORATED}: {@link #setUndecorated(boolean) Window decoration} can be toggled after creation.</li>
+ * <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 disabled and toggled.</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 after creation. </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>
+ * </ul>
+ * </p>
+ * @see #getStateMask()
+ * @since 2.3.2
+ */
+ int getSupportedStateMask();
+
+ /**
+ * Returns a string representation of the {@link #getSupportedStateMask() supported state mask}.
+ * @since 2.3.2
+ */
+ String getSupportedStateMaskString();
+
//
// Lifecycle
//
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index f15c87beb..569780311 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -246,6 +246,16 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
@Override
+ public final int getSupportedStateMask() {
+ return window.getSupportedStateMask();
+ }
+
+ @Override
+ public final String getSupportedStateMaskString() {
+ return window.getSupportedStateMaskString();
+ }
+
+ @Override
public CapabilitiesChooser setCapabilitiesChooser(final CapabilitiesChooser chooser) {
return window.setCapabilitiesChooser(chooser);
}
diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java
index 819435331..8b99541b3 100644
--- a/src/newt/classes/jogamp/newt/OffscreenWindow.java
+++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java
@@ -42,7 +42,6 @@ import com.jogamp.nativewindow.GraphicsConfigurationFactory;
import com.jogamp.nativewindow.MutableSurface;
import com.jogamp.nativewindow.NativeWindowException;
import com.jogamp.nativewindow.VisualIDHolder;
-import com.jogamp.nativewindow.util.Insets;
import com.jogamp.nativewindow.util.Point;
import com.jogamp.newt.MonitorDevice;
@@ -116,6 +115,11 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
return false; // nop
}
+ @Override
+ protected final int getSupportedReconfigMaskImpl() {
+ return minimumReconfigStateMask |
+ STATE_MASK_FULLSCREEN; // due to size change
+ }
@Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) {
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index dd1680b0f..1f91a759c 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -190,28 +190,31 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @see #getStateMask()
* @since 2.3.2
*/
- protected static final int STATE_BIT_COUNT_ALL_PUBLIC = 15;
+ protected static final int STATE_BIT_COUNT_ALL_PUBLIC = STATE_BIT_POINTERCONFINED + 1;
/** Bitmask for {@link #STATE_BIT_COUNT_ALL_PUBLIC} */
protected static final int STATE_MASK_ALL_PUBLIC = ( 1 << STATE_BIT_COUNT_ALL_PUBLIC ) - 1;
//
- // Additional private state-mask bits and mask values
+ // Additional private reconfigure state-mask bits and mask values
//
- /**
- * <p>Bit number {@value}.</p>
- * <p>Defaults to {@code false}.</p>
- * @see #getStateMask()
- * @since 2.3.2
- */
- /* pp */ static final int STATE_BIT_FULLSCREEN_SPAN = 12;
- /* pp */ static final int PSTATE_BIT_MINMAXSIZE_SET = 27;
+ protected static final int STATE_BIT_FULLSCREEN_SPAN = STATE_BIT_COUNT_ALL_PUBLIC;
+
+ protected static final int STATE_BIT_COUNT_ALL_RECONFIG = STATE_BIT_FULLSCREEN_SPAN + 1;
+ /** Bitmask for {@link #STATE_BIT_COUNT_ALL_RECONFIG} */
+ protected static final int STATE_MASK_ALL_RECONFIG = ( 1 << STATE_BIT_COUNT_ALL_RECONFIG ) - 1;
+
+ //
+ // Additional private non-reconfigure state-mask bits and mask values
+ //
+
/* pp */ static final int PSTATE_BIT_FOCUS_CHANGE_BROKEN = 28;
/* pp */ static final int PSTATE_BIT_FULLSCREEN_MAINMONITOR = 29; // true
/* pp */ static final int PSTATE_BIT_FULLSCREEN_NFS_ALWAYSONTOP = 30; // non fullscreen alwaysOnTop setting
/* pp */ static final int PSTATE_BIT_FULLSCREEN_NFS_RESIZABLE = 31; // non fullscreen resizable setting
/** Bitmask for {@link #STATE_BIT_FULLSCREEN_SPAN}, {@value}. */
- /* pp */ static final int STATE_MASK_FULLSCREEN_SPAN = 1 << STATE_BIT_FULLSCREEN_SPAN;
+ protected static final int STATE_MASK_FULLSCREEN_SPAN = 1 << STATE_BIT_FULLSCREEN_SPAN;
+
/* pp */ static final int PSTATE_MASK_FOCUS_CHANGE_BROKEN = 1 << PSTATE_BIT_FOCUS_CHANGE_BROKEN;
/* pp */ static final int PSTATE_MASK_FULLSCREEN_MAINMONITOR = 1 << PSTATE_BIT_FULLSCREEN_MAINMONITOR;
/* pp */ static final int PSTATE_MASK_FULLSCREEN_NFS_ALWAYSONTOP = 1 << PSTATE_BIT_FULLSCREEN_NFS_ALWAYSONTOP;
@@ -220,7 +223,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/**
* Reconfig mask for createNativeImpl(..) taking out from {@link #getStateMask()}:
* <ul>
- * <li>{@link #STATE_MASK_VISIBLE}</li>
* <li>{@link #STATE_MASK_FULLSCREEN}</li>
* <li>{@link #STATE_MASK_POINTERVISIBLE}</li>
* <li>{@link #STATE_MASK_POINTERCONFINED}</li>
@@ -228,13 +230,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* Above taken out states are achieved from caller createNative() 'manually'.
* @since 2.3.2
*/
- protected final int STATE_MASK_CREATENATIVE = STATE_MASK_UNDECORATED |
- STATE_MASK_ALWAYSONTOP |
- STATE_MASK_ALWAYSONBOTTOM |
- STATE_MASK_STICKY |
- STATE_MASK_RESIZABLE |
- STATE_MASK_MAXIMIZED_VERT |
- STATE_MASK_MAXIMIZED_HORZ;
+ protected final int STATE_MASK_CREATENATIVE = STATE_MASK_ALL_PUBLIC &
+ ~( STATE_MASK_FULLSCREEN |
+ STATE_MASK_POINTERVISIBLE |
+ STATE_MASK_POINTERCONFINED
+ );
//
// Additional private state-mask mask values for reconfiguration only
// (keep in sync w/ src/newt/native/Window.h)
@@ -252,16 +252,23 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected static final int CHANGE_MASK_FULLSCREEN = 1 << 21;
/* pp */ final Bitfield stateMask = 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}. */
+ protected static final int minimumReconfigStateMask = STATE_MASK_VISIBLE | STATE_MASK_FOCUSED;
+
/* pp */ final void resetStateMask() {
stateMask.clearField(false);
- stateMask.set(STATE_BIT_AUTOPOSITION);
- stateMask.put(STATE_BIT_CHILDWIN, null != parentWindow);
- stateMask.set(STATE_BIT_RESIZABLE);
- stateMask.set(STATE_BIT_POINTERVISIBLE);
- stateMask.set(PSTATE_BIT_FULLSCREEN_NFS_RESIZABLE);
- stateMask.set(PSTATE_BIT_FULLSCREEN_MAINMONITOR);
+ stateMask.put32(0, 32,
+ STATE_MASK_AUTOPOSITION |
+ ( null != parentWindow ? STATE_MASK_CHILDWIN : 0 ) |
+ STATE_MASK_RESIZABLE |
+ STATE_MASK_POINTERVISIBLE |
+ PSTATE_MASK_FULLSCREEN_NFS_RESIZABLE |
+ PSTATE_MASK_FULLSCREEN_MAINMONITOR);
normPosSizeStored[0] = false;
normPosSizeStored[1] = false;
+ supportedReconfigStateMask = STATE_MASK_ALL_RECONFIG;
}
@Override
@@ -277,16 +284,29 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final int getStateMask() {
return stateMask.get32(0, STATE_BIT_COUNT_ALL_PUBLIC);
}
+
@Override
public final String getStateMaskString() {
return appendStateBits(new StringBuilder(), stateMask.get32(0, STATE_BIT_COUNT_ALL_PUBLIC), false).toString();
}
+ @Override
+ public final int getSupportedStateMask() {
+ return supportedReconfigStateMask & STATE_MASK_ALL_PUBLIC;
+ }
+
+ @Override
+ public final String getSupportedStateMaskString() {
+ return appendStateBits(new StringBuilder(), getSupportedStateMask(), true).toString();
+ }
+
protected static StringBuilder appendStateBits(final StringBuilder sb, final int mask, final boolean showChangeFlags) {
sb.append("[");
- if( showChangeFlags && 0 != ( CHANGE_MASK_VISIBILITY & mask) ) {
- sb.append("*");
+ if( showChangeFlags ) {
+ if( 0 != ( CHANGE_MASK_VISIBILITY & mask) ) {
+ sb.append("*");
+ }
if( 0 != ( CHANGE_MASK_VISIBILITY_FAST & mask) ) {
sb.append("*");
}
@@ -296,8 +316,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append((0 != ( STATE_MASK_AUTOPOSITION & mask))?"autopos, ":"");
- if( showChangeFlags && 0 != ( CHANGE_MASK_PARENTING & mask) ) {
- sb.append("*");
+ if( showChangeFlags ) {
+ if( 0 != ( CHANGE_MASK_PARENTING & mask) ) {
+ sb.append("*");
+ }
sb.append((0 != ( STATE_MASK_CHILDWIN & mask))?"child":"top");
sb.append(", ");
} else if( 0 != ( STATE_MASK_CHILDWIN & mask) ) {
@@ -307,8 +329,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append((0 != ( STATE_MASK_FOCUSED & mask))?"focused, ":"");
- if( showChangeFlags && 0 != ( CHANGE_MASK_DECORATION & mask) ) {
- sb.append("*");
+ if( showChangeFlags ) {
+ if( 0 != ( CHANGE_MASK_DECORATION & mask) ) {
+ sb.append("*");
+ }
sb.append((0 != ( STATE_MASK_UNDECORATED & mask))?"undecor":"decor");
sb.append(", ");
} else if( 0 != ( STATE_MASK_UNDECORATED & mask) ) {
@@ -316,8 +340,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append(", ");
}
- if( showChangeFlags && 0 != ( CHANGE_MASK_ALWAYSONTOP & mask) ) {
- sb.append("*");
+ if( showChangeFlags ) {
+ if( 0 != ( CHANGE_MASK_ALWAYSONTOP & mask) ) {
+ sb.append("*");
+ }
sb.append((0 != ( STATE_MASK_ALWAYSONTOP & mask))?"aontop":"!aontop");
sb.append(", ");
} else if( 0 != ( STATE_MASK_ALWAYSONTOP & mask) ) {
@@ -325,8 +351,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append(", ");
}
- if( showChangeFlags && 0 != ( CHANGE_MASK_ALWAYSONBOTTOM & mask) ) {
- sb.append("*");
+ if( showChangeFlags ) {
+ if( 0 != ( CHANGE_MASK_ALWAYSONBOTTOM & mask) ) {
+ sb.append("*");
+ }
sb.append((0 != ( STATE_MASK_ALWAYSONBOTTOM & mask))?"aonbottom":"!aonbottom");
sb.append(", ");
} else if( 0 != ( STATE_MASK_ALWAYSONBOTTOM & mask) ) {
@@ -334,8 +362,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append(", ");
}
- if( showChangeFlags && 0 != ( CHANGE_MASK_STICKY & mask) ) {
- sb.append("*");
+ if( showChangeFlags ) {
+ if( 0 != ( CHANGE_MASK_STICKY & mask) ) {
+ sb.append("*");
+ }
sb.append((0 != ( STATE_MASK_STICKY & mask))?"sticky":"unsticky");
sb.append(", ");
} else if( 0 != ( STATE_MASK_STICKY & mask) ) {
@@ -343,8 +373,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append(", ");
}
- if( showChangeFlags && 0 != ( CHANGE_MASK_RESIZABLE & mask) ) {
- sb.append("*");
+ if( showChangeFlags ) {
+ if( 0 != ( CHANGE_MASK_RESIZABLE & mask) ) {
+ sb.append("*");
+ }
sb.append((0 != ( STATE_MASK_RESIZABLE & mask))?"resizable":"unresizable");
sb.append(", ");
} else if( 0 == ( STATE_MASK_RESIZABLE & mask) ) {
@@ -352,7 +384,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append(", ");
}
- if( showChangeFlags && 0 != ( ( CHANGE_MASK_MAXIMIZED_HORZ | CHANGE_MASK_MAXIMIZED_VERT ) & mask) ) {
+ if( showChangeFlags ) {
sb.append("max[");
if( 0 != ( CHANGE_MASK_MAXIMIZED_HORZ & mask) ) {
sb.append("*");
@@ -381,28 +413,47 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append("], ");
}
- if( showChangeFlags && 0 != ( CHANGE_MASK_FULLSCREEN & mask) ) {
- sb.append("*");
- sb.append((0 != ( STATE_MASK_FULLSCREEN & mask))?"fullscreen":"window");
- sb.append((0 != ( STATE_MASK_FULLSCREEN_SPAN & mask))?"[span]":"[]");
- sb.append(", ");
+ if( showChangeFlags ) {
+ if( 0 != ( CHANGE_MASK_FULLSCREEN & mask) ) {
+ sb.append("*");
+ }
+ sb.append("fullscreen[");
+ sb.append(0 != ( STATE_MASK_FULLSCREEN & mask));
+ sb.append((0 != ( STATE_MASK_FULLSCREEN_SPAN & mask))?", span":"");
+ sb.append("], ");
} else if( 0 != ( STATE_MASK_FULLSCREEN & mask) ) {
sb.append("fullscreen");
sb.append(", ");
}
- if( 0 == ( STATE_MASK_POINTERVISIBLE & mask) ||
- 0 != ( STATE_MASK_POINTERCONFINED & mask) )
- {
- sb.append("pointer[");
- if( 0 == ( STATE_MASK_POINTERVISIBLE & mask) ) {
- sb.append("invisible");
+ if( showChangeFlags ) {
+ sb.append("pointer[");
+ if( 0 == ( STATE_MASK_POINTERVISIBLE & mask) ) {
+ sb.append("invisible");
+ } else {
+ sb.append("visible");
+ }
sb.append(", ");
+ if( 0 != ( STATE_MASK_POINTERCONFINED & mask) ) {
+ sb.append("confined");
+ } else {
+ sb.append("free");
+ }
+ sb.append("]");
+ } else {
+ if( 0 == ( STATE_MASK_POINTERVISIBLE & mask) ||
+ 0 != ( STATE_MASK_POINTERCONFINED & mask) )
+ {
+ sb.append("pointer[");
+ if( 0 == ( STATE_MASK_POINTERVISIBLE & mask) ) {
+ sb.append("invisible");
+ sb.append(", ");
+ }
+ if( 0 != ( STATE_MASK_POINTERCONFINED & mask) ) {
+ sb.append("confined");
+ }
+ sb.append("]");
}
- if( 0 != ( STATE_MASK_POINTERCONFINED & mask) ) {
- sb.append("confined");
- }
- sb.append("]");
}
sb.append("]");
return sb;
@@ -667,6 +718,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
final long t0 = System.currentTimeMillis();
createNativeImpl();
+ supportedReconfigStateMask = getSupportedReconfigMaskImpl();
+ if( DEBUG_IMPLEMENTATION) {
+ System.err.println("Supported Reconfig: "+appendStateBits(new StringBuilder(), supportedReconfigStateMask, true).toString());
+ }
screen.addMonitorModeListener(monitorModeListenerImpl);
setTitleImpl(title);
setPointerIconIntern(pointerIcon);
@@ -844,6 +899,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected abstract void requestFocusImpl(boolean force);
/**
+ * Returns the reconfigure state-mask supported by the implementation.
+ * <p>
+ * Default value is {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED},
+ * i.e. the <b>minimum requirement</b> for all implementations.
+ * </p>
+ * @see #getSupportedStateMask()
+ * @see #reconfigureWindowImpl(int, int, int, int, int)
+ */
+ protected abstract int getSupportedReconfigMaskImpl();
+
+ /**
* The native implementation should invoke the referenced java state callbacks
* to notify this Java object of state changes.
*
@@ -858,23 +924,21 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @param height client-area size in window units, or <=0 if unchanged
* @param flags bitfield of change and status flags
*
+ * @see #getSupportedReconfigMaskImpl()
* @see #sizeChanged(int,int)
* @see #positionChanged(boolean,int, int)
*/
protected abstract boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags);
/**
- * Tests whether a single reconfigure flag is supported by implementation.
- * <p>
- * Default is all but {@link #STATE_MASK_FULLSCREEN_SPAN}
- * </p>
+ * Tests whether the given reconfigure state-mask is supported by implementation.
*/
- protected boolean isReconfigureMaskSupported(final int changeFlags) {
- return 0 == ( changeFlags & STATE_MASK_FULLSCREEN_SPAN );
+ protected final boolean isReconfigureMaskSupported(final int changeFlags) {
+ return changeFlags == ( changeFlags & supportedReconfigStateMask );
}
protected int getReconfigureMask(final int changeFlags, final boolean visible) {
- final int smask = stateMask.get32(0, STATE_BIT_COUNT_ALL_PUBLIC);
+ final int smask = stateMask.get32(0, STATE_BIT_COUNT_ALL_RECONFIG);
return changeFlags
| ( smask & ~STATE_MASK_VISIBLE )
| ( visible ? STATE_MASK_VISIBLE : 0 )
@@ -2851,7 +2915,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final int changeMask;
try {
{
- // Enter fullscreen - Disable alwaysOnTop/alwaysOnBottom/resizableChange
+ // Enter fullscreen - Disable alwaysOnTop/resizableChange
int cm = 0;
if( alwaysOnTopChange ) {
cm = CHANGE_MASK_ALWAYSONTOP;
@@ -2862,7 +2926,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
changeMask = cm;
}
if( _fullscreen && 0 != changeMask ) {
- // Enter fullscreen - Disable alwaysOnTop/alwaysOnBottom/resizableChange
+ // Enter fullscreen - Disable alwaysOnTop/resizableChange
reconfigureWindowImpl(oldX, oldY, oldWidth, oldHeight, getReconfigureMask(changeMask, isVisible()));
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
index 959e75df8..af5d08da0 100644
--- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
@@ -38,7 +38,6 @@ import com.jogamp.nativewindow.CapabilitiesImmutable;
import com.jogamp.nativewindow.DefaultGraphicsScreen;
import com.jogamp.nativewindow.NativeWindowException;
import com.jogamp.nativewindow.VisualIDHolder;
-import com.jogamp.nativewindow.util.Insets;
import com.jogamp.nativewindow.util.Point;
import com.jogamp.nativewindow.util.RectangleImmutable;
import com.jogamp.opengl.GLCapabilitiesChooser;
@@ -455,6 +454,11 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
}
@Override
+ protected final int getSupportedReconfigMaskImpl() {
+ return minimumReconfigStateMask;
+ }
+
+ @Override
protected final boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) {
boolean res = true;
diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
index 222ac8ae9..8399bdb31 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
@@ -225,6 +225,11 @@ public class WindowDriver extends WindowImpl {
}
@Override
+ protected final int getSupportedReconfigMaskImpl() {
+ return minimumReconfigStateMask;
+ }
+
+ @Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWTWindow reconfig: "+x+"/"+y+" "+width+"x"+height+", "+
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
index f95d23364..d19618bd1 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
@@ -38,7 +38,6 @@ import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
import com.jogamp.nativewindow.GraphicsConfigurationFactory;
import com.jogamp.nativewindow.NativeWindowException;
import com.jogamp.nativewindow.VisualIDHolder;
-import com.jogamp.nativewindow.util.Insets;
import com.jogamp.nativewindow.util.Point;
import com.jogamp.opengl.GLCapabilitiesImmutable;
@@ -94,6 +93,11 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
@Override
+ protected final int getSupportedReconfigMaskImpl() {
+ return minimumReconfigStateMask;
+ }
+
+ @Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) {
if(0!=getWindowHandle()) {
if(0 != ( CHANGE_MASK_FULLSCREEN & flags)) {
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 16b0f2ee9..315a41b1f 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
@@ -36,7 +36,6 @@ import com.jogamp.nativewindow.GraphicsConfigurationFactory;
import com.jogamp.nativewindow.NativeWindowException;
import com.jogamp.nativewindow.VisualIDHolder;
-import com.jogamp.nativewindow.util.Insets;
import com.jogamp.nativewindow.util.Point;
import com.jogamp.nativewindow.util.Rectangle;
import com.jogamp.nativewindow.util.RectangleImmutable;
@@ -249,6 +248,21 @@ public class WindowDriver extends WindowImpl {
}
@Override
+ protected final int getSupportedReconfigMaskImpl() {
+ return minimumReconfigStateMask |
+ // 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_FULLSCREEN | // due to size change
+ STATE_MASK_POINTERVISIBLE |
+ STATE_MASK_POINTERCONFINED;
+ }
+
+ @Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) {
final RectangleImmutable rect = clampRect((ScreenDriver) getScreen(), new Rectangle(x, y, width, height), false);
// reconfigure0 will issue position/size changed events if required
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 ceda0997b..b01928449 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
@@ -35,7 +35,6 @@
package jogamp.newt.driver.intel.gdl;
import com.jogamp.nativewindow.*;
-import com.jogamp.nativewindow.util.Insets;
import com.jogamp.nativewindow.util.Point;
public class WindowDriver extends jogamp.newt.WindowImpl {
@@ -86,6 +85,11 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
@Override
+ protected final int getSupportedReconfigMaskImpl() {
+ return minimumReconfigStateMask;
+ }
+
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, final int flags) {
final ScreenDriver screen = (ScreenDriver) getScreen();
diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
index c18eff217..4319bedc1 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
@@ -39,7 +39,6 @@ import com.jogamp.nativewindow.GraphicsConfigurationFactory;
import com.jogamp.nativewindow.NativeWindowException;
import com.jogamp.nativewindow.VisualIDHolder;
import com.jogamp.nativewindow.VisualIDHolder.VIDType;
-import com.jogamp.nativewindow.util.Insets;
import com.jogamp.nativewindow.util.Point;
import com.jogamp.opengl.GLCapabilitiesImmutable;
@@ -96,6 +95,12 @@ public class WindowDriver extends WindowImpl {
protected void requestFocusImpl(final boolean reparented) { }
@Override
+ protected final int getSupportedReconfigMaskImpl() {
+ return minimumReconfigStateMask |
+ STATE_MASK_FULLSCREEN;
+ }
+
+ @Override
protected boolean reconfigureWindowImpl(final int x, final int y, int width, int height, final int flags) {
if( 0 != ( CHANGE_MASK_VISIBILITY & flags) ) {
setVisible0(eglWindowHandle, 0 != ( STATE_MASK_VISIBLE & flags));
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index 0ab400fa3..5f90b29f4 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -41,7 +41,6 @@ import com.jogamp.nativewindow.NativeWindowException;
import com.jogamp.nativewindow.MutableSurface;
import com.jogamp.nativewindow.ScalableSurface;
import com.jogamp.nativewindow.VisualIDHolder;
-import com.jogamp.nativewindow.util.Insets;
import com.jogamp.nativewindow.util.Point;
import com.jogamp.nativewindow.util.PointImmutable;
@@ -391,6 +390,23 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private final int[] normPosSize = { 0, 0, 0, 0 };
@Override
+ protected final int getSupportedReconfigMaskImpl() {
+ return minimumReconfigStateMask |
+ STATE_MASK_AUTOPOSITION |
+ 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_FULLSCREEN |
+ STATE_MASK_POINTERVISIBLE |
+ STATE_MASK_POINTERCONFINED;
+ }
+
+ @Override
protected boolean reconfigureWindowImpl(int _x, int _y, int _width, int _height, final int flags) {
final boolean _isOffscreenInstance = isOffscreenInstance(this, this.getParent());
isOffscreenInstance = 0 != sscSurfaceHandle || _isOffscreenInstance;
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
index 751ce854a..70a8ec558 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
@@ -200,6 +200,23 @@ public class WindowDriver extends WindowImpl {
}
@Override
+ protected final int getSupportedReconfigMaskImpl() {
+ return minimumReconfigStateMask |
+ STATE_MASK_AUTOPOSITION |
+ 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_FULLSCREEN |
+ STATE_MASK_POINTERVISIBLE |
+ STATE_MASK_POINTERCONFINED;
+ }
+
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, final int flags) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("WindowsWindow reconfig.0: "+x+"/"+y+" "+width+"x"+height+
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index 5b6ea45d5..5749f0dc3 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -46,7 +46,6 @@ import jogamp.newt.driver.PNGIcon;
import com.jogamp.nativewindow.*;
import com.jogamp.nativewindow.VisualIDHolder.VIDType;
-import com.jogamp.nativewindow.util.Insets;
import com.jogamp.nativewindow.util.InsetsImmutable;
import com.jogamp.nativewindow.util.Point;
@@ -134,7 +133,7 @@ public class WindowDriver extends WindowImpl {
if (null == handles || 2 != handles.length || 0 == handles[0] || 0 == handles[1] ) {
throw new NativeWindowException("Error creating window");
}
- if(DEBUG_IMPLEMENTATION) { // FIXME
+ if(DEBUG_IMPLEMENTATION) {
System.err.println("X11Window.createNativeImpl() handles "+toHexString(handles[0])+", "+toHexString(handles[1]));
}
setWindowHandle(handles[0]);
@@ -169,15 +168,9 @@ public class WindowDriver extends WindowImpl {
}
}
- /**
- * <p>
- * X11 Window supports {@link #FLAG_IS_FULLSCREEN_SPAN}
- * </p>
- * {@inheritDoc}
- */
@Override
- protected boolean isReconfigureMaskSupported(final int changeFlags) {
- return true; // all flags!
+ protected final int getSupportedReconfigMaskImpl() {
+ return GetSupportedReconfigMask0(javaWindowHandle) & STATE_MASK_ALL_RECONFIG;
}
@Override
@@ -453,12 +446,12 @@ public class WindowDriver extends WindowImpl {
int x, int y, int width, int height, int flags,
int pixelDataSize, Object pixels, int pixels_byte_offset, boolean pixels_is_direct,
boolean verbose);
- private native long GetNativeWindowHandle0(long javaWindowHandle);
+ private static native int GetSupportedReconfigMask0(long javaWindowHandle);
private native void CloseWindow0(long display, long javaWindowHandle /*, long kbdHandle*/, // XKB disabled for now
final int randr_event_base, final int randr_error_base);
- private native void reconfigureWindow0(long display, int screen_index, long parentWindowHandle, long javaWindowHandle,
- int x, int y, int width, int height, int flags);
- private native void requestFocus0(long display, long javaWindowHandle, boolean force);
+ private static native void reconfigureWindow0(long display, int screen_index, long parentWindowHandle, long javaWindowHandle,
+ int x, int y, int width, int height, int flags);
+ private static native void requestFocus0(long display, long javaWindowHandle, boolean force);
private static native void setTitle0(long display, long javaWindowHandle, String title);
diff --git a/src/newt/native/Window.h b/src/newt/native/Window.h
index ada886d24..f6aba4c83 100644
--- a/src/newt/native/Window.h
+++ b/src/newt/native/Window.h
@@ -53,7 +53,9 @@
#define FLAG_IS_MAXIMIZED_VERT ( 1 << 9 )
#define FLAG_IS_MAXIMIZED_HORZ ( 1 << 10 )
#define FLAG_IS_FULLSCREEN ( 1 << 11 )
-#define FLAG_IS_FULLSCREEN_SPAN ( 1 << 12 )
+#define FLAG_IS_POINTERVISIBLE ( 1 << 12 )
+#define FLAG_IS_POINTERCONFINED ( 1 << 13 )
+#define FLAG_IS_FULLSCREEN_SPAN ( 1 << 14 )
#define TST_FLAG_CHANGE_VISIBILITY(f) ( 0 != ( (f) & FLAG_CHANGE_VISIBILITY ) )
#define TST_FLAG_CHANGE_VISIBILITY_FAST(f) ( 0 != ( (f) & FLAG_CHANGE_VISIBILITY_FAST ) )
diff --git a/src/newt/native/WindowsEDID.c b/src/newt/native/WindowsEDID.c
index d84773dc6..5fc410a91 100644
--- a/src/newt/native/WindowsEDID.c
+++ b/src/newt/native/WindowsEDID.c
@@ -144,8 +144,14 @@ static _TCHAR* Get2ndSlashBlock(const _TCHAR* sIn, _TCHAR* sOut, size_t sOutLen)
size_t len = t - s;
if( len > 0 ) {
if( sOutLen >= len ) {
- _tcsncpy_s(sOut, sOutLen, s, len);
- return sOut;
+ // Bug 1196: Unresolved strncpy_s (MSVCRT) on WinXP.
+ // Mapped: _tcsncpy_s -> strncpy_s (!UNICODE).
+ // On WinXP MSVCRT has no strncpy_s.
+ // _tcsncpy_s(sOut, sOutLen, s, len);
+ if( len <= sOutLen-1 ) {
+ _tcsncpy(sOut, s, len);
+ return sOut;
+ }
}
}
}
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index a9a5cac10..c411b474b 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -226,6 +226,8 @@ typedef struct {
BOOL isMinimized;
/** Bool: 0 NOP, 1 maximized */
BOOL isMaximized;
+ BOOL isOnBottom;
+ BOOL isOnTop;
int pointerCaptured;
int pointerInside;
int touchDownCount;
@@ -608,21 +610,41 @@ static int WmKeyUp(JNIEnv *env, jobject window, USHORT wkey, WORD repCnt, BYTE s
static void NewtWindows_requestFocus (JNIEnv *env, jobject window, HWND hwnd, jboolean force) {
HWND pHwnd, current;
+ WindowUserData * wud;
BOOL isEnabled = IsWindowEnabled(hwnd);
pHwnd = GetParent(hwnd);
current = GetFocus();
- DBG_PRINT("*** WindowsWindow: requestFocus.S force %d, parent %p, window %p, isEnabled %d, isCurrent %d\n",
- (int)force, (void*)pHwnd, (void*)hwnd, isEnabled, current==hwnd);
+#if !defined(__MINGW64__) && ( defined(UNDER_CE) || _MSC_VER <= 1200 )
+ wud = (WindowUserData *) GetWindowLong(hwnd, GWL_USERDATA);
+#else
+ wud = (WindowUserData *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+#endif
+
+ DBG_PRINT("*** WindowsWindow: requestFocus.S force %d, parent %p, window %p, isEnabled %d, isCurrent %d, isOn[Top %d, Bottom %d]\n",
+ (int)force, (void*)pHwnd, (void*)hwnd, isEnabled, current==hwnd,
+ wud->isOnTop, wud->isOnBottom);
if( JNI_TRUE==force || current!=hwnd || !isEnabled ) {
UINT flags = SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
if(!isEnabled) {
EnableWindow(hwnd, TRUE);
}
- SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, flags);
- SetForegroundWindow(hwnd); // Slightly Higher Priority
+ BOOL frontWindow;
+ if( wud->isOnBottom ) {
+ SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
+ frontWindow = FALSE;
+ } else if( wud->isOnTop ) {
+ SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, flags);
+ frontWindow = TRUE;
+ } else {
+ SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, flags);
+ frontWindow = TRUE;
+ }
+ if( frontWindow ) {
+ SetForegroundWindow(hwnd); // Slightly Higher Priority
+ }
SetFocus(hwnd);// Sets Keyboard Focus To Window (activates parent window if exist, or this window)
- if(NULL!=pHwnd) {
+ if( frontWindow && NULL!=pHwnd ) {
SetActiveWindow(hwnd);
}
current = GetFocus();
@@ -674,7 +696,7 @@ static void UpdateInsets(JNIEnv *env, WindowUserData *wud, HWND hwnd) {
if (IsIconic(hwnd)) {
wud->insets.left = wud->insets.top = wud->insets.right = wud->insets.bottom = -1;
- return FALSE;
+ return;
}
wud->insets.left = wud->insets.top = wud->insets.right = wud->insets.bottom = 0;
@@ -959,11 +981,15 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
// Bug 916 - NEWT Fullscreen Mode on Windows ALT-TAB doesn't allow Application Switching
// Remedy for 'some' display drivers, i.e. Intel HD:
// Explicitly push fullscreen window to BOTTOM when inactive (ALT-TAB)
- UINT flags = SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
- if( inactive ) {
- SetWindowPos(wnd, HWND_BOTTOM, 0, 0, 0, 0, flags);
+ if( inactive || wud->isOnBottom ) {
+ SetWindowPos(wnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
} else {
- SetWindowPos(wnd, HWND_TOP, 0, 0, 0, 0, flags);
+ UINT flags = SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
+ if( wud->isOnTop ) {
+ SetWindowPos(wnd, HWND_TOPMOST, 0, 0, 0, 0, flags);
+ } else {
+ SetWindowPos(wnd, HWND_TOP, 0, 0, 0, 0, flags);
+ }
SetForegroundWindow(wnd); // Slightly Higher Priority
}
}
@@ -971,6 +997,35 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
}
break;
+ case WM_WINDOWPOSCHANGING: {
+ WINDOWPOS *p = (WINDOWPOS*)lParam;
+ BOOL isThis = wnd == p->hwnd;
+ BOOL isBottom = HWND_BOTTOM == p->hwndInsertAfter;
+ BOOL isTopMost = HWND_TOPMOST == p->hwndInsertAfter;
+ BOOL forceBottom = isThis && wud->isOnBottom && !isBottom;
+ BOOL forceTop = isThis && wud->isOnTop && !isTopMost;
+ #ifdef VERBOSE_ON
+ BOOL isNoTopMost = HWND_NOTOPMOST == p->hwndInsertAfter;
+ BOOL isTop = HWND_TOP == p->hwndInsertAfter;
+ BOOL isTopMost = HWND_TOPMOST == p->hwndInsertAfter;
+ BOOL isNoZ = 0 != ( SWP_NOZORDER & p->flags );
+ DBG_PRINT("*** WindowsWindow: WM_WINDOWPOSCHANGING window %p / %p (= %d), %p[bottom %d, notop %d, top %d, topmost %d, noZ %d, force[Top %d, Bottom %d], %d/%d %dx%d 0x%X\n",
+ wnd, p->hwnd, isThis,
+ p->hwndInsertAfter, isBottom, isNoTopMost, isTop, isTopMost, isNoZ,
+ forceTop, forceBottom,
+ p->x, p->y, p->cx, p->cy, p->flags);
+ #endif
+ if( forceTop ) {
+ p->hwndInsertAfter = HWND_TOPMOST;
+ p->flags &= ~SWP_NOZORDER;
+ } else if( forceBottom ) {
+ p->hwndInsertAfter = HWND_BOTTOM;
+ p->flags &= ~SWP_NOZORDER;
+ }
+ useDefWindowProc = 1;
+ }
+ break;
+
case WM_SETTINGCHANGE:
if (wParam == SPI_SETNONCLIENTMETRICS) {
// make sure insets are updated, we don't need to resize the window
@@ -2078,6 +2133,9 @@ static void NewtWindow_setVisiblePosSize(WindowUserData *wud, HWND hwnd, int jfl
if(visible) {
wflags = SWP_SHOWWINDOW;
+ if( abottom ) {
+ wflags |= SWP_NOACTIVATE;
+ }
} else {
wflags = SWP_NOACTIVATE | SWP_NOZORDER;
}
@@ -2085,6 +2143,8 @@ static void NewtWindow_setVisiblePosSize(WindowUserData *wud, HWND hwnd, int jfl
wflags |= SWP_NOSIZE;
}
+ wud->isOnTop = atop;
+ wud->isOnBottom = abottom;
if(atop) {
SetWindowPos(hwnd, HWND_TOP, x, y, width, height, wflags);
SetWindowPos(hwnd, HWND_TOPMOST, x, y, width, height, wflags);
@@ -2095,7 +2155,6 @@ static void NewtWindow_setVisiblePosSize(WindowUserData *wud, HWND hwnd, int jfl
SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, width, height, wflags);
SetWindowPos(hwnd, HWND_TOP, x, y, width, height, wflags);
}
- // SetWindowPos(hwnd, atop ? HWND_TOPMOST : HWND_TOP, x, y, width, height, wflags);
if( TST_FLAG_CHANGE_MAXIMIZED_ANY(jflags) ) {
if( TST_FLAG_IS_MAXIMIZED_VERT(jflags) && TST_FLAG_IS_MAXIMIZED_HORZ(jflags) ) {
@@ -2191,6 +2250,8 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_windows_WindowDriver_CreateWindo
wud->isChildWindow = NULL!=parentWindow;
wud->isMinimized = FALSE;
wud->isMaximized = FALSE;
+ wud->isOnBottom = FALSE;
+ wud->isOnTop = FALSE;
wud->pointerCaptured = 0;
wud->pointerInside = 0;
wud->touchDownCount = 0;
@@ -2283,6 +2344,8 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_reconfigureW
DWORD windowStyle = WS_DEFAULT_STYLES;
BOOL styleChange = TST_FLAG_CHANGE_DECORATION(flags) || TST_FLAG_CHANGE_FULLSCREEN(flags) ||
TST_FLAG_CHANGE_PARENTING(flags) || TST_FLAG_CHANGE_RESIZABLE(flags);
+ BOOL atop = TST_FLAG_IS_ALWAYSONTOP(flags);
+ BOOL abottom = TST_FLAG_IS_ALWAYSONBOTTOM(flags);
WindowUserData * wud;
#if !defined(__MINGW64__) && ( defined(UNDER_CE) || _MSC_VER <= 1200 )
wud = (WindowUserData *) GetWindowLong(hwnd, GWL_USERDATA);
@@ -2290,12 +2353,13 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_reconfigureW
wud = (WindowUserData *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
#endif
- DBG_PRINT( "*** WindowsWindow: reconfigureWindow0 parent %p, window %p, %d/%d %dx%d, parentChange %d, isChild %d, undecoration[change %d, val %d], fullscreen[change %d, val %d], alwaysOnTop[change %d, val %d], visible[change %d, val %d], resizable[change %d, val %d] -> styleChange %d, isChild %d, isMinimized %d, isMaximized %d, isFullscreen %d\n",
+ DBG_PRINT( "*** WindowsWindow: reconfigureWindow0 parent %p, window %p, %d/%d %dx%d, parentChange %d, isChild %d, undecoration[change %d, val %d], fullscreen[change %d, val %d], alwaysOnTop[change %d, val %d], alwaysOnBottom[change %d, val %d], visible[change %d, val %d], resizable[change %d, val %d] -> styleChange %d, isChild %d, isMinimized %d, isMaximized %d, isFullscreen %d\n",
parent, window, x, y, width, height,
TST_FLAG_CHANGE_PARENTING(flags), TST_FLAG_IS_CHILD(flags),
TST_FLAG_CHANGE_DECORATION(flags), TST_FLAG_IS_UNDECORATED(flags),
TST_FLAG_CHANGE_FULLSCREEN(flags), TST_FLAG_IS_FULLSCREEN(flags),
TST_FLAG_CHANGE_ALWAYSONTOP(flags), TST_FLAG_IS_ALWAYSONTOP(flags),
+ TST_FLAG_CHANGE_ALWAYSONBOTTOM(flags), TST_FLAG_IS_ALWAYSONBOTTOM(flags),
TST_FLAG_CHANGE_VISIBILITY(flags), TST_FLAG_IS_VISIBLE(flags),
TST_FLAG_CHANGE_RESIZABLE(flags), TST_FLAG_CHANGE_RESIZABLE(flags), styleChange,
wud->isChildWindow, wud->isMinimized, wud->isMaximized, wud->isFullscreen);
@@ -2305,6 +2369,9 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_reconfigureW
return;
}
+ wud->isOnTop = atop;
+ wud->isOnBottom = abottom;
+
if (NULL!=hwndP && !IsWindow(hwndP)) {
DBG_PRINT("*** WindowsWindow: reconfigureWindow0 failure: Passed parent window %p is invalid\n", (void*)hwndP);
return;
@@ -2329,10 +2396,15 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_reconfigureW
SetParent(hwnd, NULL);
}
- if( TST_FLAG_CHANGE_FULLSCREEN(flags) && TST_FLAG_IS_FULLSCREEN(flags) ) { // FS on
- // TOP: in -> out
- wud->isFullscreen = TRUE;
- NewtWindows_setFullScreen(JNI_TRUE);
+ if( TST_FLAG_IS_FULLSCREEN(flags) ) {
+ if( TST_FLAG_CHANGE_FULLSCREEN(flags) ) { // FS on
+ wud->isFullscreen = TRUE;
+ if( !abottom ) {
+ NewtWindows_setFullScreen(JNI_TRUE);
+ }
+ } else if( TST_FLAG_CHANGE_ALWAYSONBOTTOM(flags) ) { // FS BOTTOM toggle
+ NewtWindows_setFullScreen( abottom ? JNI_FALSE : JNI_TRUE);
+ }
}
if ( styleChange ) {
@@ -2351,7 +2423,6 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_reconfigureW
}
if( TST_FLAG_CHANGE_FULLSCREEN(flags) && !TST_FLAG_IS_FULLSCREEN(flags) ) { // FS off
- // CHILD: out -> in
wud->isFullscreen = FALSE;
NewtWindows_setFullScreen(JNI_FALSE);
}
@@ -2365,9 +2436,12 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_reconfigureW
if( TST_FLAG_CHANGE_VISIBILITY(flags) ) {
if( TST_FLAG_IS_VISIBLE(flags) ) {
- int cmd = wud->isMinimized ? SW_RESTORE : SW_SHOW;
+ int cmd = wud->isMinimized ? SW_RESTORE : ( abottom ? SW_SHOWNA : SW_SHOW );
wud->isMinimized = FALSE;
ShowWindow(hwnd, cmd);
+ if( abottom ) {
+ SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
+ }
} else if( !TST_FLAG_CHANGE_VISIBILITY_FAST(flags) && !TST_FLAG_IS_CHILD(flags) ) {
wud->isMinimized = TRUE;
ShowWindow(hwnd, SW_MINIMIZE);
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index 6fa3cc195..5e0a32125 100644
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -988,6 +988,34 @@ JNIEXPORT jlongArray JNICALL Java_jogamp_newt_driver_x11_WindowDriver_CreateWind
/*
* Class: jogamp_newt_driver_x11_WindowDriver
+ * Method: GetSupportedReconfigMask0
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_WindowDriver_GetSupportedReconfigMask0
+ (JNIEnv *env, jclass clazz, jlong javaWindow)
+{
+ JavaWindow * jw = (JavaWindow*)(intptr_t)javaWindow;
+ uint32_t supported = jw->supportedAtoms;
+ return
+ FLAG_IS_VISIBLE |
+ FLAG_IS_AUTOPOSITION |
+ FLAG_IS_CHILD |
+ FLAG_IS_FOCUSED |
+ FLAG_IS_UNDECORATED |
+ ( ( 0 != ( _MASK_NET_WM_STATE_ABOVE & supported ) ) ? FLAG_IS_ALWAYSONTOP : 0 ) |
+ ( ( 0 != ( _MASK_NET_WM_STATE_BELOW & supported ) ) ? FLAG_IS_ALWAYSONBOTTOM : 0 ) |
+ ( ( 0 != ( _MASK_NET_WM_DESKTOP & supported ) ) ? FLAG_IS_STICKY : 0 ) |
+ FLAG_IS_RESIZABLE |
+ ( ( 0 != ( _MASK_NET_WM_STATE_MAXIMIZED_VERT & supported ) ) ? FLAG_IS_MAXIMIZED_VERT : 0 ) |
+ ( ( 0 != ( _MASK_NET_WM_STATE_MAXIMIZED_HORZ & supported ) ) ? FLAG_IS_MAXIMIZED_HORZ : 0 ) |
+ FLAG_IS_FULLSCREEN |
+ FLAG_IS_POINTERVISIBLE |
+ FLAG_IS_POINTERCONFINED |
+ FLAG_IS_FULLSCREEN_SPAN;
+}
+
+/*
+ * Class: jogamp_newt_driver_x11_WindowDriver
* Method: CloseWindow
* Signature: (JJ)V
*/
@@ -1065,7 +1093,7 @@ static Bool WaitForReparentNotify( Display *dpy, XEvent *event, XPointer arg ) {
* Signature: (JIJJIIIII)V
*/
JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_WindowDriver_reconfigureWindow0
- (JNIEnv *env, jobject obj, jlong jdisplay, jint screen_index,
+ (JNIEnv *env, jclass clazz, jlong jdisplay, jint screen_index,
jlong jparent, jlong javaWindow,
jint x, jint y, jint width, jint height, jint flags)
{
@@ -1259,7 +1287,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_WindowDriver_reconfigureWindo
* Signature: (JJZ)V
*/
JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_WindowDriver_requestFocus0
- (JNIEnv *env, jobject obj, jlong display, jlong javaWindow, jboolean force)
+ (JNIEnv *env, jclass clazz, jlong display, jlong javaWindow, jboolean force)
{
NewtWindows_requestFocus ( (Display *) (intptr_t) display, (JavaWindow*)(intptr_t)javaWindow, JNI_TRUE==force?True:False ) ;
}