Top Fields Constructors Methods
jogamp.nativewindow.jawt.macosx

public Class MacOSXJAWTWindow

extends JAWTWindow
implements MutableSurface
Class Inheritance
All Implemented Interfaces
com.jogamp.nativewindow.MutableSurface, com.jogamp.nativewindow.NativeSurface, com.jogamp.nativewindow.SurfaceUpdatedListener
Imports
java.awt.Component, .GraphicsConfiguration, java.nio.Buffer, java.security.AccessController, .PrivilegedAction, com.jogamp.nativewindow.AbstractGraphicsConfiguration, .Capabilities, .NativeSurface, .NativeWindowException, .MutableSurface, com.jogamp.nativewindow.util.Point, com.jogamp.common.util.PropertyAccess, com.jogamp.nativewindow.awt.JAWTWindow, jogamp.nativewindow.Debug, jogamp.nativewindow.awt.AWTMisc, jogamp.nativewindow.jawt.JAWT, .JAWTFactory, .JAWTUtil, .JAWT_DrawingSurface, .JAWT_DrawingSurfaceInfo, jogamp.nativewindow.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo, jogamp.nativewindow.macosx.OSXUtil

Field Summary

Modifier and TypeField and Description
private static final boolean
DEBUG_CALAYER_POS_CRITICAL

May lead to deadlock, due to AWT pos comparison ..

private JAWT_DrawingSurface
private JAWT_DrawingSurfaceInfo
private boolean
private boolean
private long
private JAWT_MacOSXDrawingSurfaceInfo
private long
private boolean
private volatile long
private long
Inherited from com.jogamp.nativewindow.awt.JAWTWindow:
boundscomponentDEBUGdrawableinsetsshallUseOffscreenLayer

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
detachSurfaceLayerImpl(final long layerHandle, final Runnable
Runnable to be called before native detachment
detachNotify
)

Overrides com.jogamp.nativewindow.awt.JAWTWindow.detachSurfaceLayerImpl.

private void
protected JAWT
fetchJAWTImpl()

Implements abstract com.jogamp.nativewindow.awt.JAWTWindow.fetchJAWTImpl.

If JAWT offscreen layer is supported, implementation shall respect getShallUseOffscreenLayer() and may respect isApplet().
private static native long
GetJAWTSurfaceLayersHandle0(Buffer jawtDrawingSurfaceInfoBuffer)

public Point
getLocationOnScreen(Point
Optional Point storage. If not null, null, it is translated about the resulting screen position and returned.
storage
)

Overrides com.jogamp.nativewindow.awt.JAWTWindow.getLocationOnScreen.

Implements com.jogamp.nativewindow.NativeWindow.getLocationOnScreen.

Returns the window's top-left client-area position in the screen.
protected Point
public final long
getSurfaceHandle()

Overrides com.jogamp.nativewindow.awt.JAWTWindow.getSurfaceHandle.

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceHandle.

Returns the handle to the surface for this NativeSurface.
public final long
protected void
protected void
layoutSurfaceLayerImpl(final long layerHandle, final boolean visible)

Overrides com.jogamp.nativewindow.awt.JAWTWindow.layoutSurfaceLayerImpl.

Layout the offscreen layer according to the implementing class's constraints.
protected int
private static native void
SetJAWTRootSurfaceLayer0(long jawtSurfaceLayersHandle, long caLayer)

Set the given root CALayer in the JAWT surface

public void
setSurfaceHandle(final long surfaceHandle)

Implements com.jogamp.nativewindow.MutableSurface.setSurfaceHandle.

Sets the surface handle which is created outside of this implementation.
public boolean
setSurfaceScale(final float[]
requested surface pixel scale float[2] values for x- and y-direction.
pixelScale
)

Overrides com.jogamp.nativewindow.awt.JAWTWindow.setSurfaceScale.

Implements com.jogamp.nativewindow.ScalableSurface.setSurfaceScale.

Request a pixel scale in x- and y-direction for the associated NativeSurface, where size_in_pixel_units = pixel_scale * size_in_window_units.
protected void
private static native void
UnsetJAWTRootSurfaceLayer0(long jawtSurfaceLayersHandle, long caLayer)

Unset the given root CALayer in the JAWT surface, passing the NIO DrawingSurfaceInfo buffer

