diff options
author | Sven Gothel <[email protected]> | 2023-01-31 04:58:29 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-01-31 04:58:29 +0100 |
commit | 1d4c077b29a69fd13526dfd25d00ee87c0d5b3fe (patch) | |
tree | 1035219cefc769b8595bd34237670678c70e78c2 | |
parent | 43dc472c4797f34e4079028a5eb04bc420c11c2a (diff) |
NEWT Soft-PixelScale (p3): WindowImpl.createNativeImpl(..): Add boolean positionModified[] return value, allowing to not wait for the previous custom position
This is required if createNativeImpl(..) modifies the target position, i.e. due to soft-pixel-scale.
12 files changed, 23 insertions, 18 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 4bdbc3272..dc6a45d48 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -764,7 +764,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } if(canCreateNativeImpl()) { final int wX, wY; - final boolean usePosition; + boolean usePosition; + final boolean[] positionModified = new boolean[] { false }; if( stateMask.get(STATE_BIT_AUTOPOSITION) ) { wX = 0; wY = 0; @@ -775,7 +776,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer usePosition = true; } final long t0 = System.currentTimeMillis(); - createNativeImpl(); + createNativeImpl( positionModified ); + usePosition = usePosition && !positionModified[0]; supportedReconfigStateMask = getSupportedReconfigMaskImpl() & STATE_MASK_ALL_RECONFIG; if( DEBUG_IMPLEMENTATION) { final boolean minimumOK = minimumReconfigStateMask == ( minimumReconfigStateMask & supportedReconfigStateMask ); @@ -819,7 +821,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } if (DEBUG_IMPLEMENTATION) { - System.err.println("Window.createNative(): elapsed "+(System.currentTimeMillis()-t0)+" ms"); + System.err.println("Window.createNative(): position[modified "+positionModified[0]+", use "+usePosition+ + "], elapsed "+(System.currentTimeMillis()-t0)+" ms"); } postParentlockFocus = true; } @@ -954,14 +957,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * The implementation should invoke the referenced java state callbacks * to notify this Java object of state changes.</p> * + * @param positionModified returns indication that the position has been modified and shall not be waited upon. + * * @see #windowDestroyNotify(boolean) * @see #focusChanged(boolean, boolean) * @see #visibleChanged(boolean) * @see #sizeChanged(int,int) - * @see #positionChanged(boolean,int, int) + * @see #positionChanged(boolean,boolean, int, int) * @see #windowDestroyNotify(boolean) */ - protected abstract void createNativeImpl(); + protected abstract void createNativeImpl(boolean[] positionModified); protected abstract void closeNativeImpl(); @@ -987,12 +992,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * </p> * <p> * Will be called twice. Once after simple {@link #instantiationFinished()} - * pre native window creation and once right after {@link #createNativeImpl() native creation}. + * pre native window creation and once right after {@link #createNativeImpl(boolean[]) native creation}. * </p> * @see #getSupportedStateMask() * @see #reconfigureWindowImpl(int, int, int, int, int) * @see #instantiationFinished() - * @see #createNativeImpl() + * @see #createNativeImpl(boolean[]) */ protected abstract int getSupportedReconfigMaskImpl(); diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java index a34e5d5ab..9ffeaffa2 100644 --- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java @@ -324,7 +324,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { } @Override - protected final void createNativeImpl() { + protected final void createNativeImpl(boolean[] positionModified) { // Create own screen/device resource instance allowing independent ownership, // while still utilizing shared EGL resources. final AbstractGraphicsScreen aScreen = getScreen().getGraphicsScreen(); diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java index a20777ef2..ae316dcf1 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java @@ -119,7 +119,7 @@ public class WindowDriver extends WindowImpl { }; @Override - protected void createNativeImpl() { + protected void createNativeImpl(boolean[] positionModified) { if( withinLocalDispose ) { setupHandleAndGC(); defineWindowPosition(getX(), getY()); // clear AUTOPOS 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 d71054fcf..1bffad278 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java @@ -52,7 +52,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { } @Override - protected void createNativeImpl() { + protected void createNativeImpl(boolean[] positionModified) { if(0!=getParentWindowHandle()) { throw new RuntimeException("Window parenting not supported (yet)"); } 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 6a50f0f07..73a13f413 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 @@ -87,7 +87,7 @@ public class WindowDriver extends WindowImpl { * * @param screen * @param rect the {@link RectangleImmutable} in pixel units - * @param definePosSize if {@code true} issue {@link #definePosition(int, int)} and {@link #defineSize(int, int)} + * @param definePosSize if {@code true} issue {@link #defineWindowPosition(int, int)} and {@link #defineWindowSize(int, int)} * if either has changed. * @return If position or size has been clamped a new {@link RectangleImmutable} instance w/ clamped values * will be returned, otherwise the given {@code rect} is returned. diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java index 7e1d9423e..9aa1f4823 100644 --- a/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java @@ -107,7 +107,7 @@ public class WindowDriver extends WindowImpl { } @Override - protected void createNativeImpl() { + protected void createNativeImpl(boolean[] positionModified) { if (0 != getParentWindowHandle()) { throw new RuntimeException("Window parenting not supported (yet)"); } 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 34b5d80d8..187c491e2 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java @@ -48,7 +48,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { static long nextWindowHandle = 1; @Override - protected void createNativeImpl() { + protected void createNativeImpl(boolean[] positionModified) { if(0!=getParentWindowHandle()) { throw new NativeWindowException("GDL Window does not support window parenting"); } diff --git a/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java index 7d928cf32..98700e5fe 100644 --- a/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java @@ -187,7 +187,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } @Override - protected void createNativeImpl() { + protected void createNativeImpl(boolean[] positionModified) { final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration( capsRequested, capsRequested, capabilitiesChooser, getScreen().getGraphicsScreen(), VisualIDHolder.VID_UNDEFINED); if (null == cfg) { diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java index ae578fec0..d6d2740dc 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java @@ -56,7 +56,7 @@ public class WindowDriver extends WindowImpl { } @Override - protected void createNativeImpl() { + protected void createNativeImpl(boolean[] positionModified) { if(0!=getParentWindowHandle()) { throw new RuntimeException("Window parenting not supported (yet)"); } diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java index e07064959..f7339292f 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java @@ -201,7 +201,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } @Override - protected void createNativeImpl() { + protected void createNativeImpl(final boolean[] positionModified) { final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration( capsRequested, capsRequested, capabilitiesChooser, getScreen().getGraphicsScreen(), VisualIDHolder.VID_UNDEFINED); if (null == cfg) { diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java index 6c5f97cdd..fb20265ce 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java @@ -130,7 +130,7 @@ public class WindowDriver extends WindowImpl { } @Override - protected void createNativeImpl() { + protected void createNativeImpl(final boolean[] positionModified) { final ScreenDriver screen = (ScreenDriver) getScreen(); final DisplayDriver display = (DisplayDriver) screen.getDisplay(); final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(display.getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration( diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java index a71192a66..c1a24797b 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java @@ -95,7 +95,7 @@ public class WindowDriver extends WindowImpl { } @Override - protected void createNativeImpl() { + protected void createNativeImpl(boolean[] positionModified) { final ScreenDriver screen = (ScreenDriver) getScreen(); final DisplayDriver display = (DisplayDriver) screen.getDisplay(); final AbstractGraphicsDevice edtDevice = display.getGraphicsDevice(); |