diff options
author | Sven Gothel <[email protected]> | 2023-01-22 01:21:31 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-01-22 01:21:31 +0100 |
commit | b8977465b2fb8452c2560a5d2561b2561472edf0 (patch) | |
tree | 329ce42fb1d0e66b03822bb3a83c6932168a5d63 /src/nativewindow/classes | |
parent | 81f395975c06a66183ad36cc43e8dc9bc7f4545b (diff) |
MacOS: JAWTWindow.layoutSurfaceLayerImpl(): Perform OSXUtil.FixCALayerLayout() on main thread and hence fetch and validate getAttachedSurfaceLayer() when needed
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java | 4 | ||||
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index a4349f545..8ee1adc06 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -531,11 +531,11 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, * @see #isOffscreenLayerSurfaceEnabled() * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false */ - protected void layoutSurfaceLayerImpl(final long layerHandle, final boolean visible) {} + protected void layoutSurfaceLayerImpl(final boolean visible) {} private final void layoutSurfaceLayerIfEnabled(final boolean visible) throws NativeWindowException { if( isOffscreenLayerSurfaceEnabled() && 0 != offscreenSurfaceLayer ) { - layoutSurfaceLayerImpl(offscreenSurfaceLayer, visible); + layoutSurfaceLayerImpl(visible); } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index 4cba086e0..8848877d4 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -177,7 +177,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } @Override - protected void layoutSurfaceLayerImpl(final long layerHandle, final boolean visible) { + protected void layoutSurfaceLayerImpl(final boolean visible) { final int caLayerQuirks = JAWTUtil.getOSXCALayerQuirks(); // AWT position is top-left w/ insets, where CALayer position is bottom/left from root CALayer w/o insets. // Determine p0: components location on screen w/o insets. @@ -199,14 +199,22 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { if( null != outterInsets ) { pA1.translate(-outterInsets.left, -outterInsets.top); } - System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(layerHandle) + ", quirks "+caLayerQuirks+", visible "+visible+ + System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(getAttachedSurfaceLayer()) + ", quirks "+caLayerQuirks+", visible "+visible+ ", [ins "+outterInsets+"], pA "+pA0+" -> "+pA1+ ", p0 "+p0+" -> "+p1+", bounds "+bounds); } else if( DEBUG ) { - System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(layerHandle) + ", quirks "+caLayerQuirks+", visible "+visible+ + System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(getAttachedSurfaceLayer()) + ", quirks "+caLayerQuirks+", visible "+visible+ ", [ins "+outterInsets+"], p0 "+p0+" -> "+p1+", bounds "+bounds); } - OSXUtil.FixCALayerLayout(rootSurfaceLayer, layerHandle, visible, p1.getX(), p1.getY(), getWidth(), getHeight(), caLayerQuirks); + OSXUtil.RunOnMainThread(false /* wait */, false, new Runnable() { + @Override + public void run() { + final long osl = getAttachedSurfaceLayer(); + if( 0 != rootSurfaceLayer && 0 != osl ) { + OSXUtil.FixCALayerLayout(rootSurfaceLayer, osl, visible, p1.getX(), p1.getY(), getWidth(), getHeight(), caLayerQuirks); + } + } + }); } @Override |