Class JAWTWindow
- java.lang.Object
-
- com.jogamp.nativewindow.awt.JAWTWindow
-
- All Implemented Interfaces:
NativeSurface
,NativeSurfaceHolder
,NativeWindow
,OffscreenLayerOption
,OffscreenLayerSurface
,ScalableSurface
,SurfaceUpdatedListener
public abstract class JAWTWindow extends Object implements NativeWindow, OffscreenLayerSurface, OffscreenLayerOption, ScalableSurface
-
-
Field Summary
-
Fields inherited from interface com.jogamp.nativewindow.NativeSurface
LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED
-
Fields inherited from interface com.jogamp.nativewindow.ScalableSurface
AUTOMAX_PIXELSCALE, IDENTITY_PIXELSCALE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l)
Inserts the givenSurfaceUpdatedListener
at the specified position in the list.void
addSurfaceUpdatedListener(SurfaceUpdatedListener l)
Appends the givenSurfaceUpdatedListener
to the end of the list.void
attachSurfaceLayer(long layerHandle)
Attach the offscreen layer to this offscreen layer surface.boolean
canSetSurfaceScale()
Returns true ifScalableSurface.setSurfaceScale(float[])
is supported, otherwise false.int[]
convertToPixelUnits(int[] windowUnitsAndResult)
Converts the given window units into pixel units in place.int[]
convertToWindowUnits(int[] pixelUnitsAndResult)
Converts the given pixel units into window units in place.void
destroy()
Destroys this window incl.void
detachSurfaceLayer()
Detaches a previously attached offscreen layer from this offscreen layer surface.long
getAttachedSurfaceLayer()
Returns the attached surface layer or null if none is attached.Component
getAWTComponent()
AWTGraphicsConfiguration
getAWTGraphicsConfiguration()
Return the currentAWTGraphicsConfiguration
instance, which also holds itsupstream component
'sGraphicsConfiguration
Rectangle
getBounds()
Returns a newly createdRectangle
containing window origin,NativeWindow.getX()
&NativeWindow.getY()
, and size,NativeWindow.getWidth()
&NativeWindow.getHeight()
, in window units.float[]
getCurrentSurfaceScale(float[] result)
Returns the current pixel scale of the associatedNativeSurface
.long
getDisplayHandle()
Convenience: Get display handle from AbstractGraphicsConfiguration .AbstractGraphicsConfiguration
getGraphicsConfiguration()
Returns the graphics configuration corresponding to this window.int
getHeight()
Returns the height of the client area excluding insets (window decorations) in window units.InsetsImmutable
getInsets()
Returns the insets defined as the width and height of the window decoration on the left, right, top and bottom in window units.jogamp.nativewindow.jawt.JAWT
getJAWT()
Returns the underlying JAWT instance created @lockSurface()
.RectangleImmutable
getJAWTSurfaceBounds()
Point
getLocationOnScreen(Point storage)
Returns the window's top-left client-area position in the screen.RecursiveLock
getLock()
Returns the implementation'sRecursiveLock
synchronizing multithreaded access if used.float[]
getMaximumSurfaceScale(float[] result)
Returns the maximum pixel scale of the associatedNativeSurface
.float[]
getMinimumSurfaceScale(float[] result)
Returns the minimum pixel scale of the associatedNativeSurface
.NativeSurface
getNativeSurface()
Returns the associatedNativeSurface
of thisNativeSurfaceHolder
.NativeWindow
getParent()
float[]
getRequestedSurfaceScale(float[] result)
Returns therequested
pixel scale of the associatedNativeSurface
.int
getScreenIndex()
Convenience: Get display handle from AbstractGraphicsConfiguration .boolean
getShallUseOffscreenLayer()
Returns the property set byOffscreenLayerOption.setShallUseOffscreenLayer(boolean)
.Rectangle
getSurfaceBounds()
Returns a newly createdRectangle
containing window's surface origin and size in pixel units.long
getSurfaceHandle()
Returns the handle to the surface for this NativeSurface.int
getSurfaceHeight()
Returns the height of the client area excluding insets (window decorations) in pixel units.Thread
getSurfaceLockOwner()
Return the locking owner's Thread, or null if not locked.int
getSurfaceWidth()
Returns the width of the client area excluding insets (window decorations) in pixel units.int
getWidth()
Returns the width of the client area excluding insets (window decorations) in window units.long
getWindowHandle()
Returns the window handle for this NativeWindow.int
getX()
Returns the x position of the top-left corner of the client area relative to it's parent in window units.int
getY()
Returns the current y position of the top-left corner of the client area relative to it's parent in window units.boolean
hasFocus()
Returns true if this native window owns the focus, otherwise false.boolean
hasPixelScaleChanged()
Returns and clears thehasPixelScaleChanged
flag, as set vialockSurface()
.boolean
hideCursor()
Optional method hiding the cursor in the corresponding on-screen surface/window, if exists.boolean
isApplet()
Return false since there is no moreApplet
support.boolean
isOffscreenLayerSurfaceEnabled()
Returns true if this instance uses an offscreen layer, otherwise false.boolean
isSurfaceLayerAttached()
Returns true if a surface layer is attached, otherwise false.boolean
isSurfaceLockedByOtherThread()
Query if surface is locked by another thread, i.e.int
lockSurface()
Lock the surface of this native window.void
removeSurfaceUpdatedListener(SurfaceUpdatedListener l)
Remove the specifiedSurfaceUpdatedListener
from the list.void
setAWTGraphicsConfiguration(AWTGraphicsConfiguration config)
Set a newAWTGraphicsConfiguration
instance, as required ifupstream component
'sGraphicsConfiguration
has been changed due to reconfiguration, e.g.void
setChosenCapabilities(CapabilitiesImmutable caps)
Sets the capabilities of this instance, allowing upstream API's to refine it, i.e.boolean
setCursor(PixelRectangle pixelrect, PointImmutable hotSpot)
Optional method setting cursor in the corresponding on-screen surface/window, if exists.void
setShallUseOffscreenLayer(boolean v)
Request an offscreen layer, if supported.boolean
setSurfaceScale(float[] pixelScale)
Request a pixel scale in x- and y-direction for the associatedNativeSurface
, wheresize_in_pixel_units = pixel_scale * size_in_window_units
.boolean
surfaceSwap()
Provide a mechanism to utilize custom (pre-) swap surface code.void
surfaceUpdated(Object updater, NativeSurface ns, long when)
Notification of a surface update event, eg.String
toString()
void
unlockSurface()
Unlock the surface of this native window Shall not modify the surface handle, seeNativeSurface.lockSurface()
boolean
updatePixelScale(GraphicsConfiguration gc, boolean clearFlag)
Updates the minimum and maximum pixel-scale values and returnstrue
if they were updated.
-
-
-
Method Detail
-
setAWTGraphicsConfiguration
public final void setAWTGraphicsConfiguration(AWTGraphicsConfiguration config)
Set a newAWTGraphicsConfiguration
instance, as required ifupstream component
'sGraphicsConfiguration
has been changed due to reconfiguration, e.g. moving to a different monitor or changed capabilities.Upstream component
shall overrideComponent.getGraphicsConfiguration()
, which shall call this method if detecting a reconfiguration. See JOGL's GLCanvas and NewtCanvasAWT.- Parameters:
config
- the newAWTGraphicsConfiguration
- See Also:
getAWTGraphicsConfiguration()
-
getAWTGraphicsConfiguration
public final AWTGraphicsConfiguration getAWTGraphicsConfiguration()
Return the currentAWTGraphicsConfiguration
instance, which also holds itsupstream component
'sGraphicsConfiguration
-
canSetSurfaceScale
public final boolean canSetSurfaceScale()
Returns true ifScalableSurface.setSurfaceScale(float[])
is supported, otherwise false.For pure downstream scalable surfaces like AWT widgets, setting the picel scale is not supported since the pixel scale is set by the underlying toolkit.
This implementation returns false, i.e. not supporting manual change of pixel-scale.
- Specified by:
canSetSurfaceScale
in interfaceScalableSurface
-
setSurfaceScale
public boolean setSurfaceScale(float[] pixelScale)
Request a pixel scale in x- and y-direction for the associatedNativeSurface
, wheresize_in_pixel_units = pixel_scale * size_in_window_units
.Default pixel scale request for both directions is
ScalableSurface.AUTOMAX_PIXELSCALE
.If
ScalableSurface.canSetSurfaceScale()
returns false, requested pixel scale isScalableSurface.AUTOMAX_PIXELSCALE
, immutable and method returns false.In case platform only supports uniform pixel scale, i.e. one scale for both directions, either
ScalableSurface.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
ScalableSurface.IDENTITY_PIXELSCALE
if not supported or clipped to the platform maximum. It can be queried viaScalableSurface.getRequestedSurfaceScale(float[])
.The actual realized pixel scale values of the
NativeSurface
can be queried viaScalableSurface.getCurrentSurfaceScale(float[])
or computed viasurface.
convertToPixelUnits
(new int[] { 1, 1 })Ignored for an AWT widget since pixelScale is dictated by AWT mechanisms.
- Specified by:
setSurfaceScale
in interfaceScalableSurface
- Parameters:
pixelScale
- requested surface pixel scale float[2] values for x- and y-direction.- Returns:
true
if thecurrent pixel scale
has changed, otherwisefalse
.- See Also:
ScalableSurface.getRequestedSurfaceScale(float[])
,ScalableSurface.canSetSurfaceScale()
-
getRequestedSurfaceScale
public final float[] getRequestedSurfaceScale(float[] result)
Returns therequested
pixel scale of the associatedNativeSurface
.If
ScalableSurface.canSetSurfaceScale()
returns false, requested pixel scale isScalableSurface.AUTOMAX_PIXELSCALE
and immutable.Returns
ScalableSurface.AUTOMAX_PIXELSCALE
, always.- Specified by:
getRequestedSurfaceScale
in interfaceScalableSurface
- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the current pixelScale for chaining
- See Also:
ScalableSurface.setSurfaceScale(float[])
,ScalableSurface.canSetSurfaceScale()
-
getCurrentSurfaceScale
public final float[] getCurrentSurfaceScale(float[] result)
Description copied from interface:ScalableSurface
Returns the current pixel scale of the associatedNativeSurface
.- Specified by:
getCurrentSurfaceScale
in interfaceScalableSurface
- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the current pixelScale for chaining
-
getMinimumSurfaceScale
public float[] getMinimumSurfaceScale(float[] result)
Returns the minimum pixel scale of the associatedNativeSurface
.Returns 1.0, always.
- Specified by:
getMinimumSurfaceScale
in interfaceScalableSurface
- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the minimum pixelScale for chaining
-
getMaximumSurfaceScale
public final float[] getMaximumSurfaceScale(float[] result)
Returns the maximum pixel scale of the associatedNativeSurface
.The maximum pixel scale maybe used to determine the proper dpi value of the monitor displaying this
NativeSurface
.surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale, with PpMM == pixel per millimeter
Returns
getCurrentSurfaceScale(float[])
.- Specified by:
getMaximumSurfaceScale
in interfaceScalableSurface
- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the maximum pixelScale for chaining
-
updatePixelScale
public final boolean updatePixelScale(GraphicsConfiguration gc, boolean clearFlag)
Updates the minimum and maximum pixel-scale values and returnstrue
if they were updated.- Parameters:
gc
- pre-fetchedGraphicsConfiguration
instance ofupstream component
, caller may use cachedgetAWTGraphicsConfiguration()
'sGC
or aComponent.getGraphicsConfiguration()
.clearFlag
- iftrue
, thehasPixelScaleChanged
flag will be cleared- Returns:
true
if values were updated, otherwisefalse
.- See Also:
hasPixelScaleChanged()
,getAWTGraphicsConfiguration()
,Component.getGraphicsConfiguration()
-
hasPixelScaleChanged
public final boolean hasPixelScaleChanged()
Returns and clears thehasPixelScaleChanged
flag, as set vialockSurface()
.hasPixelScaleChanged
istrue
, if theminimum
ormaximum
pixel scale has changed. User needs toset the current pixel scale
in this case using therequested pixel scale
to update the surface pixel scale.
-
getJAWTSurfaceBounds
public final RectangleImmutable getJAWTSurfaceBounds()
- Returns:
- the JAWT_DrawingSurfaceInfo's (JAWT_Rectangle) bounds in pixel units, updated with lock
-
getInsets
public final InsetsImmutable getInsets()
Description copied from interface:NativeWindow
Returns the insets defined as the width and height of the window decoration on the left, right, top and bottom in window units.Insets are zero if the window is undecorated, including child windows.
Insets are available only after the native window has been created, ie. the native window has been made visible.
The top-level window area's top-left corner is located atNativeWindow.getX()
- getInsets().getLeftWidth()
NativeWindow.getY()
- getInsets().getTopHeight()
NativeWindow.getWidth()
+ getInsets().getTotalWidth()
NativeWindow.getHeight()
+ getInsets().getTotalHeight()
- Specified by:
getInsets
in interfaceNativeWindow
- Returns:
- insets
-
getAWTComponent
public final Component getAWTComponent()
-
isApplet
public final boolean isApplet()
Return false since there is no moreApplet
support. Historical: Returns true if the AWT component is parented to anApplet
, otherwise false. This information is valid only afterlockSurface()
.
-
getJAWT
public final jogamp.nativewindow.jawt.JAWT getJAWT()
Returns the underlying JAWT instance created @lockSurface()
.
-
setShallUseOffscreenLayer
public void setShallUseOffscreenLayer(boolean v)
Description copied from interface:OffscreenLayerOption
Request an offscreen layer, if supported.Shall be called before the first
NativeSurface.lockSurface()
, and hence before realization.- Specified by:
setShallUseOffscreenLayer
in interfaceOffscreenLayerOption
- See Also:
OffscreenLayerOption.getShallUseOffscreenLayer()
,OffscreenLayerOption.isOffscreenLayerSurfaceEnabled()
-
getShallUseOffscreenLayer
public final boolean getShallUseOffscreenLayer()
Description copied from interface:OffscreenLayerOption
Returns the property set byOffscreenLayerOption.setShallUseOffscreenLayer(boolean)
.- Specified by:
getShallUseOffscreenLayer
in interfaceOffscreenLayerOption
-
isOffscreenLayerSurfaceEnabled
public final boolean isOffscreenLayerSurfaceEnabled()
Description copied from interface:OffscreenLayerOption
Returns true if this instance uses an offscreen layer, otherwise false.This instance is an offscreen layer, if
The return value is undefined before issuing the firstsetShallUseOffscreenLayer(true)
has been called before it's realization and first lock and the underlying implementation supports it.NativeSurface.lockSurface()
.- Specified by:
isOffscreenLayerSurfaceEnabled
in interfaceOffscreenLayerOption
- See Also:
OffscreenLayerOption.setShallUseOffscreenLayer(boolean)
-
attachSurfaceLayer
public final void attachSurfaceLayer(long layerHandle) throws NativeWindowException
Description copied from interface:OffscreenLayerSurface
Attach the offscreen layer to this offscreen layer surface.Implementation may realize all required resources at this point.
- Specified by:
attachSurfaceLayer
in interfaceOffscreenLayerSurface
- Throws:
NativeWindowException
- if#isOffscreenLayerSurfaceEnabled()
== false- See Also:
#isOffscreenLayerSurfaceEnabled()
-
detachSurfaceLayer
public final void detachSurfaceLayer() throws NativeWindowException
Description copied from interface:OffscreenLayerSurface
Detaches a previously attached offscreen layer from this offscreen layer surface.- Specified by:
detachSurfaceLayer
in interfaceOffscreenLayerSurface
- Throws:
NativeWindowException
- if#isOffscreenLayerSurfaceEnabled()
== false or no surface layer is attached.- See Also:
OffscreenLayerSurface.attachSurfaceLayer(long)
,#isOffscreenLayerSurfaceEnabled()
-
getAttachedSurfaceLayer
public final long getAttachedSurfaceLayer()
Description copied from interface:OffscreenLayerSurface
Returns the attached surface layer or null if none is attached.- Specified by:
getAttachedSurfaceLayer
in interfaceOffscreenLayerSurface
-
isSurfaceLayerAttached
public final boolean isSurfaceLayerAttached()
Description copied from interface:OffscreenLayerSurface
Returns true if a surface layer is attached, otherwise false.- Specified by:
isSurfaceLayerAttached
in interfaceOffscreenLayerSurface
-
setChosenCapabilities
public final void setChosenCapabilities(CapabilitiesImmutable caps)
Description copied from interface:OffscreenLayerSurface
Sets the capabilities of this instance, allowing upstream API's to refine it, i.e. OpenGL related settings.- Specified by:
setChosenCapabilities
in interfaceOffscreenLayerSurface
-
getLock
public final RecursiveLock getLock()
Description copied from interface:NativeSurface
Returns the implementation'sRecursiveLock
synchronizing multithreaded access if used. Otherwisenull
is being returned.NativeSurface
'sRecursiveLock
is only exposed to resolve special situations within the implementation and its usage is not advised if not absolutely necessary.Note that certain
NativeSurface
implementations only use theRecursiveLock
as an upfront re-entrance lock vehicle, but actually acquire and release the underlying windowing toolkit's lock facility on the first or last re-entrance lock, respectively.- Specified by:
getLock
in interfaceNativeSurface
- Specified by:
getLock
in interfaceOffscreenLayerSurface
-
setCursor
public final boolean setCursor(PixelRectangle pixelrect, PointImmutable hotSpot)
Description copied from interface:OffscreenLayerSurface
Optional method setting cursor in the corresponding on-screen surface/window, if exists.- Specified by:
setCursor
in interfaceOffscreenLayerSurface
- Parameters:
pixelrect
- cursor pixels, maybe null for default cursorhotSpot
- maybe null for default cursor- Returns:
- true if successful, i.e. on-screen surface/window w/ cursor capabilities exists. Otherwise false.
-
hideCursor
public final boolean hideCursor()
Description copied from interface:OffscreenLayerSurface
Optional method hiding the cursor in the corresponding on-screen surface/window, if exists.- Specified by:
hideCursor
in interfaceOffscreenLayerSurface
- Returns:
- true if successful, i.e. on-screen surface/window w/ cursor capabilities exists. Otherwise false.
-
lockSurface
public final int lockSurface() throws NativeWindowException, RuntimeException
Description copied from interface:NativeSurface
Lock the surface of this native window.The surface handle shall be valid after a successfull call, ie return a value other than
NativeSurface.LOCK_SURFACE_UNLOCKED
andNativeSurface.LOCK_SURFACE_NOT_READY
, which isboolean ok = LOCK_SURFACE_NOT_READY < lockSurface();
The caller may need to take care of the result
NativeSurface.LOCK_SURFACE_CHANGED
, where the surface handle is valid but has changed.This call is blocking until the surface has been locked or a timeout is reached. The latter will throw a runtime exception.
This call allows recursion from the same thread.
The implementation may want to aquire the application level
RecursiveLock
first before proceeding with a native surface lock.The implementation shall also invoke
AbstractGraphicsDevice.lock()
for the initial lock (recursive count zero).- Specified by:
lockSurface
in interfaceNativeSurface
- Returns:
NativeSurface.LOCK_SUCCESS
,NativeSurface.LOCK_SURFACE_CHANGED
orNativeSurface.LOCK_SURFACE_NOT_READY
.- Throws:
NativeWindowException
- if native locking failed, maybe platform relatedRuntimeException
- after timeout when waiting for the surface lock- See Also:
RecursiveLock
-
unlockSurface
public final void unlockSurface()
Description copied from interface:NativeSurface
Unlock the surface of this native window Shall not modify the surface handle, seeNativeSurface.lockSurface()
The implementation shall also invoke
AbstractGraphicsDevice.unlock()
for the final unlock (recursive count zero).The implementation shall be fail safe, i.e. tolerant in case the native resources are already released / unlocked. In this case the implementation shall simply ignore the call.
- Specified by:
unlockSurface
in interfaceNativeSurface
- See Also:
NativeSurface.lockSurface()
,RecursiveLock
-
isSurfaceLockedByOtherThread
public final boolean isSurfaceLockedByOtherThread()
Description copied from interface:NativeSurface
Query if surface is locked by another thread, i.e. not the current one.
Convenient shortcut for:final Thread o = getSurfaceLockOwner(); if( null != o && Thread.currentThread() != o ) { .. }
- Specified by:
isSurfaceLockedByOtherThread
in interfaceNativeSurface
-
getSurfaceLockOwner
public final Thread getSurfaceLockOwner()
Description copied from interface:NativeSurface
Return the locking owner's Thread, or null if not locked.- Specified by:
getSurfaceLockOwner
in interfaceNativeSurface
-
surfaceSwap
public boolean surfaceSwap()
Description copied from interface:NativeSurface
Provide a mechanism to utilize custom (pre-) swap surface code. This method is called before the render toolkit (e.g. JOGL) swaps the buffer/surface if double buffering is enabled.The implementation may itself apply the swapping, in which case true shall be returned.
- Specified by:
surfaceSwap
in interfaceNativeSurface
- Returns:
- true if this method completed swapping the surface, otherwise false, in which case eg the GLDrawable implementation has to swap the code.
-
addSurfaceUpdatedListener
public void addSurfaceUpdatedListener(SurfaceUpdatedListener l)
Description copied from interface:NativeSurface
Appends the givenSurfaceUpdatedListener
to the end of the list.- Specified by:
addSurfaceUpdatedListener
in interfaceNativeSurface
-
addSurfaceUpdatedListener
public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException
Description copied from interface:NativeSurface
Inserts the givenSurfaceUpdatedListener
at the specified position in the list.- Specified by:
addSurfaceUpdatedListener
in interfaceNativeSurface
- Parameters:
index
- Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().l
- The listener object to be inserted- Throws:
IndexOutOfBoundsException
- If the index is not within (0 <= index && index <= size()), or -1
-
removeSurfaceUpdatedListener
public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l)
Description copied from interface:NativeSurface
Remove the specifiedSurfaceUpdatedListener
from the list.- Specified by:
removeSurfaceUpdatedListener
in interfaceNativeSurface
-
surfaceUpdated
public void surfaceUpdated(Object updater, NativeSurface ns, long when)
Description copied from interface:SurfaceUpdatedListener
Notification of a surface update event, eg. after a swap buffer operation.- Specified by:
surfaceUpdated
in interfaceSurfaceUpdatedListener
- Parameters:
updater
- is the caller object who updated the surface, e.g. a JOGL GLDrawable.ns
- the updated NativeSurfacewhen
- the time in ms, when the surface was updated
-
getSurfaceHandle
public long getSurfaceHandle()
Description copied from interface:NativeSurface
Returns the handle to the surface for this NativeSurface.The surface handle should be set/update by
NativeSurface.lockSurface()
, whereNativeSurface.unlockSurface()
is not allowed to modify it. AfterNativeSurface.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.- Specified by:
getSurfaceHandle
in interfaceNativeSurface
-
getGraphicsConfiguration
public final AbstractGraphicsConfiguration getGraphicsConfiguration()
Description copied from interface:NativeSurface
Returns the graphics configuration corresponding to this window.In case the implementation utilizes a delegation pattern to wrap abstract toolkits, this method shall return the native
AbstractGraphicsConfiguration
viaAbstractGraphicsConfiguration.getNativeGraphicsConfiguration()
.- Specified by:
getGraphicsConfiguration
in interfaceNativeSurface
- See Also:
AbstractGraphicsConfiguration.getNativeGraphicsConfiguration()
,com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
-
getDisplayHandle
public final long getDisplayHandle()
Description copied from interface:NativeSurface
Convenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen . AbstractGraphicsDevice- Specified by:
getDisplayHandle
in interfaceNativeSurface
-
getScreenIndex
public final int getScreenIndex()
Description copied from interface:NativeSurface
Convenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen- Specified by:
getScreenIndex
in interfaceNativeSurface
-
getSurfaceWidth
public final int getSurfaceWidth()
Description copied from interface:NativeSurface
Returns the width of the client area excluding insets (window decorations) in pixel units.- Specified by:
getSurfaceWidth
in interfaceNativeSurface
- Returns:
- width of the client area in pixel units
- See Also:
NativeWindow.getWidth()
,NativeSurface.convertToWindowUnits(int[])
-
getSurfaceHeight
public final int getSurfaceHeight()
Description copied from interface:NativeSurface
Returns the height of the client area excluding insets (window decorations) in pixel units.- Specified by:
getSurfaceHeight
in interfaceNativeSurface
- Returns:
- height of the client area in pixel units
- See Also:
NativeWindow.getHeight()
,NativeSurface.convertToWindowUnits(int[])
-
convertToWindowUnits
public final int[] convertToWindowUnits(int[] pixelUnitsAndResult)
Description copied from interface:NativeSurface
Converts the given pixel units into window units in place.- Specified by:
convertToWindowUnits
in interfaceNativeSurface
- Parameters:
pixelUnitsAndResult
- int[2] storage holding the pixel units for the x- and y-coord to convert and the resulting values.- Returns:
- result int[2] storage pixelUnitsAndResult for chaining holding the converted values
- See Also:
ScalableSurface
-
convertToPixelUnits
public final int[] convertToPixelUnits(int[] windowUnitsAndResult)
Description copied from interface:NativeSurface
Converts the given window units into pixel units in place.- Specified by:
convertToPixelUnits
in interfaceNativeSurface
- Parameters:
windowUnitsAndResult
- int[2] storage holding the window units for the x- and y-coord to convert and the resulting values.- Returns:
- result int[2] storage windowUnitsAndResult for chaining holding the converted values
- See Also:
ScalableSurface
-
getNativeSurface
public final NativeSurface getNativeSurface()
Description copied from interface:NativeWindow
Returns the associatedNativeSurface
of thisNativeSurfaceHolder
.Returns this instance, which is-a
NativeSurface
.- Specified by:
getNativeSurface
in interfaceNativeSurfaceHolder
- Specified by:
getNativeSurface
in interfaceNativeWindow
-
getX
public final int getX()
Description copied from interface:NativeWindow
Returns the x position of the top-left corner of the client area relative to it's parent in window units.If no parent exist (top-level window), this coordinate equals the screen coordinate.
Since the position reflects the client area, it does not include the insets.
See Coordinate System.
- Specified by:
getX
in interfaceNativeWindow
- See Also:
NativeWindow.getInsets()
,NativeWindow.getLocationOnScreen(Point)
-
getY
public final int getY()
Description copied from interface:NativeWindow
Returns the current y position of the top-left corner of the client area relative to it's parent in window units.If no parent exist (top-level window), this coordinate equals the screen coordinate.
Since the position reflects the client area, it does not include the insets.
See Coordinate System.
- Specified by:
getY
in interfaceNativeWindow
- See Also:
NativeWindow.getInsets()
,NativeWindow.getLocationOnScreen(Point)
-
getWidth
public final int getWidth()
Description copied from interface:NativeWindow
Returns the width of the client area excluding insets (window decorations) in window units.- Specified by:
getWidth
in interfaceNativeWindow
- Returns:
- width of the client area in window units
- See Also:
NativeSurface.getSurfaceWidth()
-
getHeight
public final int getHeight()
Description copied from interface:NativeWindow
Returns the height of the client area excluding insets (window decorations) in window units.- Specified by:
getHeight
in interfaceNativeWindow
- Returns:
- height of the client area in window units
- See Also:
NativeSurface.getSurfaceHeight()
-
getBounds
public final Rectangle getBounds()
Description copied from interface:NativeWindow
Returns a newly createdRectangle
containing window origin,NativeWindow.getX()
&NativeWindow.getY()
, and size,NativeWindow.getWidth()
&NativeWindow.getHeight()
, in window units.- Specified by:
getBounds
in interfaceNativeWindow
-
getSurfaceBounds
public final Rectangle getSurfaceBounds()
Description copied from interface:NativeWindow
Returns a newly createdRectangle
containing window's surface origin and size in pixel units.- Specified by:
getSurfaceBounds
in interfaceNativeWindow
-
destroy
public void destroy()
Description copied from interface:NativeWindow
Destroys this window incl. releasing all related resources.- Specified by:
destroy
in interfaceNativeWindow
-
getParent
public final NativeWindow getParent()
- Specified by:
getParent
in interfaceNativeWindow
- Returns:
- The parent NativeWindow, or null if this NativeWindow is top level.
-
getWindowHandle
public long getWindowHandle()
Description copied from interface:NativeWindow
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.- Specified by:
getWindowHandle
in interfaceNativeWindow
-
getLocationOnScreen
public Point getLocationOnScreen(Point storage)
Returns the window's top-left client-area position in the screen.If
Point
is notnull
, 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.- Specified by:
getLocationOnScreen
in interfaceNativeWindow
- Parameters:
storage
- OptionalPoint
storage. If not null,null
, it is translated about the resulting screen position and returned.- See Also:
NativeWindow.getX()
,NativeWindow.getY()
,NativeWindow.getInsets()
-
hasFocus
public boolean hasFocus()
Description copied from interface:NativeWindow
Returns true if this native window owns the focus, otherwise false.- Specified by:
hasFocus
in interfaceNativeWindow
-
-