Top Inners Fields Constructors Methods
jogamp.nativewindow.jawt

public Class JAWTUtil

extends Object
Class Inheritance
Imports
java.awt.EventQueue, .GraphicsConfiguration, .GraphicsDevice, .GraphicsEnvironment, .Toolkit, java.lang.reflect.InvocationTargetException, .Method, java.security.AccessController, .PrivilegedAction, java.util.ArrayList, .Map, com.jogamp.nativewindow.AbstractGraphicsDevice, .AbstractGraphicsScreen, .NativeWindowException, .NativeWindowFactory, .ToolkitLock, com.jogamp.nativewindow.awt.AWTGraphicsScreen, jogamp.common.os.PlatformPropsImpl, jogamp.nativewindow.Debug, .NWJNILibLoader, jogamp.nativewindow.jawt.x11.X11SunJDKReflection, jogamp.nativewindow.macosx.OSXUtil, jogamp.nativewindow.x11.X11Lib, com.jogamp.common.os.Platform, com.jogamp.common.util.PropertyAccess, .VersionNumber, com.jogamp.common.util.locks.LockFactory, .RecursiveLock

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
public static final boolean
private static final Method
private static final Method
private static final boolean
private static final boolean
private static final Method
private static final boolean
public static final int
JAWT_MACOSX_USE_CALAYER

OSX JAWT version option to use CALayer

public static final VersionNumber
JAWT_MacOSXCALayerMinVersion

OSX JAWT CALayer availability on Mac OS X >= 10.6 Update 4 (recommended)

public static final VersionNumber
JAWT_MacOSXCALayerRequiredForJavaVersion

