Class JAWTUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final intOSX JAWT version option to use CALayerstatic final com.jogamp.common.util.VersionNumberOSX JAWT CALayer availability on Mac OS X >= 10.6 Update 4 (recommended)static final com.jogamp.common.util.VersionNumberOSX JAWT CALayer required with Java >= 1.7.0 (implies OS X >= 10.7static final intCALayer position needs to be derived from AWT position in relation to super CALayer.static final intCALayer position needs to be set to zero.static final intCALayer size needs to be set using the AWT component size. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.jogamp.nativewindow.AbstractGraphicsDevicecreateDevice(Component awtComp) static booleandisableBackgroundErase(Component component) Callssun.awt.SunToolkit.disableBackgroundErase(Component component)if available.static com.jogamp.nativewindow.AbstractGraphicsScreengetAbstractGraphicsScreen(Component awtComp) static jogamp.nativewindow.jawt.JAWTgetJAWT(boolean useOffscreenLayerIfAvailable) static com.jogamp.nativewindow.ToolkitLockstatic final IntegergetMonitorDisplayID(GraphicsDevice device) Queries the Monitor's display ID of the given devicestatic intReturns bitfield of required JAWT OSX CALayer quirks to mediate AWT impl. bugs.static final booleangetPixelScale(GraphicsConfiguration gc, float[] minScale, float[] maxScale) Returns the pixel scale factor of the givenGraphicsConfiguration'sGraphicsDevice, if supported.static final booleangetPixelScale(GraphicsDevice device, float[] minScale, float[] maxScale) Returns the pixel scale factor of the givenGraphicsDevice, if supported.static booleanstatic voidCalled byNativeWindowFactory.initSingleton()static booleanstatic booleanstatic booleanisJAWTUsingOffscreenLayer(jogamp.nativewindow.jawt.JAWT jawt) static booleanReturns true if this platform's JAWT implementation requires using offscreen layer.static booleanReturns true if this platform's JAWT implementation supports offscreen layer.static voidLocks the AWT's global ReentrantLock.static voidshutdown()Called byinvalid @link
NativeWindowFactory#shutdown()static voidUnlocks the AWT's global ReentrantLock.static final void
-
Field Details
-
DEBUG
public static final boolean DEBUG -
JAWT_MACOSX_USE_CALAYER
public static final int JAWT_MACOSX_USE_CALAYEROSX JAWT version option to use CALayer- See Also:
-
JAWT_MacOSXCALayerMinVersion
public static final com.jogamp.common.util.VersionNumber JAWT_MacOSXCALayerMinVersionOSX JAWT CALayer availability on Mac OS X >= 10.6 Update 4 (recommended) -
JAWT_MacOSXCALayerRequiredForJavaVersion
public static final com.jogamp.common.util.VersionNumber JAWT_MacOSXCALayerRequiredForJavaVersionOSX JAWT CALayer required with Java >= 1.7.0 (implies OS X >= 10.7 -
JAWT_OSX_CALAYER_QUIRK_SIZE
public static final int JAWT_OSX_CALAYER_QUIRK_SIZECALayer 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
- See Also:
-
JAWT_OSX_CALAYER_QUIRK_POSITION
public static final int JAWT_OSX_CALAYER_QUIRK_POSITIONCALayer 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 invalid input: '<' 1.7.0_40.
Sync w/ NativeWindowProtocols.h
- See Also:
-
JAWT_OSX_CALAYER_QUIRK_LAYOUT
public static final int JAWT_OSX_CALAYER_QUIRK_LAYOUTCALayer 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
- See Also:
-
-
Constructor Details
-
JAWTUtil
public JAWTUtil()
-
-
Method Details
-
isOffscreenLayerSupported
public static boolean isOffscreenLayerSupported()Returns true if this platform's JAWT implementation supports offscreen layer. -
isOffscreenLayerRequired
public static boolean isOffscreenLayerRequired()Returns true if this platform's JAWT implementation requires using offscreen layer. -
getOSXCALayerQuirks
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.MACOSor not supporting CALayer, i.e. OSX invalid input: '<' 10.6.4.Otherwise includes
JAWT_OSX_CALAYER_QUIRK_SIZE(always)JAWT_OSX_CALAYER_QUIRK_POSITIONif JVM invalid input: '<' 1.7.0_40JAWT_OSX_CALAYER_QUIRK_LAYOUTif JVM >= 1.7.0_40
-
getJAWT
public static jogamp.nativewindow.jawt.JAWT getJAWT(boolean useOffscreenLayerIfAvailable) - Parameters:
useOffscreenLayerIfAvailable-- Returns:
-
isJAWTUsingOffscreenLayer
public static boolean isJAWTUsingOffscreenLayer(jogamp.nativewindow.jawt.JAWT jawt) -
initSingleton
public static void initSingleton()Called byNativeWindowFactory.initSingleton() -
shutdown
public static void shutdown()Called byinvalid @link
NativeWindowFactory#shutdown() -
hasJava2D
public static boolean hasJava2D() -
isJava2DQueueFlusherThread
public static boolean isJava2DQueueFlusherThread() -
isHeadlessMode
public static boolean isHeadlessMode() -
lockToolkit
public static void lockToolkit() throws com.jogamp.nativewindow.NativeWindowExceptionLocks 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.
- Throws:
com.jogamp.nativewindow.NativeWindowException
-
unlockToolkit
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.
-
validateLocked
- Throws:
RuntimeException
-
getJAWTToolkitLock
public static com.jogamp.nativewindow.ToolkitLock getJAWTToolkitLock() -
disableBackgroundErase
Callssun.awt.SunToolkit.disableBackgroundErase(Component component)if available.Disables the AWT's erasing of the given native Component's background since Java SE 6. This feature can also be enabled by setting the system property
sun.awt.noerasebackground=true.- Parameters:
component-- Returns:
trueif available and successful, otherwisefalse
-
getMonitorDisplayID
Queries the Monitor's display ID of the given deviceCurrently only supported for OSX on Javainvalid input: '<'9
- Parameters:
device- for which the display id is being queried- Returns:
nullif not supported (Java9+ or !OSX), otherwise the monitor displayID
-
getPixelScale
public static final boolean getPixelScale(GraphicsDevice device, float[] minScale, float[] maxScale) Returns the pixel scale factor of the givenGraphicsDevice, if supported.This method is generally supported on Java9+
If the component does not support pixel scaling or SKIP_AWT_HIDPI is set, the default value
oneis returned.- Parameters:
device- theGraphicsDeviceinstance used to query the pixel scaleminScale- current and output min scale valuesmaxScale- current and output max scale values- Returns:
trueif the given min and max scale values have changed, otherwisefalse.
-
getPixelScale
public static final boolean getPixelScale(GraphicsConfiguration gc, float[] minScale, float[] maxScale) Returns the pixel scale factor of the givenGraphicsConfiguration'sGraphicsDevice, if supported.This method is generally supported on Java9+
If the
GraphicsDeviceisnull,oneis returned.If the component does not support pixel scaling or SKIP_AWT_HIDPI is set, the default value
oneis returned.- Parameters:
gc- theGraphicsConfigurationinstance used to query the pixel scaleminScale- current and output min scale valuesmaxScale- current and output max scale values- Returns:
trueif the given min and max scale values have changed, otherwisefalse.
-
createDevice
public static com.jogamp.nativewindow.AbstractGraphicsDevice createDevice(Component awtComp) throws IllegalArgumentException - Parameters:
awtComp- must bedisplayableand must have aGraphicsConfiguration- Returns:
- AbstractGraphicsDevice instance reflecting the
awtComp - Throws:
IllegalArgumentException- ifawtCompis notdisplayableor hasnullGraphicsConfiguration.- See Also:
-
getAbstractGraphicsScreen
public static com.jogamp.nativewindow.AbstractGraphicsScreen getAbstractGraphicsScreen(Component awtComp) throws IllegalArgumentException - Parameters:
awtComp- must bedisplayableand must have aGraphicsConfiguration- Returns:
- AbstractGraphicsScreen instance reflecting the
awtComp - Throws:
IllegalArgumentException- ifawtCompis notdisplayableor hasnullGraphicsConfiguration.- See Also:
-