Class JAWTUtil
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
static final int
OSX JAWT version option to use CALayerstatic final com.jogamp.common.util.VersionNumber
OSX JAWT CALayer availability on Mac OS X >= 10.6 Update 4 (recommended)static final com.jogamp.common.util.VersionNumber
OSX JAWT CALayer required with Java >= 1.7.0 (implies OS X >= 10.7static final int
CALayer position needs to be derived from AWT position in relation to super CALayer.static final int
CALayer position needs to be set to zero.static final int
CALayer size needs to be set using the AWT component size. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.jogamp.nativewindow.AbstractGraphicsDevice
createDevice
(Component awtComp) static boolean
disableBackgroundErase
(Component component) Callssun.awt.SunToolkit.disableBackgroundErase(Component component)
if available.static com.jogamp.nativewindow.AbstractGraphicsScreen
getAbstractGraphicsScreen
(Component awtComp) static jogamp.nativewindow.jawt.JAWT
getJAWT
(boolean useOffscreenLayerIfAvailable) static com.jogamp.nativewindow.ToolkitLock
static final Integer
getMonitorDisplayID
(GraphicsDevice device) Queries the Monitor's display ID of the given devicestatic int
Returns bitfield of required JAWT OSX CALayer quirks to mediate AWT impl. bugs.static final boolean
getPixelScale
(GraphicsConfiguration gc, float[] minScale, float[] maxScale) Returns the pixel scale factor of the givenGraphicsConfiguration
'sGraphicsDevice
, if supported.static final boolean
getPixelScale
(GraphicsDevice device, float[] minScale, float[] maxScale) Returns the pixel scale factor of the givenGraphicsDevice
, if supported.static boolean
static void
Called byNativeWindowFactory.initSingleton()
static boolean
static boolean
static boolean
isJAWTUsingOffscreenLayer
(jogamp.nativewindow.jawt.JAWT jawt) static boolean
Returns true if this platform's JAWT implementation requires using offscreen layer.static boolean
Returns true if this platform's JAWT implementation supports offscreen layer.static void
Locks the AWT's global ReentrantLock.static void
shutdown()
Called byinvalid @link
NativeWindowFactory#shutdown()
static void
Unlocks 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.MACOS
or not supporting CALayer, i.e. OSX invalid input: '<' 10.6.4.Otherwise includes
JAWT_OSX_CALAYER_QUIRK_SIZE
(always)JAWT_OSX_CALAYER_QUIRK_POSITION
if JVM invalid input: '<' 1.7.0_40JAWT_OSX_CALAYER_QUIRK_LAYOUT
if 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:
true
if 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:
null
if 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
one
is returned.- Parameters:
device
- theGraphicsDevice
instance used to query the pixel scaleminScale
- current and output min scale valuesmaxScale
- current and output max scale values- Returns:
true
if 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
GraphicsDevice
isnull
,one
is returned.If the component does not support pixel scaling or SKIP_AWT_HIDPI is set, the default value
one
is returned.- Parameters:
gc
- theGraphicsConfiguration
instance used to query the pixel scaleminScale
- current and output min scale valuesmaxScale
- current and output max scale values- Returns:
true
if 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 bedisplayable
and must have aGraphicsConfiguration
- Returns:
- AbstractGraphicsDevice instance reflecting the
awtComp
- Throws:
IllegalArgumentException
- ifawtComp
is notdisplayable
or hasnull
GraphicsConfiguration
.- See Also:
-
getAbstractGraphicsScreen
public static com.jogamp.nativewindow.AbstractGraphicsScreen getAbstractGraphicsScreen(Component awtComp) throws IllegalArgumentException - Parameters:
awtComp
- must bedisplayable
and must have aGraphicsConfiguration
- Returns:
- AbstractGraphicsScreen instance reflecting the
awtComp
- Throws:
IllegalArgumentException
- ifawtComp
is notdisplayable
or hasnull
GraphicsConfiguration
.- See Also:
-