Inherited from com.jogamp.nativewindow.awt.JAWTWindow:
addSurfaceUpdatedListeneraddSurfaceUpdatedListenerattachSurfaceLayerconvertToPixelUnitsconvertToWindowUnitsdestroydetachSurfaceLayerdumpJAWTInfogetAttachedSurfaceLayergetAWTComponentgetAWTGraphicsConfigurationgetBoundsgetCurrentSurfaceScalegetDisplayHandlegetGraphicsConfigurationgetHeightgetInsetsgetJAWTgetLocationOnScreenNativegetLockgetMaximumSurfaceScalegetMinimumSurfaceScalegetNativeSurfacegetParentgetPixelScaleXgetPixelScaleYgetRequestedSurfaceScalegetScreenIndexgetShallUseOffscreenLayergetSurfaceHeightgetSurfaceLockOwnergetSurfaceWidthgetWidthgetXgetYhasFocushasPixelScaleChangedhideCursorinvalidateisAppletisOffscreenLayerSurfaceEnabledisSurfaceLayerAttachedisSurfaceLockedByOtherThreadjawt2StringlockSurfacelockSurfaceImplremoveSurfaceUpdatedListenersetAWTGraphicsConfigurationsetChosenCapabilitiessetCursorsetReqPixelScalesetShallUseOffscreenLayersurfaceSwapsurfaceUpdatedtoHexStringtoHexStringtoStringunlockSurfaceupdateLockedDataupdateLockedDataupdatePixelScaleupdatePixelScale

Field Detail

DEBUG_CALAYER_POS_CRITICALback to summary
private static final boolean DEBUG_CALAYER_POS_CRITICAL

May lead to deadlock, due to AWT pos comparison .. don't enable for Applets!

dsback to summary
private JAWT_DrawingSurface ds
dsiback to summary
private JAWT_DrawingSurfaceInfo dsi
dsLockedback to summary
private boolean dsLocked
firstLockback to summary
private boolean firstLock
jawtSurfaceLayersHandleback to summary
private long jawtSurfaceLayersHandle
macosxdsiback to summary
private JAWT_MacOSXDrawingSurfaceInfo macosxdsi
offscreenSurfaceDrawableback to summary
private long offscreenSurfaceDrawable
offscreenSurfaceDrawableSetback to summary
private boolean offscreenSurfaceDrawableSet
rootSurfaceLayerback to summary
private volatile long rootSurfaceLayer
windowHandleback to summary
private long windowHandle

Constructor Detail

MacOSXJAWTWindowback to summary
public MacOSXJAWTWindow(final Object comp, final AbstractGraphicsConfiguration config)

Method Detail

attachSurfaceLayerImplback to summary
protected void attachSurfaceLayerImpl(final long layerHandle)

Overrides com.jogamp.nativewindow.awt.JAWTWindow.attachSurfaceLayerImpl.

Annotations
@Override
detachSurfaceLayerImplback to summary
protected void detachSurfaceLayerImpl(final long layerHandle, final Runnable detachNotify)

Overrides com.jogamp.nativewindow.awt.JAWTWindow.detachSurfaceLayerImpl.

Parameters
detachNotify:Runnable

Doc from com.jogamp.nativewindow.awt.JAWTWindow.detachSurfaceLayerImpl.

Runnable to be called before native detachment

Annotations
@Override
dumpInfoback to summary
private void dumpInfo()
fetchJAWTImplback to summary
protected JAWT fetchJAWTImpl() throws NativeWindowException

Implements abstract com.jogamp.nativewindow.awt.JAWTWindow.fetchJAWTImpl.

Doc from com.jogamp.nativewindow.awt.JAWTWindow.fetchJAWTImpl.

If JAWT offscreen layer is supported, implementation shall respect getShallUseOffscreenLayer() and may respect isApplet().

Returns:JAWT

The JAWT instance reflecting offscreen layer support, etc.

Annotations
@Override
GetJAWTSurfaceLayersHandle0back to summary
private static native long GetJAWTSurfaceLayersHandle0(Buffer jawtDrawingSurfaceInfoBuffer)
getLocationOnScreenback to summary
public Point getLocationOnScreen(Point storage)

Overrides com.jogamp.nativewindow.awt.JAWTWindow.getLocationOnScreen.

Implements com.jogamp.nativewindow.NativeWindow.getLocationOnScreen.

Doc from com.jogamp.nativewindow.awt.JAWTWindow.getLocationOnScreen.

Returns the window's top-left client-area position in the screen.

If Point is not null, it is translated about the resulting screen position and returned.

See Coordinate System.

Since the position reflects the client area, it does not include the insets.

This JAWT default implementation is currently still using a blocking implementation. It first attempts to retrieve the location via a native implementation. If this fails, it tries the blocking AWT implementation. If the latter fails due to an external AWT tree-lock, the non block implementation getLocationOnScreenNonBlocking(Point, Component) is being used. The latter simply traverse up to the AWT component tree and sums the rel. position. We have to determine whether the latter is good enough for all cases, currently only OS X utilizes the non blocking method per default.