OSX JAWT CALayer required with Java >= 1.7.0 (implies OS X >= 10.7

public static final int
JAWT_OSX_CALAYER_QUIRK_LAYOUT

CALayer position needs to be derived from AWT position in relation to super CALayer.

public static final int
JAWT_OSX_CALAYER_QUIRK_POSITION

CALayer position needs to be set to zero.

public static final int
JAWT_OSX_CALAYER_QUIRK_SIZE

CALayer size needs to be set using the AWT component size.

private static final RecursiveLock
private static final JAWT
private static final ToolkitLock
private static final boolean
private static final Method
private static final Method

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static AbstractGraphicsDevice

Returns:

AbstractGraphicsDevice instance reflecting the awtComp
createDevice
(final Component
must be displayable and must have a GraphicsConfiguration
awtComp
)

public static AbstractGraphicsScreen

Returns:

AbstractGraphicsScreen instance reflecting the awtComp
getAbstractGraphicsScreen
(final Component
must be displayable and must have a GraphicsConfiguration
awtComp
)

public static JAWT
getJAWT(final boolean useOffscreenLayerIfAvailable)

public static ToolkitLock
public static final int
public static int
getOSXCALayerQuirks()

Returns bitfield of required JAWT OSX CALayer quirks to mediate AWT impl.

public static final boolean

Returns:

true if the given min and max scale values have changed, otherwise false.
getPixelScale
(final GraphicsDevice
the GraphicsDevice instance used to query the pixel scale
device
,
final float[]
current and output min scale values
minScale
,
final float[]
current and output max scale values
maxScale
)

Returns the pixel scale factor of the given GraphicsDevice, if supported.

public static final boolean

Returns:

true if the given min and max scale values have changed, otherwise false.
getPixelScale
(final GraphicsConfiguration
the GraphicsConfiguration instance used to query the pixel scale
gc
,
final float[]
current and output min scale values
minScale
,
final float[]
current and output max scale values
maxScale
)

Returns the pixel scale factor of the given GraphicsConfiguration's GraphicsDevice, if supported.

private static String
public static boolean
public static void
public static boolean
public static boolean
public static boolean
public static boolean
isOffscreenLayerRequired()

Returns true if this platform's JAWT implementation requires using offscreen layer.

public static boolean
isOffscreenLayerSupported()

Returns true if this platform's JAWT implementation supports offscreen layer.

public static void
lockToolkit()

Locks the AWT's global ReentrantLock.

public static void
private static String
toHexString(final long val)

public static void
unlockToolkit()

Unlocks the AWT's global ReentrantLock.

public static final void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEBUGback to summary
public static final boolean DEBUG
getCGDisplayIDMethodOnOSXback to summary
private static final Method getCGDisplayIDMethodOnOSX
getScaleFactorMethodback to summary
private static final Method getScaleFactorMethod
hasSunToolkitAWTLockback to summary
private static final boolean hasSunToolkitAWTLock
headlessModeback to summary
private static final boolean headlessMode
isQueueFlusherThreadback to summary
private static final Method isQueueFlusherThread
j2dExistback to summary
private static final boolean j2dExist
JAWT_MACOSX_USE_CALAYERback to summary
public static final int JAWT_MACOSX_USE_CALAYER

OSX JAWT version option to use CALayer

JAWT_MacOSXCALayerMinVersionback to summary
public static final VersionNumber JAWT_MacOSXCALayerMinVersion

OSX JAWT CALayer availability on Mac OS X >= 10.6 Update 4 (recommended)

JAWT_MacOSXCALayerRequiredForJavaVersionback to summary
public static final VersionNumber JAWT_MacOSXCALayerRequiredForJavaVersion

OSX JAWT CALayer required with Java >= 1.7.0 (implies OS X >= 10.7

JAWT_OSX_CALAYER_QUIRK_LAYOUTback to summary
public static final int JAWT_OSX_CALAYER_QUIRK_LAYOUT

CALayer position needs to be derived from AWT position in relation to super CALayer.

AWT's super-calayer, i.e. the AWT top-container's CALayer, does not layout our root-calayer in respect to this component's position and size, at least when resizing programmatically.

CALayer position has origin 0/0 at bottom/left, where AWT component has origin 0/0 at top/left.

The super-calayer bounds exclude the frame's heavyweight border/insets.

The super-calayer lies within the AWT top-container client space (content).

Component's location in super-calayer:

     p0 = c.locationOnScreen();
     p0 -= c.getOutterComp.getPos();
     p0 -= c.getOutterComp.getInsets();
Where 'locationOnScreen()' is:
    p0 = 0/0;
    while( null != c ) {
      p0 += c.getPos();
    }

This flags also sets JAWT_OSX_CALAYER_QUIRK_SIZE, i.e. they are related.

As of today, this flag is enabled for w/ AWT >= 1.7.0_40.

Sync w/ NativeWindowProtocols.h

JAWT_OSX_CALAYER_QUIRK_POSITIONback to summary
public static final int JAWT_OSX_CALAYER_QUIRK_POSITION

CALayer position needs to be set to zero.

AWT's super-calayer, i.e. the AWT's own component CALayer, has a broken layout and needs it's sub-layers to be located at position 0/0.

See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7172187.

Further more a re-layout seems to be required in this case, i.e. a programmatic forced resize +1 and it's inverted resize -1.

This flag is enabled w/ AWT < 1.7.0_40.

Sync w/ NativeWindowProtocols.h

JAWT_OSX_CALAYER_QUIRK_SIZEback to summary
public static final int JAWT_OSX_CALAYER_QUIRK_SIZE

CALayer size needs to be set using the AWT component size.

AWT's super-calayer, i.e. the AWT's own component CALayer, does not layout our root-calayer in respect to this component's position and size, at least when resizing programmatically.

As of today, this flag is enabled for all known AWT versions.

Sync w/ NativeWindowProtocols.h

jawtLockback to summary
private static final RecursiveLock jawtLock
jawtLockObjectback to summary
private static final JAWT jawtLockObject
jawtToolkitLockback to summary
private static final ToolkitLock jawtToolkitLock
SKIP_AWT_HIDPIback to summary
private static final boolean SKIP_AWT_HIDPI
sunToolkitAWTLockMethodback to summary
private static final Method sunToolkitAWTLockMethod
sunToolkitAWTUnlockMethodback to summary
private static final Method sunToolkitAWTUnlockMethod

Constructor Detail

JAWTUtilback to summary
public JAWTUtil()

Method Detail

createDeviceback to summary
public static AbstractGraphicsDevice createDevice(final Component awtComp) throws IllegalArgumentException
Parameters
awtComp:Component

must be displayable and must have a GraphicsConfiguration

Returns:AbstractGraphicsDevice

AbstractGraphicsDevice instance reflecting the awtComp

Exceptions
IllegalArgumentException:
if awtComp is not displayable or has null GraphicsConfiguration.
See Also
getAbstractGraphicsScreen(java.awt.Component)
getAbstractGraphicsScreenback to summary
public static AbstractGraphicsScreen getAbstractGraphicsScreen(final Component awtComp) throws IllegalArgumentException
Parameters
awtComp:Component

must be displayable and must have a GraphicsConfiguration

Returns:AbstractGraphicsScreen

AbstractGraphicsScreen instance reflecting the awtComp

Exceptions
IllegalArgumentException:
if awtComp is not displayable or has null GraphicsConfiguration.
See Also
createDevice(java.awt.Component)
getJAWTback to summary
public static JAWT getJAWT(final boolean useOffscreenLayerIfAvailable)
getJAWTToolkitLockback to summary
public static ToolkitLock getJAWTToolkitLock()
getMonitorDisplayIDback to summary
public static final int getMonitorDisplayID(final GraphicsDevice device)
getOSXCALayerQuirksback to summary
public static int getOSXCALayerQuirks()

Returns bitfield of required JAWT OSX CALayer quirks to mediate AWT impl. bugs.

Returns zero, if platform is not Platform.OSType#MACOS or not supporting CALayer, i.e. OSX < 10.6.4.

Otherwise includes

getPixelScaleback to summary
public static final boolean getPixelScale(final GraphicsDevice device, final float[] minScale, final float[] maxScale)

Returns the pixel scale factor of the given GraphicsDevice, if supported.

If the component does not support pixel scaling the default one is returned.

Note

Currently only supported on OSX since 1.7.0_40 for HiDPI retina displays

Parameters
device:GraphicsDevice

the GraphicsDevice instance used to query the pixel scale

minScale:float[]

current and output min scale values

maxScale:float[]

current and output max scale values

Returns:boolean

true if the given min and max scale values have changed, otherwise false.

getPixelScaleback to summary
public static final boolean getPixelScale(final GraphicsConfiguration gc, final float[] minScale, final float[] maxScale)

Returns the pixel scale factor of the given GraphicsConfiguration's GraphicsDevice, if supported.

If the GraphicsDevice is null, zero is returned.

If the component does not support pixel scaling the default one is returned.

Note

Currently only supported on OSX since 1.7.0_40 for HiDPI retina displays

Parameters
gc:GraphicsConfiguration

the GraphicsConfiguration instance used to query the pixel scale

minScale:float[]

current and output min scale values

maxScale:float[]

current and output max scale values

Returns:boolean

true if the given min and max scale values have changed, otherwise false.

getThreadNameback to summary
private static String getThreadName()
hasJava2Dback to summary
public static boolean hasJava2D()
initSingletonback to summary
public static void initSingleton()

Called by NativeWindowFactory#initSingleton()

isHeadlessModeback to summary
public static boolean isHeadlessMode()
isJava2DQueueFlusherThreadback to summary
public static boolean isJava2DQueueFlusherThread()
isJAWTUsingOffscreenLayerback to summary
public static boolean isJAWTUsingOffscreenLayer(final JAWT jawt)
isOffscreenLayerRequiredback to summary
public static boolean isOffscreenLayerRequired()

Returns true if this platform's JAWT implementation requires using offscreen layer.

isOffscreenLayerSupportedback to summary
public static boolean isOffscreenLayerSupported()

Returns true if this platform's JAWT implementation supports offscreen layer.

lockToolkitback to summary
public static void lockToolkit() throws NativeWindowException

Locks the AWT's global ReentrantLock.

JAWT's native Lock() function calls SunToolkit.awtLock(), which just uses AWT's global ReentrantLock.

AWT locking is wrapped through a recursive lock object.

shutdownback to summary
public static void shutdown()

Called by NativeWindowFactory#shutdown()

toHexStringback to summary
private static String toHexString(final long val)
unlockToolkitback to summary
public static void unlockToolkit()

Unlocks the AWT's global ReentrantLock.

JAWT's native Unlock() function calls SunToolkit.awtUnlock(), which just uses AWT's global ReentrantLock.

AWT unlocking is wrapped through a recursive lock object.

validateLockedback to summary
public static final void validateLocked() throws RuntimeException
jogamp.nativewindow.jawt back to summary

private Class JAWTUtil.PrivilegedDataBlob1

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv Method
pack-priv Method
pack-priv boolean
pack-priv Method
pack-priv Method

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

getCGDisplayIDMethodOnOSXback to summary
pack-priv Method getCGDisplayIDMethodOnOSX
getScaleFactorMethodback to summary
pack-priv Method getScaleFactorMethod
okback to summary
pack-priv boolean ok
sunToolkitAWTLockMethodback to summary
pack-priv Method sunToolkitAWTLockMethod
sunToolkitAWTUnlockMethodback to summary
pack-priv Method sunToolkitAWTUnlockMethod

Constructor Detail

PrivilegedDataBlob1back to summary
pack-priv PrivilegedDataBlob1()