diff options
Diffstat (limited to 'src/newt')
14 files changed, 271 insertions, 59 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index 7ba94d5b2..51395602c 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -327,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 @@ -351,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_BIT_VISIBLE}: {@link #setVisible(boolean) Visibility} can be toggled after creation. <b>Minimum requirement</b>.</li> + * <li>{@link #STATE_BIT_AUTOPOSITION}: {@code WindowManager autoposition} is supported.</li> + * <li>{@link #STATE_BIT_CHILDWIN}: {@link #reparentWindow(NativeWindow, int, int, int) Native window parenting} is supported.</li> + * <li>{@link #STATE_BIT_FOCUSED}: Window {@link #requestFocus() focus management} is supported. <b>Minimum requirement</b>.</li> + * <li>{@link #STATE_BIT_UNDECORATED}: {@link #setUndecorated(boolean) Window decoration} can be toggled after creation.</li> + * <li>{@link #STATE_BIT_ALWAYSONTOP}: Window can be set {@link #setAlwaysOnTop(boolean) always-on-top}. </li> + * <li>{@link #STATE_BIT_ALWAYSONBOTTOM}: Window can be set {@link #setAlwaysOnBottom(boolean) always-on-bottom}. </li> + * <li>{@link #STATE_BIT_STICKY}: Window can be set {@link #setSticky(boolean) sticky}.</li> + * <li>{@link #STATE_BIT_RESIZABLE}: Window {@link #setResizable(boolean) resizability} can be disabled and toggled.</li> + * <li>{@link #STATE_BIT_MAXIMIZED_VERT}: Window can be {@link #setMaximized(boolean, boolean) maximized-vertically}. </li> + * <li>{@link #STATE_BIT_MAXIMIZED_HORZ}: Window can be {@link #setMaximized(boolean, boolean) maximized-horizontally}. </li> + * <li>{@link #STATE_BIT_FULLSCREEN}: Window {@link #setFullscreen(boolean) fullscreen} can be toggled after creation. </li> + * <li>{@link #STATE_BIT_POINTERVISIBLE}: Window {@link #setPointerVisible(boolean) pointer visibility} can be toggled. </li> + * <li>{@link #STATE_BIT_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 4015da80d..b6e2a1dea 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -255,6 +255,11 @@ 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); @@ -265,6 +270,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer stateMask.set(PSTATE_BIT_FULLSCREEN_MAINMONITOR); normPosSizeStored[0] = false; normPosSizeStored[1] = false; + supportedReconfigStateMask = STATE_MASK_ALL_RECONFIG; } @Override @@ -280,16 +286,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("*"); } @@ -299,8 +318,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) ) { @@ -310,8 +331,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) ) { @@ -319,8 +342,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) ) { @@ -328,8 +353,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) ) { @@ -337,8 +364,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) ) { @@ -346,8 +375,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) ) { @@ -355,7 +386,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("*"); @@ -384,28 +415,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; @@ -670,6 +720,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); @@ -847,6 +901,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. * @@ -861,19 +926,17 @@ 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) { 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..f29ee4bf5 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 cdd22d277..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 { } } - /** - * {@inheritDoc} - * <p> - * X11 Window supports {@link #STATE_BIT_FULLSCREEN_SPAN}. - * </p> - */ @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/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 ) ; } |