On OS X locking the surface at this point (ie after creation and for location validation) is 'tricky' since the JVM traverses through many threads and crashes at: lockSurfaceImpl() { .. ds = getJAWT().GetDrawingSurface(component); due to a SIGSEGV. Hence we have some threading / sync issues with the native JAWT implementation.

Parameters
storage:Point

Doc from com.jogamp.nativewindow.NativeWindow.getLocationOnScreen.

Optional Point storage. If not null, null, it is translated about the resulting screen position and returned.

Annotations
@Override
getLocationOnScreenNativeImplback to summary
protected Point getLocationOnScreenNativeImpl(final int x0, final int y0)

Implements abstract com.jogamp.nativewindow.awt.JAWTWindow.getLocationOnScreenNativeImpl.

Annotations
@Override
getSurfaceHandleback to summary
public final long getSurfaceHandle()

Overrides com.jogamp.nativewindow.awt.JAWTWindow.getSurfaceHandle.

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceHandle.

Doc from com.jogamp.nativewindow.NativeSurface.getSurfaceHandle.

Returns the handle to the surface for this NativeSurface.

The surface handle should be set/update by lockSurface(), where unlockSurface() is not allowed to modify it. After unlockSurface() it is no more guaranteed that the surface handle is still valid. The surface handle shall reflect the platform one for all drawable surface operations, e.g. opengl, swap-buffer.

On X11 this returns an entity of type Window, since there is no differentiation of surface and window there.
On Microsoft Windows this returns an entity of type HDC.

Annotations
@Override
getWindowHandleback to summary
public final long getWindowHandle()

Overrides com.jogamp.nativewindow.awt.JAWTWindow.getWindowHandle.

Implements com.jogamp.nativewindow.NativeWindow.getWindowHandle.

Doc from com.jogamp.nativewindow.NativeWindow.getWindowHandle.

Returns the window handle for this NativeWindow.

The window handle shall reflect the platform one for all window related operations, e.g. open, close, resize.

On X11 this returns an entity of type Window.
On Microsoft Windows this returns an entity of type HWND.

Annotations
@Override
invalidateNativeback to summary
protected void invalidateNative()

Implements abstract com.jogamp.nativewindow.awt.JAWTWindow.invalidateNative.

Annotations
@Override
layoutSurfaceLayerImplback to summary
protected void layoutSurfaceLayerImpl(final long layerHandle, final boolean visible)

Overrides com.jogamp.nativewindow.awt.JAWTWindow.layoutSurfaceLayerImpl.

Doc from com.jogamp.nativewindow.awt.JAWTWindow.layoutSurfaceLayerImpl.

Layout the offscreen layer according to the implementing class's constraints.

This method allows triggering a re-layout of the offscreen surface in case the implementation requires it.

Call this method if any parent or ancestor's layout has been changed, which could affects the layout of this surface.

Annotations
@Override
lockSurfaceImplback to summary
protected int lockSurfaceImpl(final GraphicsConfiguration gc) throws NativeWindowException

Implements abstract com.jogamp.nativewindow.awt.JAWTWindow.lockSurfaceImpl.

Annotations
@Override
SetJAWTRootSurfaceLayer0back to summary
private static native void SetJAWTRootSurfaceLayer0(long jawtSurfaceLayersHandle, long caLayer)

Set the given root CALayer in the JAWT surface

setSurfaceHandleback to summary
public void setSurfaceHandle(final long surfaceHandle)

Implements com.jogamp.nativewindow.MutableSurface.setSurfaceHandle.

Doc from com.jogamp.nativewindow.MutableSurface.setSurfaceHandle.

Sets the surface handle which is created outside of this implementation.

Annotations
@Override
setSurfaceScaleback to summary
public boolean setSurfaceScale(final float[] pixelScale)

Overrides com.jogamp.nativewindow.awt.JAWTWindow.setSurfaceScale.

Implements com.jogamp.nativewindow.ScalableSurface.setSurfaceScale.

Doc from com.jogamp.nativewindow.ScalableSurface.setSurfaceScale.

Request a pixel scale in x- and y-direction for the associated NativeSurface, where size_in_pixel_units = pixel_scale * size_in_window_units.

Default pixel scale request for both directions is AUTOMAX_PIXELSCALE.

In case platform only supports uniform pixel scale, i.e. one scale for both directions, either AUTOMAX_PIXELSCALE or the maximum requested pixel scale component is used.

The requested pixel scale will be validated against platform limits before native scale-setup, i.e. clipped to IDENTITY_PIXELSCALE if not supported or clipped to the platform maximum. It can be queried via getRequestedSurfaceScale(float[]).

The actual realized pixel scale values of the NativeSurface can be queried via getCurrentSurfaceScale(float[]) or computed via surface.convertToPixelUnits(new int[] { 1, 1 })

Parameters
pixelScale:float[]

requested surface pixel scale float[2] values for x- and y-direction.

Returns:boolean

true if the current pixel scale has changed, otherwise false.

Annotations
@Override
unlockSurfaceImplback to summary
protected void unlockSurfaceImpl() throws NativeWindowException

Implements abstract com.jogamp.nativewindow.awt.JAWTWindow.unlockSurfaceImpl.

Annotations
@Override
UnsetJAWTRootSurfaceLayer0back to summary
private static native void UnsetJAWTRootSurfaceLayer0(long jawtSurfaceLayersHandle, long caLayer)

Unset the given root CALayer in the JAWT surface, passing the NIO DrawingSurfaceInfo buffer